Created
February 8, 2021 23:13
-
-
Save johanste/c179f8439e6a676080c7765be70c4a07 to your computer and use it in GitHub Desktop.
More specific "derived" swagger type
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": { | |
"title": "Examples of scenarios - #1, more constrained children", | |
"version": "1.0" | |
}, | |
"paths": [], | |
"definitions": { | |
"GenericResource": { | |
"type": "object", | |
"properties": { | |
"location": { | |
"type": "string" | |
}, | |
"properties": { | |
"additionalProperties": {}, | |
"description": "The 'generic resource' has a well-known property 'properties' that is of type 'object'. Specific resource types can override it.", | |
"type": "object" | |
} | |
} | |
}, | |
"VirtualMachineResource": { | |
"description": "A specific resource types. Two things to pay attention to - the additionalProperties has to be specified (if this is an openapi 2.0 document), and the 'properties' property is more specific than what is in the 'GenericResource'", | |
"allOf": [ { "$ref": "#/definitions/GenericResource" }], | |
"additionalProperties": {}, | |
"properties": { | |
"properties": { | |
"$ref": "#/definitions/VirtualMachineResourceProperties" | |
} | |
} | |
}, | |
"VirtualMachineResourceProperties": { | |
"type": "object", | |
"properties": { | |
"vmSize": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment