Skip to content

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

Merged
merged 8 commits into from
Aug 25, 2023

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Jul 20, 2023

and deserializing with referenced schemas.

@emasab emasab marked this pull request as ready for review July 21, 2023 06:32
@emasab emasab marked this pull request as draft July 21, 2023 06:32
Comment on lines +149 to +158
var jsonSchemaGeneratorSettings = new JsonSchemaGeneratorSettings
{
SerializerSettings = new JsonSerializerSettings
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
}
}
};
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@cla-assistant
Copy link

cla-assistant bot commented Aug 7, 2023

CLA assistant check
All committers have signed the CLA.

@anchitj anchitj marked this pull request as ready for review August 9, 2023 10:20
@anchitj anchitj merged commit b01fc49 into dev_json_references Aug 25, 2023
@anchitj anchitj deleted the dev_json_references_mapped branch August 25, 2023 03:27
anchitj added a commit that referenced this pull request Aug 25, 2023
* 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]>
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.

2 participants