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

Enabling serialization customization through CosmosSerializerOptions #650

Merged
merged 29 commits into from
Aug 10, 2019

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Aug 7, 2019

Pull Request Template

Description

The Azure core SDK teams has guidelines to remove the SDK dependency from Newtonsoft and instead use the System.Text.Json serialize that is now being included in dot net core. To reduce the friction of eventually moving to the new serializer exposing any additional types from Newtonsoft goes against Azure core SDK team.

Exposing the JsonSerializerSettings in CosmosJsonDotNetSerializer was missed in the review process, and is being considered a bug. For user convenience a new constructor is added that allows setting indentation, null handling, and camel casing.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
    public class CosmosClientOptions
    {
        public CosmosSerializationOptions? SerializerOptions { get; set; }        
    }

    public struct CosmosSerializationOptions
    {
        public bool IgnoreNullValues { get; set; }

        public bool Indented { get; set; }

        public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; }
    }

    public enum CosmosPropertyNamingPolicy
    {
        Default = 0,
        CamelCase = 1,
    }

…popular flags to make it easier for users that only require basic flags. Refactored all serializer classes into a single folder.
@j82w j82w added bug Something isn't working breaking non-additive functional behavior changes labels Aug 7, 2019
@j82w j82w requested a review from kirillg as a code owner August 7, 2019 12:59
@j82w j82w self-assigned this Aug 7, 2019
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.

Please check comments

Jake Willey added 2 commits August 7, 2019 09:41
@j82w j82w changed the title Converting CosmosJsonDotNetSerializer to use flags instead of JsonSerializerSettings to reduce dependency on Newtonsoft Converting CosmosJsonDotNetSerializer to CosmosSerializerOptions to reduce dependency on Newtonsoft Aug 7, 2019
kirankumarkolli
kirankumarkolli previously approved these changes Aug 7, 2019
changelog.md Outdated Show resolved Hide resolved
@kirankumarkolli kirankumarkolli changed the title Converting CosmosJsonDotNetSerializer to CosmosSerializerOptions to reduce dependency on Newtonsoft Enabling serialization customization through CosmosSerializerOptions Aug 7, 2019
ausfeldt
ausfeldt previously approved these changes Aug 8, 2019
@kirankumarkolli kirankumarkolli merged commit 0843cae into master Aug 10, 2019
@kirankumarkolli kirankumarkolli deleted the users/jawilley/serialization_options branch August 10, 2019 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking non-additive functional behavior changes bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants