Chapter 6. Enabling OpenAPI and Swagger-UI support in your Spring Web example
You can add support for generating OpenAPI schema documents of your REST endpoints with Swagger-UI to your application by adding the quarkus-smallrye-openapi extension.
Procedure
Enter the following command to add the
quarkus-smallrye-openapiextension as a dependency of your Spring Web example. Adding the extension is enough to generate a basic OpenAPI schema document from your REST Endpoints:./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-smallrye-openapi"
./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-smallrye-openapi"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Entering the command adds the following dependency to your
pom.xml:pom.xml
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-openapi</artifactId> </dependency><dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-openapi</artifactId> </dependency>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to obtain the schema document from the
/q/openapi:curl http://localhost:8080/q/openapi
curl http://localhost:8080/q/openapiCopy to Clipboard Copied! Toggle word wrap Toggle overflow You receive a response with the generated OpenAPI schema document in YAML format:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow