Swagger-php: field schema is required

Created on 8 Sep 2016  路  1Comment  路  Source: zircote/swagger-php

Hi,

when i try to generate the docs I got the exception

  [ErrorException]                                                             
  Field "schema" is required when @SWG\Parameter(name="body",in="body") is in  
   "body" in \App\Http\Controllers\AccessLogController->create_login_log() in  
   /Users/dev/Documents/others/winkerapp-api/app/Http/Controllers/AccessLogCo  
  ntroller.php on line 30 

/**
     * @SWG\Post(
     *     path="/api/access/login",
     *     consumes={"application/json"},
     *     description="Create a loggin log",
     *     operationId="logloggin",
     *     @SWG\Parameter(
     *         description="user id",
     *         in="body",
     *         name="user_id",
     *         required=true,
     *         type="integer"
     *     ),
     *     @SWG\Response(
     *         response="200",
     *         description="successful operation",
     *         @SWG\Schema(ref="#/definitions/AccessLog")
     *     ),
     *     summary="register a loggin log",
     *     tags={
     *         "log"
     *     }
     * )
     * */

Most helpful comment

If in is "body" a schema is required: http://swagger.io/specification/#parameterIn
Using type directly in parameter is only available when in is any value other than "body"

Just add a schema and specify the type like so:

     * ...
     *     @SWG\Parameter(
     *         description="user id",
     *         in="body",
     *         name="user_id",
     *         required=true,
     *         @SWG\Schema(type="integer")
     *     ),
     * ...

>All comments

If in is "body" a schema is required: http://swagger.io/specification/#parameterIn
Using type directly in parameter is only available when in is any value other than "body"

Just add a schema and specify the type like so:

     * ...
     *     @SWG\Parameter(
     *         description="user id",
     *         in="body",
     *         name="user_id",
     *         required=true,
     *         @SWG\Schema(type="integer")
     *     ),
     * ...
Was this page helpful?
0 / 5 - 0 ratings