Closed svdHero closed 3 years ago
@svdHero thanks for contacting us.
@pranavkm do you have any thoughts on what's going on here?
Thanks for contacting us.
ProblemDetails
follow the RFC 7807 spec which calls out for these to be in lower case. That's why we ignore your choice of NamingStrategy
options.
@Rick-Anderson can we get my last response above added to the documentation for ProblemDetails please?
@mkArtakMSFT Thanks for clarifying.
Although, I personally think that for an API-consumer it probably would be more convenient if ALL reponses from a given API have the same case. Also, it makes an API look odd when it returns mixed case.
@svdHero the problem is that if we did that, we would not be following the spec and standard clients could fail to interop with the API because of the casing.
@Rick-Anderson can we get my last response above added to the documentation for ProblemDetails please?
Describe the bug
I want my API to return PascalCase JSON. I can achieve that either through
or, using Newtonsoft, through
No matter which way I go, ASP.NET seems to ignore this when it comes to the default error response, e.g. for model validation errors. There I always get CamelCase such as:
To Reproduce
GET
this resource:https://localhost:5001/WeatherForecast/temperature
which returns PascalCase.GET
this resource:https://localhost:5001/WeatherForecast/error
which returns CamelCase.Further technical details
I am using Visual Studio 2019 on Windows.