Skip to content

As an HTTP API developer using Open API to enable integration, my APIs include an opinionated convention of ensuring operationId attributes are created for each Web API controller method #27591

Closed
@bradygaster

Description

@bradygaster

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.affected-mostThis issue impacts most of the customersenhancementThis issue represents an ask for new feature or an enhancement to an existing oneold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelsseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions