OpenAPITools / OpenAPITools/openapi-generator
[BUG] Description Enum constant name prefix has been stripped
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating the enums client is acutally stripping the enum name.
I have two enum constant TEST_PACKAGE , TEST_RESULT_FILE.
But when openapi generating the yaml into java client it is stripping the TEST_ from name .
YAML FILE
FileType:
type: string
description: File type indicates test file or test run result
enum:
- TEST_PACKAGE
- TEST_RESULT_FILE
generated output is
@JsonAdapter(FileType.Adapter.class)
public enum FileType {
PACKAGE("TEST_PACKAGE"),
RESULT_FILE("TEST_RESULT_FILE");
}
However expected output is
@JsonAdapter(FileType.Adapter.class)
public enum FileType {
TEST_PACKAGE("PACKAGE"),
TEST_RESULT_FILE("RESULT_FILE");
openapi-generator version
6.4.0
OpenAPI declaration file content or url
https://github.com/SUSHIL161/openapi/blob/main/openapi.yaml
Generation Details
Url of xml file
https://github.com/SUSHIL161/openapi/blob/main/openaapi.xml
org.openapitools openapi-generator-maven-plugin 6.4.0 generate ${project.basedir}/../openapi/target/classes/openapi.yaml java rest-assured ${project.build.directory}/generated-sources ${project.groupId}.sdk.api ${project.groupId}.sdk.models ${project.groupId}.sdk false false java8-localdatetime java CLIENT false false
Steps to reproduce
https://github.com/SUSHIL161/openapi/blob/main/openapi.yaml
generate java client from above file and check the model class FileType
Related issues/PRs
Suggest a fix
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 with the linked openapi.yaml and reproduce Java client generation using the Maven plugin configuration shown. Inspect the generated FileType model and the Java generator's enum naming path. Done means the generated constants match the expected TEST_PACKAGE and TEST_RESULT_FILE names, with the relevant regression covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100