I'd like to write a @SWG\Definition somewhere and refer to it in the @SWG\Schema in @SWG\Response annotations for multiple REST API actions in my Symfony 3 application. I'm using the dev-master version of Nelmio's api-doc-bundle but I can seem to find anything that suggests where that definition should go. The Swagger-PHP docs urge not repeating if possible and I'd like to follow that recommendation. Any hints?
Typical... Finally break down and ask then figure out a solution shortly after...
I found that I can preload the documentation data in Symfony's app/config/config.yml.
nelmio_api_doc:
documentation:
definitios:
Error:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
example: message
Now I can use something like this in all my REST actions
/**
* @API\Operation(
* ...
* @SWG\Response(
* response="default",
* description="Failure",
* @SWG\Schema(ref="#definitions/Error")
* )
* )
*/