Swagger Documentation Setup Configuration for ATG JAX-RS REST service
ATG 11.3 by default comes with the required Swagger
libraries in the installation package.
Swagger produces documentation in JSON or YAML format, and
can be accessed through the URL in the format of
In this post we will see the setup and configuration of Swagger
UI .
Step 1
Clone or download the zip file from
GitHub repository.
Download link : https://github.com/swagger-api/swagger-ui
Step 2
Extract the package and copy the dist folder to your server.
[json-server/Apache Tomcat/JBoss/Etc.,]
Step 3
Load
the url http://localhost:8181/dist [8181 is my server port]
You can
see the default JSON specification of http://petstore.swagger.io/v2/swagger.json.
Step 4
Provide
the ATG JSON url in the Swagger UI test box in the top and hit Explore button.
You can see the error says it fails.
Unfortunately,
that is a built in security feature on all browsers. Swagger-Ui uses ajax to
fetch files, and that can only be accomplished if you run it on a server.
Step 5
You can
open your chrome browser with the disable-web-security option .
Open Windows->Run->
chrome.exe --user-data-dir="C:/Chrome dev session"
--disable-web-security
Chrome will be opened and load the
swagger UI url and hit it again. You can see the below shows the end point
details.
Step 6
Verify
the end point details.
Thanks.
No comments
Post a Comment