dotnet/aspnetcore
View on GitHubAnalyzers API1000 and API1001 should trigger on conditional returns
Open
#33,105 opened on May 28, 2021
analyzerarea-mvcfeature-openapigood first issuehelp wanted
Repository metrics
- Stars
- (37,933 stars)
- PR merge metrics
- (Avg merge 16d 9h) (258 merged PRs in 30d)
Description
Describe the solution you'd like
Analyzers API1000 and API1001 should trigger on returns (or expression-bodied methods) with conditional expressions.
Additional context
public ActionResult<object> OopsUndocumentedIf(int id)
{
if (id == 0)
{
return NotFound(); // API1000
}
return Ok(new object());
}
public ActionResult<object> OopsUndocumentedConditional(int id)
{
return id == 0 ? NotFound() : Ok(new object()); // No API1000
}