-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of ProblemDetails is inconsistent throughout ASP.NET Core #32957
Comments
Just discovered #4953, which this issue is related to, but this issue has some other information as well around this. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Thanks for contacting us. We're moving this issue to the |
To add to this list, which has been discovered via API Versioning, the following do not always provide or enable any hooks for
This happens any time a built-in It's a bit of an aside, but I suspect part of this behavior is due to the fact that I had to provide my own interface for API Versioning in .NET 6 to bridge this gap. I'm sure others would benefit from being able to generate |
Related issue #4953 |
Describe the bug
The usage of the
ProblemDetails
is inconsistent throughout the library. There is no green line when it is actually used and not when using standard ASP.NET Core logic. In addition the flagSuppressMapClientErrors
is equally inconsistent in its usage as well.The documentation states:
It also states that:
In my experiments (I must admit I haven't tried ALL scenarios) I found:
NotFound
andUnauthorized
appliesProblemDetails
dynamically based onSuppressMapClientErrors
setting.ValidationProblem
andProblem
will always applyProblemDetails
no matter of theSuppressMapClientErrors
setting.BadRequest
andUnprocessableEntity
appliesProblemDetails
dynamically based onSuppressMapClientErrors
settingModelState
to these they always plainModelState
result.ProblemDetails
information both in Development and Production mode.Expected results
Basically:
BadRequest
andUnprocessableEntity
should always handle result the same way no matter input. That is, honor theSuppressMapClientErrors
setting and returnProblemDetails
based on that.SuppressMapClientErrors
as well.Problem
should in my opinion applyProblemDetails
based onSuppressMapClientErrors
since this is the easiest call to return status codes that other methods doesn't cover.I also find it a bit strange that there is a
ValidationProblem
as bothBadRequest
andUnprocessableEntity
covers this (if they had been working). Is it REALLY necessary ifBadRequest
andUnprocessableEntity
had consistent handling?To Reproduce
Further technical details
ASP.NET Core version 5.0
dotnet --info
Visual Studio
The text was updated successfully, but these errors were encountered: