Skip to content

[Feature][Angular]: Represent enum request parameters as enum literal unions #7365

@macjohnny

Description

@macjohnny
Description

It would be nice to have the generated client code contain enums for request parameters that are enum values:

so instead of

public findPetsByStatus(status: Array<string>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;

you would have

public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;

which would give a hint to the api user which values are allowed and furthermore allows the compiler to check whether you are calling the api with an invalid parameter.

Swagger-codegen version

2.3.0

Swagger declaration file content or url

swagger petstore example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions