Forum Discussion
Hey anirtek; have you looked into using swagger-core? It's a Java implementation of the OpenAPI Specification. The documentation in the link should help you get started with your new project.
- anirtek4 years agoOccasional Contributor
joejoyce this is a great suggestion. Infact I am looking for solution in Jakarta namespace only. I will try to use this. But would this automatically generate the OpenAPI yaml after code annotation? Or I will have to use some tool to get the yaml first? I am trying to generate yaml from code annotations. Can you provide something about this confusion?
- joejoyce4 years agoStaff
anirtek yes indeed; using the swagger-core method, the Swagger/OAS contract is generated from an API based on the meta-data added against the various resources, methods and controllers. This meta-data will generate the contract, client-side code, and other artifacts during runtime. Typically, this meta-data will be in the form of code annotations.
You'll find some more useful documentation on this here.
Hope this helps!
- anirtek4 years agoOccasional Contributor
joejoyce I think swagger core project is what I am looking for. But I need some more help about this.
In the Where to start section, it says -
since version 2.0.5, swagger-core project also provides maven and gradle plugins to resolve an OpenAPI definition at build time. As these are based on the same resolving and configuration mechanisms, most information in the wiki applies also in this case.
I have added the swagger-core Gradle plugin in the id section and other dependencies in the Jakarta namespace in dependencies.
Now if my code is annotated, should I see the swagger-ui directly when I run my project or I need to configure swagger-ui in my main method?
- anirtek4 years agoOccasional Contributor
joejoyce hugomario I am trying to user swagger-core-gradle-plugin. But I am confused about 1 thing - whether I need to specify jakarta artifact. I have set my gradle plugin as follows:
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.9"
But since I am using Jetty 11 which works with jakarta namespace only, do I need to set buildClasspath = classpath so that my gradle dependencies will refer to jakarta based builds? If I use the plugin with suffix `jakarta`, that does not seem to have fetching the packages. Can someone please help?
- anirtek4 years agoOccasional Contributor
How do I configure swagger-core into jersey3.0.2?
Related Content
- 4 years ago
- 10 years ago
Recent Discussions
- 7 days ago
- 7 days ago
- 24 days ago