markathomas
6 years agoNew 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
Change your body parameter to this:
- in: body name: request schema: $ref: '#/definitions/CreateRoomRequest' required: true
Body parameters do not have 'type' in them.