I am newbie to Swagger, and am working on API operations which create generic http response codes:-
'401: Unauthorized
'403': Forbidden
I tried $ref: #/definitions/responses
by defining responses but got an error. Is there a way to do this?, to avoid redundant block of code after each operation. Any help would be really appreciated.
Thanks in advance
Found answer for this,
This can be done for referencing generic responses from some other file(in my case). Can be referenced from within a file as well.
'400':
$ref: _http-responses.yaml#/400
'401':
$ref: _http-responses.yaml#/401
'403':
$ref: _http-responses.yaml#/403
'404':
$ref: _http-responses.yaml#/404
'500':
$ref: _http-responses.yaml#/500
I created
_http_responses.yaml
and then referenced it.