-
Notifications
You must be signed in to change notification settings - Fork 881
Use object mapping when serializing #2088
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
Conversation
and deserializing with referenced schemas.
var jsonSchemaGeneratorSettings = new JsonSchemaGeneratorSettings | ||
{ | ||
SerializerSettings = new JsonSerializerSettings | ||
{ | ||
ContractResolver = new DefaultContractResolver | ||
{ | ||
NamingStrategy = new CamelCaseNamingStrategy() | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the user always supposed to provide this? Won't it make sense that we keep this as default JsonSchemaGeneratorSettings
for both JsonSerializer
and JsonDeserializer
if the user isn't providing any JsonSchemaGeneratorSettings
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not required to provide this, this allows you to set the default strategy and avoid to add attributes like
[JsonProperty("favoriteColor")]
to the fields, but that is also possible. I'd not change JsonSerializer defaults, also it would be a breaking change (see PersonPoco in tests).
I can add a comment about this.
* jsonserialisation with references support * json deserialiser with validation against a passed schema * changes to reference resolver, using AddSchema * integration test added for JSON with references * "commit cleanup (1)" * "commit cleanup(2)" * "removed error: same reference used elsewhere" * "changes to sln file and Version" * commit cleanup (3) * NonGenericJsonSerializer added, along with Convertor in JsonDeserializer * added check for int enum while adding ref schema * added unit test for schema w json ref SerDes * moved schema resolution to separate utils class * changes as per review comments * after review changes * changerlogs updated * Use object mapping when serializing (#2088) * Use object mapping when serializing and deserializing with referenced schemas. * Test producing and consumer JObject * Rename JsonSerDesSchemaUtils to JsonSchemaResolver * Copyright * Documentation * Fix unit tests * Add comment about NJson mapping * Fix CHANGELOG --------- Co-authored-by: Emanuele Sabellico <[email protected]> Co-authored-by: Anchit Jain <[email protected]>
and deserializing with referenced schemas.