RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Serialization casing not honored for new System.Text.Json in .net core 3.1 #2652

Open groogiam opened 4 years ago

groogiam commented 4 years ago

Control over the serialization casing looks like it is broken when using the new System.Text.Json in .NET core 3.1

https://github.com/RicoSuter/NSwag/issues/2216 says casing is controlled by the AddJsonOptions which prior to ASP.NET Core 3.1 the JSON.NET implementation.

When using the following (which utilizes System.Text.Json) the casing changes back to the default.

.AddJsonOptions(o =>
                {
                    //preserve poco casing
                    o.JsonSerializerOptions.PropertyNamingPolicy = null;
                })

The expected result is that the casing of the .NET classes be maintained when this setting is used.

RicoSuter commented 4 years ago

Not possible st the moment, you need to describe the serializer with the neetondoft json settings

https://github.com/RicoSuter/NJsonSchema/issues/1014