dotnet / dotnet/aspnetcore

Problem details title should not be automatically filled with a default value

Open
#62,562 2 comments 0 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

The problem details RFC (9457) states that the "type" member contains a URI reference that identifies the problem type and that the "title" member is a JSON string containing a short, human-readable summary of the problem type. This implies that different problem types should have different titles. Therefore, a problem details response with a different "type" URI should have a different "title" to describe the different problem type.

However, the default behavior of ASP.NET Core is to populate the "title" member with a default value based on the status code if it is given as null by the endpoint - e.g., "Unprocessable Entity" for status code 422. This results in all "type" URIs with the same status code having the same "title".

The "title" member is optional according to RFC 9457, which states the "title" string is advisory and is included only for users who are unaware of and cannot discover the semantics of the type URI (e.g., during offline log analysis). Therefore, one could argue it would be more "correct" for ASP.NET Core to _omit_ the "title" member if a specific "type" URI is provided.

### Describe the solution you'd like

Do not apply a default value to the "title" member of a problem details instance if a the "type" member is non-null.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.