Skip to content

Conversation

@peace317
Copy link

When generating Java 17 / jakarta compatible Code with the jaxrs-cxf-client generator the swagger2 annotations are a not compatible, because they contain javax imports. I added an optional flag to generate those oas3 Annotations. To maintain the mustache api files better, i created a new one and switch to it, when the flag is set.

fix #19907

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@peace317 peace317 changed the title Jaxrs cxf client support swagger v3 [Feat][Java] jaxrs-cxf-client support swagger v3 Apr 17, 2025
@wing328
Copy link
Member

wing328 commented Sep 1, 2025

i did a test with

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g jaxrs-cxf-client -i  https://raw.githubusercontent.com/OpenAPITools/openapi-generator/13a8a0a68eb1d3919648cee2930778f27c6887bc/modules/openapi-generator/src/test/resources/3_1/java/issue_19907.yaml -o /tmp/jaxrs2/ --additional-properties useJakartaEe=true,oas3=true

but the output won't compile, e.g.

[ERROR]   symbol:   class Schema
[ERROR]   location: class org.openapitools.model.Pet
[ERROR] /C:/Users/wing3/AppData/Local/Temp/jaxrs2/src/gen/java/org/openapitools/model/Pet.java:[49,4] cannot find symbol
[ERROR]   symbol:   class Schema
[ERROR]   location: class org.openapitools.model.Pet
[ERROR] /C:/Users/wing3/AppData/Local/Temp/jaxrs2/src/gen/java/org/openapitools/model/Tag.java:[16,4] cannot find symbol
[ERROR]   symbol:   class Schema
[ERROR]   location: class org.openapitools.model.Tag
[ERROR] /C:/Users/wing3/AppData/Local/Temp/jaxrs2/src/gen/java/org/openapitools/model/Tag.java:[19,4] cannot find symbol
[ERROR]   symbol:   class Schema
[ERROR]   location: class org.openapitools.model.Tag
[ERROR] -> [Help 1]

did you see similar issue locally when trying to compile the output?

@peace317
Copy link
Author

This PR was implemented and merged with #22010. Fixed version is 7.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Question][jaxrs-cxf-client] trying to generator Swagger 3 code, but still getting Swagger 2

3 participants