Skip to content

Instantly share code, notes, and snippets.

@mallison
Created May 15, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mallison/ec0529facdfaf6341590f017ae5f9214 to your computer and use it in GitHub Desktop.
Save mallison/ec0529facdfaf6341590f017ae5f9214 to your computer and use it in GitHub Desktop.
Single schema 🤔
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"properties": {
"trigger": {
"oneOf": [
{
"$ref": "#/definitions/tapTrigger"
},
{
"$ref": "#/definitions/swipeTrigger"
}
]
}
},
"definitions": {
"tapTrigger": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"coords"
],
"properties": {
"type": {
"type": "string",
"enum": [
"tap"
]
},
"coords": {
"type": "array"
}
}
},
"swipeTrigger": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"startCoords",
"endCoords"
],
"properties": {
"type": {
"type": "string",
"enum": [
"swipe"
]
},
"startCoords": {
"type": "array"
},
"endCoords": {
"type": "array"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment