Forum Discussion

bluishgreen's avatar
bluishgreen
Occasional Visitor
6 years ago

Returning Multiple response codes for a process

I am just getting started with swagger, and wondered if there's a way to return multiple schema objects(corresponding to different response codes) for a particular process that has been initiated.

For instance, consider the following code:

responses:

 "200":

  description: successful query

 "400":

  description: Wrong ID entered.

  content:

  application/json:

   schema:

    $ref: components/schemas/schema1

 "401":

  description: Incorrect date entered.

  content:

   application/json:

    schema:

    $ref: components/schemas/schema2

 

 

If a process has wrong ID and incorrect date entered, I want to be able to return the schemas corresponding to error codes 400 and 401 both. How can I achieve this?

      

 

  • It should work pretty much the same way you described it. Is this not the experience you get?