OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] useTags property of JAXRS-SPEC does not handle operations with multiple tags
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
The useTags additionalProperty of the jaxrs-spec generator ignores operations with multiple tags due to code here.
This means that an Api class is only generated for the first tag in the list rather than every tag.
openapi-generator version
7.5.0 -- it is not a regression.
OpenAPI declaration file content or url
Example spec here. The endpoint has two tags petV1 and petV2. I would expect PetV1Api and PetV2Api to be generated but only PetV2Api is generated due to the bug.
Generation Details
Generated with openapi-generator generate -g jaxrs-spec -i openapi.yaml --additional-properties=useTags=true
Steps to reproduce
- Download example gist as openapi.yaml
- Run the following openapi-generator command:
openapi-generator generate -g jaxrs-spec -i openapi.yaml --additional-properties=useTags=true
Suggest a fix
The issue is that additional tags are ignored due to the line here. Adding every tag on the operation would allow multiple API files to be generated.
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 in modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java at the referenced useTags handling. Reproduce with the linked OpenAPI gist and the jaxrs-spec generation command using useTags=true. Done means an operation with tags petV1 and petV2 generates both PetV1Api and PetV2Api.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100