Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][Client] Add CLI option to select OpenAPI annotation library #8801

Closed

Conversation

djnalluri
Copy link
Contributor

@djnalluri djnalluri commented Feb 23, 2021

A new CLI option named "oaiAnnotationLib" can be used to select the OpenAPI annotation library used to annotate models. The current options are "none" and "swagger2". Placeholder sections have been left in the code and templates for future addition of a Microprofile option. These changes are a subset from #8716.

Fixes #8719.

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 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Technical Committee:
@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @nmuesch (2021/01)

@djnalluri
Copy link
Contributor Author

CI failure is from hitting Docker Hub pull limits.

@djnalluri djnalluri closed this Mar 1, 2021
@djnalluri djnalluri reopened this Mar 1, 2021
@hinrik
Copy link
Contributor

hinrik commented Mar 24, 2021

Would be great to see this included, and for other Java-based clients as well. Two previous attemps seem to have been abandoned (#7612, #5058).

@GreenRover
Copy link

Hi what is the status? Get rid o the swagger annotations would be grate.

@djnalluri
Copy link
Contributor Author

@wing328 Would you be able to take a look at this?

@wing328
Copy link
Member

wing328 commented Jun 16, 2021

@djnalluri thanks for the PR and sorry for the delay in reviewing the change.

Do we need to update the following pojo.mustache files as well?

modules/openapi-generator/src/main/resources/Java//libraries/native/pojo.mustache
modules/openapi-generator/src/main/resources/Java//libraries/jersey2/pojo.mustache
modules/openapi-generator/src/main/resources/Java//libraries/microprofile/pojo.mustache 

@djnalluri
Copy link
Contributor Author

I just updated the pojo.mustache templates in the libraries except for the one for Microprofile. It's heavily customized and already removes Swagger annotations.

@wing328 wing328 modified the milestones: 5.2.0, 5.2.1 Jul 13, 2021
@wing328 wing328 modified the milestones: 5.2.1, 5.3.0 Aug 17, 2021
# Conflicts:
#	modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache
#	modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache
#	modules/openapi-generator/src/main/resources/Java/pojo.mustache
# Conflicts:
#	modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java
@djnalluri
Copy link
Contributor Author

@wing328 Would you be able to take another look at this?

@mar1ged
Copy link

mar1ged commented Oct 2, 2021

I can see that this "issue" drives a lot of people and that there are multiple issues that try to provide some means of removing the annotations. (4270, 5058, 7612)

Can this PR be accepted ? I guess it will make a lot of people happy.

@baurceanu
Copy link
Contributor

This PR doesn't disable all usages of swagger-annotations in 'java' generator templates, opened a more complete one

@djnalluri
Copy link
Contributor Author

djnalluri commented Oct 20, 2021

That PR(#10581) doesn't provide room for alternate libraries but does get the job done. I glanced over the PR and it removes swagger annotations being added as dependencies in the supporting files(POM's, etc.). Supporting files aren't covered at all in this PR. If the other PR is easier to get approved, I'm all for it. Considering the upcoming breaking 6.0 release for December, I can patch this PR to take those changes into account and re-add support for alternate libraries.

@baurceanu
Copy link
Contributor

hi @djnalluri
Just for clarifying my technical decisions:
I designed a new option according to existing options in other generators (jaxrs-spec, kotlin-spring) and a discussion in similar opened PR for providing overall generators API consistency.

I hope that the atomicity, completeness and simplicity of changes could make the review process easier (but of course we also can cherrypick my commits to your PR). @wing328 hi, could you tell us what way is preferable for speeding up review process?

@wing328 wing328 modified the milestones: 5.3.0, 5.3.1 Oct 25, 2021
@cachescrubber
Copy link
Contributor

Implemented in #12422.

@wing328 wing328 modified the milestones: 6.0.0, 6.1.0, 6.0.1 May 26, 2022
@wing328 wing328 modified the milestones: 6.0.1, 6.1.0 Jul 5, 2022
@wing328 wing328 modified the milestones: 6.1.0, 6.1.1 Sep 11, 2022
@wing328 wing328 modified the milestones: 6.1.1, 6.2.1 Sep 24, 2022
@wing328 wing328 modified the milestones: 6.2.1, 6.3.0 Nov 1, 2022
@wing328 wing328 modified the milestones: 6.3.0, 6.3.1 Jan 20, 2023
@wing328 wing328 modified the milestones: 6.4.0, 6.5.0 Feb 19, 2023
@wing328 wing328 modified the milestones: 6.5.0, 6.6.0 Apr 1, 2023
@wing328 wing328 modified the milestones: 6.6.0, 7.0.0 May 11, 2023
@djnalluri
Copy link
Contributor Author

Closing as an alternative annotation name has been implemented in #13869.

@djnalluri djnalluri closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it possible to disable generation of swagger annotations
7 participants