-
Notifications
You must be signed in to change notification settings - Fork 10.3k
API analyzers should support undeclared 200 status codes #15385
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
Comments
The 200 Status code is implicit for every action that does not specify any |
Strictly speaking, this means no warning needs to be generated by the analyzers. Would it still be possible to provide an optional quick fix to add the strongly typed ProducesResponseType for the Status Code 200? |
I think at some point our plan was to provide a code fix to use |
Thanks for contacting us. We're moving this issue to the |
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 |
This produces weird behavior. Initially it warns you if you haven't documented another response code like 404. Upon fixing that warning, only then does it warn you that you haven't documented 200. And if you begin to rely on this warning, it will bite you when you have an action that only returns 200. To maximize trust in and benefit from the analyzer, it should always warn if you don't document 200. |
Thanks for contacting us. We're moving this issue to the |
Describe the bug
API analyzers should flag an undeclared 200 status code, and provide an option to fix it.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
[ProducesResponseType(typeof(Contact),
StatusCodes.Status200OK)]Why I think this is a bug
From the docs:
Additional context
Follow up to dotnet/AspNetCore.Docs#15269 (comment)
.NET Core SDK: 3.0.100
.NET Core runtimes installed:
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
The text was updated successfully, but these errors were encountered: