swagger-api / swagger-api/swagger-codegen
config "enumPropertyNaming" not working as expected
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Enum are generated without underscore
expected output
export enum ActionLogTypeEnum {
REGIMEN_CHANGE = 'REGIMEN_CHANGE',
INSTRUCTION_CHANGE = 'INSTRUCTION_CHANGE',
INSTANT_CHECKUP_DELETE = 'INSTANT_CHECKUP_DELETE',
INSTANT_CHECKUP_TYPE_CHANGED = 'INSTANT_CHECKUP_TYPE_CHANGED'
}
actual output
export enum ActionLogTypeEnum {
REGIMENCHANGE = 'REGIMEN_CHANGE',
INSTRUCTIONCHANGE = 'INSTRUCTION_CHANGE',
INSTANTCHECKUPDELETE = 'INSTANT_CHECKUP_DELETE',
INSTANTCHECKUPTYPECHANGED = 'INSTANT_CHECKUP_TYPE_CHANGED'
}
Yaml File
Swagger-codegen version
3.0.55
Swagger declaration file content or url
openapi: 3.0.3
info:
title: Test Schema
version: 0.0.1
paths: {}
components:
schemas:
ActionLog:
type: object
properties:
type:
type: string
enum:
- REGIMEN_CHANGE
- INSTRUCTION_CHANGE
- INSTANT_CHECKUP_DELETE
- INSTANT_CHECKUP_TYPE_CHANGED
Command line used for generation
java -jar ./swagger-codegen-cli.jar generate -i ./test/test.schema.yaml -l typescript-axios -o ./test --additional-properties modelPropertyNaming=original enumPropertyNaming=original
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
Reproduce the issue with test/test.schema.yaml using the stated swagger-codegen-cli command and the typescript-axios generator. Then trace how enumPropertyNaming=original is handled for generated enum member names. Done means the output preserves underscores in the generated TypeScript enum members as shown in the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, typescript, yaml
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100