Note: I have forked this repository to test whether it is possible to add OpenAPI validation rule annotations programmatically.
This is possible - see SwaggerBakeListener.php in the validation-test branch for an example.
Submit problems or requests for additional examples as github issues.
Clone repository:
git clone git@github.com:cnizzardini/cakephp-swagger-bake-demo.gitInstall via composer:
composer installConfigure the application for database access using config/.env or config/app_local.php, then run
migrations to build/seed your database.
bin/cake migrations migrate -p Sakila
bin/cake migrations seed -p SakilaConfigure your web server or run the cake web server:
bin/cake serverThat's it, you're done!
Here is a list of some examples. It's best to search src/ for an exhaustive list of examples.
| Feature | Example |
|---|---|
| SwaggerBake Events | App\Event\SwaggerBakeListener |
| OpenApiDto | App\Controller\ExamplesControllers |
| OpenApiForm | App\Controller\ExamplesController::formExample |
| OpenApiHeader | App\Controller\ExamplesController::headerExample |
| OpenApiOperation | App\Controller\ActorsController::index |
| OpenApiPaginator | Most controller index() actions have this defined |
| OpenApiPath | |
| OpenApiPathParam | |
| OpenApiQueryParam | App\Controller\ExamplesController::headerExample |
| OpenApiRequestBody | |
| OpenApiResponse | App\Controller\CountriesController |
| OpenApiResponse associations | App\Controller\ActorsController::films |
| OpenApiResponse schema | App\Controller\ExamplesControllers |
| OpenApiSchema | App\Model\Entity\Rental |
| OpenApiSchemaProperty | |
| OpenApiSearch | FilmsController::index |
| OpenApiSecurity |