Remove JsonPropertyNameAttribute from all properties of ProblemDetails
See original GitHub issueBackground and Motivation
At the moment, all properties ProblemDetails have attribute JsonPropertyNameAttribute with camelCase-style.
But not everyone uses style camelCase-style in their projects, e.g. like this:
_ = services
.AddControllers()
.AddJsonOptions
(
jsonOptions =>
{
jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null;
}
);
For casing-style consistency with the rest of the project, it might make sense to remove the JsonPropertyNameAttribute from all properties of ProblemDetails.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to ignore JsonPropertyName in serialization using ...
Text.Json in .NET 6 and I have some data classes that have properties annotated with JsonPropertyName to be able to communicate with another...
Read more >Custom converters for serialization removed - .NET
Learn about the breaking change in ASP.NET Core 8.0 where 'ValidationProblemDetails' and 'ProblemDetails' no longer use custom converters.
Read more >How to Exclude Properties From JSON Serialization in C#
In this article, we will learn how to exclude properties from JSON Serialization in C# with a few examples.
Read more >Problem Details for Better REST HTTP API Errors
Do you wish there was a standard way to return errors from a REST HTTP API? There is, it's called Problem Details. Here's...
Read more >Add error code to ValidationProblemDetails
A while back in one project I faced a situation that required returning custom error code from API to the client. In the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@anreton you can also create a new JsonConverter only for ProblemDetails
The RFC contains the literal spelling of the individual properties, they even quote each occurrence.
I don’t think your goal of configuration is bad, just your suggested method, as it will break conformance with the RFC.