1

I'm using Swagger 3.0 in tandem with swagger-php and getting

strange behavior with request body markup

.

In the image, the "Examples:" dropdown shows up and "Example Value | Schema" shows up under that dropdown instead of "Example Value | Model".

My questions are:

  1. How do I remove the examples dropdown?

  2. How do I add multiple examples for the dropdown?

  3. Why does my sagger-ui show "Example value | Schema" instead of "Example value | Model"?

  4. Is there updated documentation that's not listed about Request Body examples?

I'm following the post example on line 40 of

https://github.com/zircote/swagger-php/blob/master/Examples/petstore-3.0/controllers/User.php

https://github.com/zircote/swagger-php/blob/master/Examples/petstore-3.0/models/RequestBody.php

https://github.com/zircote/swagger-php/blob/master/Examples/petstore-3.0/models/User.php

Here's my markup:

/**
* @OA\Post(
*     path="/exampleUrl/{y2k}",
*     description="Description",
*     summary="Summary",
*     @OA\Parameter(
*         name="y2k",
*         in="path",
*         description="Parameter Description",
*         required=true,
*         example="bbop",
*         @OA\Schema(
*           type="string",
*         )
*     ),
*     @OA\RequestBody(ref="#/components/requestBodies/RequestBodyExample"),
*     @OA\Response(
*         response="200",
*         description="Response Description",
*     ),
* )
*/

/**
* @OA\RequestBody(
*     request="RequestBodyExample",
*     description="Request Body Description",
*     required=true,
*     @OA\JsonContent(ref="#/components/schemas/SchemaExample"),
* )
*/

/**
* @OA\Schema()
*/
class SchemaExample
{
    /**
     * @var string
     * @OA\Property()
     */
    public $exampleString;

}

Examples dropdown image

Tajinder
  • 2,248
  • 4
  • 33
  • 54

0 Answers0