Sankar
Sankar

Reputation: 6522

swagger is not rendering requestbody

I have the following openapi 3.0 compliant yaml file which I am trying to render via swagger. There are no errors reported in the yaml file, but the requestBody is not rendered on the swagger GUI. I just get a parameters field which is empty but nothing rendered for the request body, nor do I get any errors. Screenshot below.

paths:
  /my-api:
    post:
      summary: My API Summary
      description: My API Description
      tags:
        - Cost Center
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '#/components/schemas/ReqBodyStruct'

Screnshot

What is the way to get the RequestBody also shown in the swagger gui ? Do I miss something ?

Upvotes: 4

Views: 3174

Answers (1)

user667
user667

Reputation: 469

According to these two issues OAS 3.0: Support for media type examples (aka request/response body examples) #3437 and Examples are not showing #2651 from the Swagger UI github page this should be fixed in version 3.23.0 (of June 29, 2019).

Upvotes: 1

Related Questions