This is an activator template that is designed to see how swagger can be integrated with play-framework using play-swagger. This template will include demonstration of the most common use-cases while using swagger with any API which are as follows :
-
Hiding an end point using swagger-ui.
-
Specify parameters in query-string
-
Specify parameters in path(url)
-
Specify parameters as FormUrlEncodedBody
To get the conceptual knowledge on every use-case, or how routes of a play-framework application interacts to create the swagger UI, you can read @ Introduction to Play-Swagger
git clone [email protected]:SangeetaGulia/play-swagger-activator-template.git
cd play-swagger-activator-template
activator clean compile
To run the project use the below command which will start your play application at port 9000.
activator run
Open the below url in your browser to see the swagger-ui generated:
http://localhost:9000/docs/index.html?url=/swagger.json#/
Swagger-ui is generated based on the swagger-spec (swagger.json in this template). ApiSpecs is responsible for auto-generating the swagger-spec based on the definitions and rules provided in routes file for each route.
-
"/swagger.json" is the route which is responsible to generate swagger spec from the route file based on the rules specified for each route.
-
"/docs/*file" is the route responsible for rendering the swagger-ui.
For any issue please raise a ticket @ Github Issue