Description
One of the more important concepts in the OpenAPI Specification is the concept of operationId
. Each API method’s descriptive metadata can be augmented with operationId
to provide code generations and consumers with a cleaner API for consumers to use.
When we speak of a consumer, we’re speaking of a variety of code-generation and endpoint-parsing tools that make use of the OpenAPI spec to generate code or UI. AutoRest, swagger-codegen, NSwag, and SwaggerHub - all products used throughout the API community to either generate client SDK code to call an API or to provide documentation about an API – they all prioritize operationId, as do our partners in the Power Platform, when using Open API files or API Management-hosted APIs to provide citizen developers easy ways of dialing APIs into their Power Apps.
Our Controller templates don't explicitly name each method. As such, code generators and consumers need to "guess" what to name the generated code methods. This results in odd situations where client SDKs have methods like get
, get1
, get2
, and so on.
Existing controller method syntax:
[HttpGet]
public IEnumerable<WeatherForecast> Get()
Desired syntax:
[HttpGet(Name = nameof(Get))]
public IEnumerable<WeatherForecast> Get()