swagger-api / swagger-api/swagger-codegen
(Java) Option to disable truncating prefixes for enums
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using Swagger to generate Java from a JSON file. I have an enum in my JSON that looks like:
"UploadSchemaType": {
"type": "string",
"enum": [
"ios_data",
"ios_survey"
]
}
This generates an enum with values DATA and SURVEY. This is a problem because we plan on adding non-iOS types to our enum in the near future. Swagger will then generate the enum as IOS_DATA, IOS_SURVEY, NEW_TYPE, which will be a breaking change for our clients.
Can we add an option so that we generate the full enum name instead of truncating the prefixes?
See also:
https://github.com/swagger-api/swagger-codegen/issues/1229
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 tracing how the Java generator converts JSON enum values into Java names, and review the related discussion in issue #1229. The work is complete when an option preserves full enum names such as IOS_DATA and IOS_SURVEY, while the default behavior remains covered by regression tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100