Swagger(2.0) Editor two different body for same endpoint

113 Views Asked by At

Our platform supports only Swagger 2.0 version. For one Endpoint, I use two different bodies for two situations. Based on the body parameter, it will pass onto if-else. Both bodies have some fields in common

I tried to append #1 and #2 at end of endpoint. But it doesnt work. Is there any other workaround

I tried two bodies and Swagger validation fails.

paths:
  /v1/endpoint:
    post:
      operationId: api.handle_endpoint
      produces:
        - application/json
      parameters:
        - in: body
          name: body [a]
          description: a
          required: true
          schema:
            $ref: '#/definitions/a'
        - in: body
          name: body[b]
          description: To a
          required: true
          schema:
            $ref: '#/definitions/b'

Is there any workaround for this in Swagger 2.0?

0

There are 0 best solutions below