devonfw / devon4j

devonfw Java stack - create enterprise-grade business apps in Java safe and fast
Apache License 2.0
82 stars 88 forks source link

Add documentation for the generation of OpenAPI and Swagger UI from REST services #483

Closed GuentherJulian closed 2 years ago

GuentherJulian commented 2 years ago

As a developer, I want to know how to generate OpenAPI definitions and how to get Swagger UI from my REST services.

There a multiple ways to create OpenAPI/Swagger UI from REST interfaces. Quarkus supports OpenAPI/Swagger support out of the box using the quarkus-smallrye-openapi extension (see here). The extension analysis Java classes, method signature, etc. to create the OpenAPI definition. More information can be added by adding annotations (e.g. to properly document response codes). For Spring applications, springdoc-openapi-ui can be used. Also the servicedocgen maven plugin is now able to generate OpenAPI files and Swagger UI with version 1.0.0. Unlike the other plugins, the servicedocgen plugin includes Javadoc in the analysis to create the schema and it generates static files as output.

The documentation should describe which solution has which advantages, how to integrate it into a project and how to access the OpenAPI files/Swagger UI. More discussion on this topic can be found here.