Skip to content

Does not seem to add ProductResponseType(typeof(...), StatusCodes200OK) #15269

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

Closed
jawn opened this issue Oct 23, 2019 — with docs.microsoft.com · 4 comments
Closed
Labels
doc-enhancement needs-more-info Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

Copy link
Contributor

jawn commented Oct 23, 2019

Is this supposed to add suggestions for Status code 2xx with their return types?

It does not seem to add ProductResponseType(typeof(...), StatusCodes200OK))

E.g. when I modify the example to the version below, I would expect a suggestion to add the commented line again.

// GET api/contacts/{guid}
[HttpGet("{id}", Name = "GetById")]
// [ProducesResponseType(typeof(Contact), StatusCodes.Status200OK)] --> commented this line
public IActionResult Get(string id)
{
    var contact = _contacts.Get(id);

    if (contact == null)
    {
        return NotFound();
    }

    return Ok(contact);
}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added ⌚ Not Triaged Source - Docs.ms Docs Customer feedback via GitHub Issue labels Oct 23, 2019
@Rick-Anderson
Copy link
Contributor

@jawn are you saying the MVC analyzers package should flag that?

@Rick-Anderson
Copy link
Contributor

image

@jawn
Copy link
Contributor Author

jawn commented Oct 24, 2019

@jawn are you saying the MVC analyzers package should flag that?

Yes.

Motivation:

  • The existing functionality is good to start.
  • However, flagging the happy flow 200 return type is what is really completes the picture. This type will typically differ between web apis.

@Rick-Anderson
Copy link
Contributor

@jawn that's not a doc bug, that's a product bug. See https://github.com/aspnet/AspNetCore/blob/master/CONTRIBUTING.md to open a product bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement needs-more-info Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

3 participants