Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 751
Sankar Avatar asked Jun 27 '26 21:06

Sankar


1 Answers

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).

like image 148
user667 Avatar answered Jun 30 '26 09:06

user667



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!