You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The polymorphism in C# with Newtonsoft.Json is unable to deserialize child classes due to the JsonConverter annotation present in the child class.
#17990
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.
"Adding [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] to the child C# class compels Newtonsoft to not look at the subtypes within the child class. To do it properly, one should move the line [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] in {{#mappedModels.length}}.
like this ?
{{#mappedModels.length}}
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
{{/mappedModels.length}}
Uh oh!
There was an error while loading. Please reload this page.
"Adding [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] to the child C# class compels Newtonsoft to not look at the subtypes within the child class. To do it properly, one should move the line [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")] in {{#mappedModels.length}}.
like this ?
{{#mappedModels.length}}
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
{{/mappedModels.length}}
https://github.com/OpenAPITools/openapi-generator/blame/275ed9296dea4a1a894cc5b3402b5b8f3a61e7d7/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache#L13
The text was updated successfully, but these errors were encountered: