Skip to content

Deduplicate scope names in openapi spec generation #7685

@EraYaN

Description

@EraYaN

Clear and concise description of the problem

When you have multiple flows in an OAuth2Auth object with scopes this results in duplicate scopes in the generated openapi.yaml

Like so

security:
  - oauth:
    - api:read
    - api:read

with the tsp as follows:

model oauth<Scopes extends string[]>
  is OAuth2Auth<
    [
      {
        type: OAuth2FlowType.authorizationCode;
        authorizationUrl: "https://example.org/oauth2/v2.0/authorize";
        tokenUrl: "https://example.org/oauth2/v2.0/token";
        refreshUrl: "https://example.org/oauth2/v2.0/token";
      },
      {
        type: OAuth2FlowType.clientCredentials;
        tokenUrl: "https://example.org/oauth2/v2.0/token";
      }
    ],
    Scopes
  >;

model Get200Response {
  @statusCode statusCode: 200;
  @bodyRoot body: int64;
}

@route("/example")
@get
@useAuth(oauth<["api:read"]>)
op Get(): Get200Response

I'd like it if they were de-duplicated since this also results in them showing up twice or even more times in the generated documentation.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions