Swagger-php: Response format

Created on 19 Aug 2015  路  2Comments  路  Source: zircote/swagger-php

How I can define response like this?

array(
  "status": 1,
  "msg": "some message",
  "results": array(myobject, myobject, etc..)
);

Now I have defined:

     *     @SWG\Response(
     *         response=200,
     *         description="List of my objects",
     *         @SWG\Schema(
     *             type="array",
     *             @SWG\Items(ref="#/definitions/myobject")
     *         ),
     *     ),

Please help

Most helpful comment

Like this:

/**
 * @SWG\Response(
 *   response=200,
 *   description="List of my objects",
 *   @SWG\Schema(
 *     type="object",
 *     @SWG\Property(property="status", type="integer"),
 *     @SWG\Property(property="msg", type="string", description="some message"),
 *     @SWG\Property(property="results", type="array",
 *       @SWG\Items(ref="#/definitions/myobject")
 *     )
 *   )
 * )
 */

All 2 comments

Like this:

/**
 * @SWG\Response(
 *   response=200,
 *   description="List of my objects",
 *   @SWG\Schema(
 *     type="object",
 *     @SWG\Property(property="status", type="integer"),
 *     @SWG\Property(property="msg", type="string", description="some message"),
 *     @SWG\Property(property="results", type="array",
 *       @SWG\Items(ref="#/definitions/myobject")
 *     )
 *   )
 * )
 */

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings