This example explains how SpringBoot 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 open-api-swagger.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 SpringBoot 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 specification. The openapi file can be represented in yaml or json
formats.
3. Here is our open-api-swagger.yaml file looks like
4. Place static OpenAPI document file under resources like below:
0 Comments