Problem Details camel case RFC 7807 "compliant casing" #59396
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
help wanted
Up for grabs. We would accept a PR to help resolve this issue
Is there an existing issue for this?
Describe the bug
Hi,
Following the discussion in this issue, it seems that starting with .NET 9, Problem Details are now always serialized using camelCase, reportedly, due to RFC 7807 compliance.
However, after reviewing the RFC, I couldn’t find any section that explicitly mandates the use of camelCase. Instead, the RFC states:
I’ve also noticed that the
traceId
field was recently introduced in the Problem Details object in .NET9, which now results, e.g., in the following JSON:In my opinion, the response body should respect the
SerializerOptions.PropertyNamingPolicy
(e.g., camelCase or snake_case), with the only exception being kebab-case, which is not compliant with the RFC due to its use of hyphens.For example, when using
SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
, the response body should produce the following result:Could you please clarify why this change is being enforced?
Thanks!
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100
Anything else?
No response
The text was updated successfully, but these errors were encountered: