cancel
Showing results for 
Search instead for 
Did you mean: 

Returning Multiple response codes for a process

Occasional Visitor

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?

      

 

1 REPLY 1
Moderator

Re: Returning Multiple response codes for a process

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

New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors