Skip to content

Conversation

shybovycha
Copy link
Contributor

@shybovycha shybovycha commented Sep 30, 2025

Addresses #22045 similarly to #21992

Only register the model annotation imports based on the annotationLibrary property (either from Swagger v1, Swagger v2 or none), as documented in Config Options section of the Java generator docs.

Currently, Spring generator partially ignores the option, only removing the imports from Swagger V1, completely ignoring the Schema from by Swagger V2.

This PR addresses the annotationLibrary = none case by removing the Swagger V2 import.

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 WSL)
    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 solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@shybovycha shybovycha changed the title [java] [Spring] annotationLibrary option being ignored in spring generator [java] [spring] Fix annotationLibrary option being ignored in spring generator Sep 30, 2025
@shybovycha shybovycha force-pushed the java-spring-fix-annotation-library-being-ignored branch from 9298110 to b2fe2ce Compare September 30, 2025 06:24
@shybovycha shybovycha force-pushed the java-spring-fix-annotation-library-being-ignored branch 3 times, most recently from d6aa280 to 73e3a94 Compare September 30, 2025 07:21
@shybovycha shybovycha marked this pull request as draft September 30, 2025 07:41
@shybovycha shybovycha force-pushed the java-spring-fix-annotation-library-being-ignored branch 2 times, most recently from 78c154b to 216d5b0 Compare September 30, 2025 07:50
@shybovycha shybovycha marked this pull request as ready for review September 30, 2025 11:30
@shybovycha
Copy link
Contributor Author

@shybovycha
Copy link
Contributor Author

just not entirely sure why okhttp-gson-3.1-duplicated-operationid sample was created with my change 🤔

@wing328
Copy link
Member

wing328 commented Oct 5, 2025

please resolve the merge conflicts when you've time

@wing328
Copy link
Member

wing328 commented Oct 5, 2025

just not entirely sure why okhttp-gson-3.1-duplicated-operationid sample was created with my change 🤔

no idea either. i'll take care of it. don't worry

@shybovycha shybovycha force-pushed the java-spring-fix-annotation-library-being-ignored branch from 216d5b0 to 65e26ad Compare October 6, 2025 22:09
@shybovycha
Copy link
Contributor Author

shybovycha commented Oct 6, 2025

i have just rebased on top of master and run the ./bin/generate-samples.sh and somehow the rust samples were modified (locally, but not on CI). i wonder: could it be that the sample generator should have been ran on master (but it did not) or maybe there's some issue with the generator file patterns or something so it triggers when it shouldn't and it does not trigger when it should? 🤔

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.

2 participants