cancel
Showing results for 
Search instead for 
Did you mean: 

What's wrong with this request body definition

SOLVED
New Contributor

What's wrong with this request body definition

I followed the example at https://swagger.io/docs/specification/2-0/describing-request-body/ and Swagger Editor is saying it's invalid for 2.0 API spec.  Here's the def:

Spoiler
/api/v1/chat/{acctNum}/room/create:
    post:
      tags:
      - developers
      summary: creates a new room
      operationId: createRoomV1
      produces:
      - application/json
      consumes: 
      - application/json
      parameters: 
      - in: path
        name: acctNum
        type: string
        description: Account number of organization
        required: true
      - in: body
        name: request
        type:  
          schema:
            $ref: '#/definitions/CreateRoomRequest'
        required: true
      responses:
        200:
          description: operation successful
          schema:
            $ref: '#/definitions/Room'
        403:
          description: forbidden if account number does not match user organization account number and user is not a super-admin
        400:
          description: bad input parameter
        500:
          description: internal server error
definitions:
  CreateRoomRequest:
    required: 
    - name
    - privateRoom
    properties:
      name:
        type: string
      privateRoom:
        type: boolean
      supportChannel:
        type: boolean
      copilotChannel:
        type: boolean
      caregiverId:
        type: integer
      patientVisitId:
        type: integer
      bedName:
        type: string
      patientName:
        type: string

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: What's wrong with this request body definition

Change your body parameter to this:

      - in: body
        name: request
        schema:
          $ref: '#/definitions/CreateRoomRequest'
        required: true

Body parameters do not have 'type' in them.

3 REPLIES 3
Highlighted
New Contributor

Re: What's wrong with this request body definition

Here's the errors:

ss.png

Moderator

Re: What's wrong with this request body definition

Change your body parameter to this:

      - in: body
        name: request
        schema:
          $ref: '#/definitions/CreateRoomRequest'
        required: true

Body parameters do not have 'type' in them.

New Contributor

Re: What's wrong with this request body definition

Thank you very much!

New Here?
Join us and watch the welcome video:
Top Kudoed Authors