A demonstration of how to define a RESTful interface in Play 2 using Scala and Swagger
This example code was produced as document and to give working examples of how to use Scala / Swagger / Play. It includes:
- Use of
GET, POST, DELETE, PATH, HEAD and OPTIONS
- JSON body object parameters
- API parameters
- URL embedded parameters
- Swagger API annotations
- Swagger model annotations
- Generation of Swagger JSON
This is a module to support Swagger annotations within Play Framework controllers
Swagger Play2 Module project in GitHub
Unfortunately the code does not appear to be maintained with the latest release being 2 years old at the time of writing
...however it has been forked and updated. This fork is cross-compiled for Play 2.7 and 2.8 with Scala 2.12 and 2.13.
https://github.com/swagger-api/swagger-codegen
This link opens the swagger UI in a running project. Unfortunately it defaults the Petstore Demo (why?).
http://localhost:9000/docs/swagger-ui/index.html
Once opened, change the location from https://petstore.swagger.io/v2/swagger.json
to /swagger.json
This link opens the generated Swagger JSON document in a running project
http://localhost:9000/swagger.json
If you find this project useful, you may want to Buy me a Coffee! ☕ Thanks 👍