Created
May 17, 2019 09:39
-
-
Save quezak/d39343604498153c665b35d19a53e836 to your computer and use it in GitHub Desktop.
openapi generator schema example with different return types for different codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"host": "test.test", | |
"schemes": ["https"], | |
"info": { "version": "1.0", "title": "Test" }, | |
"paths": { | |
"/test": { | |
"get": { | |
"summary": "Test", | |
"description": "Test", | |
"operationId": "test", | |
"produces": ["application/json"], | |
"parameters": [], | |
"responses": { | |
"200": { | |
"description": "Successful operation", | |
"schema": { "$ref": "#/definitions/TestResponse" } | |
}, | |
"default": { | |
"description": "Unexpected error", | |
"schema": { "$ref": "#/definitions/ErrorResponse" } | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"TestResponse": { | |
"type": "object", | |
"properties": { | |
"testField": { "type": "integer" } | |
} | |
}, | |
"ErrorResponse": { | |
"type": "object", | |
"properties": { | |
"errorMessage": { "type": "string" } | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment