Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13439
Closed
Open
Issue created Sep 16, 2022 by Administrator@rootContributor

[REQ] [typescript-axios] Use generated enums in operations

Created by: chaayac

Is your feature request related to a problem? Please describe.

When using API functions generated from this, I want to be able to also use the enum types. The enums are generated for models, but they should also be generated for operations too.

Describe the solution you'd like

Generate and use enum types in operations.

Describe alternatives you've considered

Just hard-coding the enum values when using operations, but that's not great.

Additional context

e.g.

findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, ...

should be

findPetsByStatus: async (status: Array<FindPetsByStatusStatusEnum>, ...
...
export const FindPetsByStatusStatusEnum = {
    Available: 'available',
    Pending: 'pending',
    Sold: 'sold'
} as const;
export type FindPetsByStatusStatusEnum = typeof FindPetsByStatusStatusEnum[keyof typeof FindPetsByStatusStatusEnum];
Assignee
Assign to
Time tracking