Hi there,
The swagger 2.0 specification supports providing examples as part of a response definition:
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#exampleObject
and I also noticed that there is a $examples public variable in Annotations/Response.php but I could not seem to find how to use it. I was wondering if anyone has a working example of using 'examples' as part of a Response definition.
Bests,
Yoanis.
There is no @SWG\Examples because _examples_ doesn't have a defined structure, therefor it wouldn't add any benefit compared to using doctrine-annotations's object-notation.
To create the the example in shown in the spec with swagger-php, you'll write:
/**
* @SWG\Response(
* response=200,
* description="...",
* examples={
* "application/json": {
* "name"="Puma",
* "type"="Dog",
* "color"="Black",
* "gender"="Female",
* "breed"="Mixed"
* }
* }
* )
*/
Most helpful comment
There is no
@SWG\Examplesbecause _examples_ doesn't have a defined structure, therefor it wouldn't add any benefit compared to using doctrine-annotations's object-notation.To create the the example in shown in the spec with swagger-php, you'll write: