-
-
Save panSarin/6a7efcdd503a315d21fcf38213d560cc to your computer and use it in GitHub Desktop.
nested schema validation example
This file contains 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", | |
"info": { "version": "0.0.0.0.1", "title": "Users API endpoints"}, | |
"paths": { | |
"/user_settings": { | |
"get": { | |
"description": "User settings", | |
"parameters": [ | |
{ | |
"in": "query", | |
"name": "auth_token", | |
"description": "user token", | |
"required": true, | |
"type": "string" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Successful response", | |
"schema": { | |
"$ref": "#/definitions/user_settings_response" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"user_settings_response": { | |
"description": "User settings", | |
"type": "object", | |
"properties": { | |
"id": {"type": "string", "example": "567bc35c5605f67f41000026"}, | |
"ios_landing_page": {"type": "string", "example": "Hello"}, | |
"units": { | |
"type": "array", | |
"items": { "$ref": "#/definitions/unit" } | |
} | |
} | |
}, | |
"unit": { | |
"type": "object", | |
"required": ["facility", "test"], | |
"properties": { | |
"id": {"type": "string", "example": "567bc35c5605f67f41000026"}, | |
"facility": {"type": "string", "example": "Common Facility"}, | |
"_id": {"type": "string", "example": "567bc35c5605f67f41000026"}, | |
"name": {"type": "string", "example": "1A"} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment