swagger-api / swagger-api/swagger-codegen
[typescript-angular] not generating enums as enum type
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I have an enum in my swagger scheme, but after generating the typescript-angular client with swagger codegen, the generated 'enum' looks like below:

The generator should use the typescript enum type instead of creating a custom object.
Swagger-codegen version
2.4.17
Swagger declaration file content or url
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i http://localhost:54371/swagger/v1/swagger.json -l typescript-angular -o .
Steps to reproduce
Generate angular-typescript client with the swagger declaration file
Related issues/PRs
/
Suggest a fix/enhancement
/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied swagger-codegen CLI command with the linked Swagger declaration and the typescript-angular generator. Inspect the generated client model containing the enum and trace the generator templates or entry points responsible for its representation. Done means the generated output uses a TypeScript enum type and remains reproducible from the provided declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100