Skip to content

Proposal: use NamingStrategy from Newtonsoft.Json #718

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

Closed
bart-degreed opened this issue Apr 8, 2020 · 1 comment · Fixed by #720
Closed

Proposal: use NamingStrategy from Newtonsoft.Json #718

bart-degreed opened this issue Apr 8, 2020 · 1 comment · Fixed by #720

Comments

@bart-degreed
Copy link
Contributor

Today we have our own IResourceNameFormatter to apply casing conventions for resource names, attributes and query string parameters. And we have custom implementations for camel case and kebab case.

Instead of having our own, I'd like to reuse the ones that ship with the Newtonsoft.Json library (currently kebab case, camel case and snake case). This would enable the next setup using options:

options.SerializerSettings = new JsonSerializerSettings
{
    ContractResolver = new DefaultContractResolver
    {
        NamingStrategy = new KebabCaseNamingStrategy()
    }
};

Today we already heavily depend on the Newtonsoft.Json library, which I don't expect to change anytime soon as System.Text.Json is relatively young and lacks support for many features.

So I think now is not the time to abstract away from Newtonsoft.Json, which you'll need anyway if you want to configure things like enum string conversion, culture settings, tracing, timezone handling, dealing with circular references etc. Once System.Text.Json reaches feature parity, we'll have a better understanding how to support multiple serialization libraries and the right way to abstract settings.

@ahmadalli
Copy link

I think this fixes #555 (which has been already closed though) too. Am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants