Transform your Swagger (Open API) spec examples into a Symfony REST mock server
This project uses the Kleijnweb\SwaggerBundle to provide the routes and definition validation.
- Checkout the project and install dependencies
- Replace the content of web/swagger/default.json with the specification you want to mock
- Run the application with docker-compose
By default it will use the examples specified in your definition. To be able to adjust the examples for each and every project you can add example files. As an example I've added such an example in the directory the examples should go. The files should be named as follows:
- ROUTE_NAME + url parameter key=value + query params key=value
- The url and query parameters are both ordered by alphabet by key and separated by an '&'
- You can find the ROUTE_NAME by running app/console debug:router in the container
Eg:
url = /pets/{id}?debug=0&auth=1 // where id=1 and ROUTE_NAME=swagger.default.pets.id.findPetById
filename = swagger.default.pets.id.findPetById&id=1&auth=1&debug=0