이 콘텐츠는 선택한 언어로 제공되지 않습니다.
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"Entering the command adds the following dependency to your
pom.xml:pom.xml
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-openapi</artifactId> </dependency>Enter the following command to obtain the schema document from the
/q/openapi:curl http://localhost:8080/q/openapiYou receive a response with the generated OpenAPI schema document in YAML format:
--- openapi: 3.0.3 info: title: Generated API version: "1.0" paths: /greeting: get: responses: "200": description: OK content: text/plain: schema: type: string /greeting/{name}: get: parameters: - name: name in: path required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Greeting' components: schemas: Greeting: type: object properties: message: type: string