Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public properties : Fixes public types to be upgrade safe so new content is not lost on deserialize and serialize paths. #2712

Merged
merged 13 commits into from
Sep 15, 2021

Conversation

sourabh1007
Copy link
Contributor

@sourabh1007 sourabh1007 commented Sep 8, 2021

Description

The current public types like ContainerProperties lose any new fields added by the service currently. If the property is not a know field is lost on the deserialize/serialize logic. This can possibly break older SDKs if new contract elements are added by the service and an update is attempted. The service might throw an exception thinking the user attempted to remove the new field when it was lost in the serialization logic.

To fix this issue a new internal dictionary is added to all the public service contract types to hold any additional properties the c# poco type is not aware of. So that in case of service contract evolution if metadata information changes, we won't loose any information.

Type of change

  • [] Bug fix (non-breaking change which fixes an issue)

Closing issues

To automatically close an issue: closes #2678

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors|Removes) Description"

Internal should be used for PRs that have no customer impact. This flag is used to help generate the changelog to know which PRs should be included. Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.

@sourabh1007 sourabh1007 changed the title Metadata contracts should pass through missing non-POCO context Metadata : Adds ability to pass additional contract Sep 8, 2021
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/metadatacontract branch 2 times, most recently from d0114c9 to c8beda1 Compare September 9, 2021 16:13
j82w
j82w previously approved these changes Sep 10, 2021
ealsur
ealsur previously approved these changes Sep 13, 2021
Microsoft.Azure.Cosmos/src/Util/DictionaryExtension.cs Outdated Show resolved Hide resolved
Copy link
Member

@kirankumarkolli kirankumarkolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/metadatacontract branch from 7f6c55d to c74307d Compare September 15, 2021 12:41
@j82w j82w changed the title Metadata : Adds ability to pass additional contract Public properties : Fixes public types to be upgrade safe so new content is not lost on deserialize and serialize paths. Sep 15, 2021
@j82w j82w merged commit 3c6d747 into master Sep 15, 2021
@j82w j82w deleted the users/sourabhjain/metadatacontract branch September 15, 2021 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadata contracts should pass through missing non-POCO context
4 participants