ASP.NET Core 2.2 introduced API web analyzers to Visual Studio. These analyzers are used to enforce REST conventions. Simply put, we state that an assembly or class should follow some convention; Visual Studio then checks whether its methods declare—for the purpose of OpenAPI (Swagger)—the proper response types and status codes and offers to fix this by adding the correct attributes if needed. This is purely a design-time feature, not something that you code, for a change.
The Microsoft.AspNetCore.Mvc.Api.AnalyzersNuGet package includes some standard conventions for REST APIs in the form of the DefaultApiConventions class. If we want to ensure that all types in the current assembly follow these conventions, we apply the following attribute at the assembly level:
[assembly: ApiConventionType(typeof(DefaultApiConventions))]
If we only want to do this at a class level, we take out the assembly modifier and instead...