How to determine a specific application error code in Swagger

I would like to identify a possible application error code rather than an HTTP status code, for example:

In the returned JSON

{
   code: 2000,
   message: "create success"

} // or

{
   code: 2001
   message: "user already exists"
}

....

I know that you can define a scheme for this structure, but the scheme is not enough here, since I need to determine the possible code and message.

Is it possible? If so, how to do it in Swagger?

+4
source share

Source: https://habr.com/ru/post/1623153/


All Articles