[SERVER-74029] Add SerializationContext to custom deserializer/serializer for C++ types Created: 15/Feb/23  Updated: 29/Oct/23  Resolved: 16/Mar/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Hugh Tong (Inactive) Assignee: Hugh Tong (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-74284 Fix existing tests for command serial... Closed
is depended on by SERVER-76084 Create targeted tests for command de/... Closed
Assigned Teams:
Serverless
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2023-03-06, Server Serverless 2023-03-20
Participants:

 Description   

SerializationContext are currently tied to the `deserialize_with_tenant` flag being used in IDL config files.  In some of these cases, C++ types are imported by defining these types in the IDL config, and they contain custom serializers and deserializers that are called verbatim.

Specifically, the function _gen_field_deserializer_expression() in the IDL generator will create the custom deserializer, and passes the tenantId in but does not pass the SerializationContext in.  These flags are used in both serialization and deserialization, so we will need to add it for serialization as well (in _gen_serializer_method_custom()), but this might require modifying the behavior of the associated BsonCppTypeBase.

This will also affect the target C++ files, which currently include auth_name and document_source_merge_spec as per user_management_commands_parser.idl and document_source_merge.idl, respectively.
In particular, mergeTargetNssParseFromBSON creates an IDLParserContext that will need to be populated with the SerializationContext, while the auth_name changes are only necessary to normalize the function signature.



 Comments   
Comment by Githook User [ 16/Mar/23 ]

Author:

{'name': 'Hugh Tong', 'email': 'hugh.tong@mongodb.com', 'username': 'cortrain'}

Message: SERVER-74029 Add SerializerFlags context to custom IDL serializers
Branch: master
https://github.com/mongodb/mongo/commit/1b6555c15c6016bd029e47238bf6724352b2afdd

Generated at Thu Feb 08 06:26:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.