Swagger API Documentation Support

API Documentation in Swagger Format

The Page Model JSON API supports a Swagger API documentation endpoint at /swagger.json by default. For example, if the URI endpoint of the Page Model JSON API is http://localhost:8080/site/resourceapi/, then you can access the Swagger API documentation through http://localhost:8080/site/resourceapi/swagger.json. A Swagger UI web application (as shown in the screenshot below) can be installed and configured for developers to read and try it out through UI.

To install the Swagger UI web application locally, see the example at /api-docs and the configurations in root pom.xml for the cargo.run profile in the TestSuite project.

Swagger API Documentation will always be generated in JSON format, regardless of the extensions (e.g, .yaml) as Page Model JSON API uses the default Jackson ObjectMapper to serialize its Swagger API model internally.

Customizing Swagger Path Info

If you need to change the Swagger API documentation endpoint path info from /swagger.json to something else, configure pagemodelapi.v09.apiDocPath property in /WEB-INF/hst-config.properties

# Customizing Swagger Path Info to /my-swagger.json in this example...
pagemodelapi.v09.apiDocPath = /my-swagger.json

 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?