Skip to content
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

Create and include an analyzer that validates action method return types match the declared ActionResult<T> #8535

Open
DamianEdwards opened this Issue Mar 14, 2019 · 0 comments

Comments

Projects
None yet
3 participants
@DamianEdwards
Copy link
Member

DamianEdwards commented Mar 14, 2019

Add an analyzer that validates the return types from an action method returning ActionResult<T>, e.g. don't let it return ObjectResult with a different T value, e.g. the following is invalid:

[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
    return new ObjectResult(new { Not = "Valid" });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.