swagger-api / swagger-api/swagger-codegen-generators
Property enumPropertyNaming is missing in swagger v3 generator options
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
In Swagger v2 there is a typescript language option to configure the enum name handling: enumPropertyNaming,
This options does not exist anymore in the v3 version.
My enum name contains an _ in the name which i want also have in the typescript enum name. That why i configure the
enumPropertyNaming=original
In Swagger v3 this _ will now be removed:
Example api json:
"components": {
"schemas": {
"Example": {
"type": "string",
"enum": [
"CONST_NAME"
]
}
}
}
Actual:
export type Example = "CONST_NAME"
export const Example = {
CONSTNAME: 'CONST_NAME' as Example
}
Expected (with enumPropertyNaming=original):
export type Example = "CONST_NAME"
export const Example = {
CONST_NAME: 'CONST_NAME' as Example
}
See commit from v2 which adds this option: https://github.com/swagger-api/swagger-codegen/commit/a4e5eb732ae2d582013bfb75e1043bab54a19f04
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
Inspect the v2 change in commit a4e5eb732ae2d582013bfb75e1043bab54a19f04, then compare how v3 handles TypeScript generator options and enum names. Add support for enumPropertyNaming=original so underscores are retained in generated enum properties, and verify the output matches the issue's expected example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100