Ad Code

Ticker

6/recent/ticker-posts

Quarkus - Generate REST APIs Document Specification with OPENAPI and SWAGGER UI using external static openapi.yaml file in 7 simple steps

This example explains how Quarkus application can expose its API description through an OpenAPI specification and how one can test it via a user-friendly UI named Swagger UI. 

In this example we are going to see how REST APIs Document Specification can be generated Using OPENAPI and SWAGGER UI from external static openapi.yaml file in just 7 Simple Steps.

Prerequisites To complete this example:

  • An IDE
  • JDK 11+ installed with JAVA_HOME configured appropriately
  • Apache Maven 3.8.1+

Here are the Steps:

1. Create a maven project using Quarkus and add the below Dependencies in pom.xml



2. Create the static openapi file to serve which must be a valid document conforming to the OpenAPI specificationThe openapi file can be represented in yaml or json formats.

3. Here is our openapi.yaml file looks like



4. Place static OpenAPI document file under META-INF/openapi.yaml. To serve the static OpenAPI document we will add mp.openapi.scan.disable=true configuration into application.properties.

5. run Quarkus application in dev using below command



6. Quarkus Application will be started with below logs:



7. Open this URL http://localhost:8080/q/teachlea/ in browser, It will load the OpenApi Specification in swager-ui page.



So Just in 7 simple steps we have implemented  REST APIs Document Specification Using OPENAPI and SWAGGER UI from external static openapi.yaml file in Quarkus Application


Please feel free to provide your valuable comments, Thanks.



Post a Comment

0 Comments

Ad Code