Setting up spring doc-open API
To have springdoc-openapi automatically generate the OpenAPI 3 specification docs for our API, we simply add the springdoc-openapi-ui dependency to our pom.xml:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
Then when we run our application, the OpenAPI descriptions will be available at the path /v3/api-docs by default:
http://localhost:8080/v3/api-docs/
To use a custom path, we can indicate in the application.properties file:
springdoc.api-docs.path=/api-docs
Now we'll be able to access the docs at:
http://localhost:8080/api-docs/
The OpenAPI definitions are in JSON format by default. For yaml format, we can obtain the definitions at:
http://localhost:8080/api-docs.yaml
----------------------------------------------------------------------
If you want to test like post man then this is for you.
Now we can access the API documentation at:
http://localhost:8080/swagger-ui.html
Comments
Post a Comment