dotnet / dotnet/aspnetcore

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

Open
#8,535 10 comments 12 reactions 0 assignees View on GitHub
affected-medium analyzer area-mvc enhancement feature-openapi severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

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

``` csharp
[HttpGet]
public ActionResult> Get()
{
return new ObjectResult(new { Not = "Valid" });
}
```

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.