Forum Discussion

vivekab's avatar
vivekab
Occasional Visitor
5 years ago

Linking request and response in swagger UI

Hi everyone,

We know that we can have multiple response for the same endpoint and multiple request bodies using different examples in swagger.

 

Example:

  For create user request for a success case

   

{
  "name":"John",
  "DOB":"15-09-1998"
}

Can give me a response:

 

Code 200
{ "id":"1", "name":"John", "DOB":"15-09-1998" }

 and for Error case

For create user request for an error case

   

{
  "name":"John",
  "DOB":"15-19-1998"
}

Can give me a response:

 

Code 400
{ "error":"Invalid parameter `DOB` in the request" }

 Is it possible to tie the success request with success response and error request with error respones?

or 

Should the request bodies and the response bodies have to be defined individually?

No RepliesBe the first to reply