OpenAPITools / OpenAPITools/openapi-generator
[BUG] JAXRS-SPEC enum x-enum-varnames and x-enum-descriptions not generating as expected
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 using JAXRS-SPEC, the x-enum-varnames and x-enum-descriptions do not seem to work together.
openapi-generator version
7.10.0
OpenAPI declaration file content or url
type: integer
format: int32
enum:
- 1000
- 900
- 30
- 20
- 10
- 0
x-enum-descriptions:
- 'UNEXPECTED ERROR'
- 'REJECT'
- 'REFER EXCEPTION'
- 'REFER'
- 'REFER OVERRIDE'
- 'NONE'
x-enum-varnames:
- UNEXPECTED_ERROR
- REJECT
- REFER_EXCEPTION
- REFER
- REFER_OVERRIDE
- NONE
Generation Details
Steps to reproduce
Using the above YAML, I would expect the generated enum to look something like
public enum Severity {
UNEXPECTED_ERROR(1000, "UNEXPECTED ERROR"),
REJECT(900, "REJECT"),
REFER_EXCEPTION(30, "REFER EXCEPTION"),
REFER(20, "REFER"),
REFER_OVERRIDE(10, "REFER OVERRIDE"),
NONE(0, "NONE");
...
}
Whereas it is being generated as
public enum Severity {
UNEXPECTED_ERROR(1000),
REJECT(900),
REFER_EXCEPTION(30),
REFER(20),
REFER_OVERRIDE(10),
NONE(0);
...
}
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 by reproducing the JAXRS-SPEC generation with the supplied OpenAPI YAML and compare the generated Severity enum with the expected Java example. Trace the JAXRS-SPEC enum generation entry point and identify where x-enum-varnames are applied without x-enum-descriptions; done means the generated enum includes both values and descriptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100