Skip to content

Instantly share code, notes, and snippets.

@jeffpatton1971
Last active April 20, 2021 22:16
Show Gist options
  • Save jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2 to your computer and use it in GitHub Desktop.
Save jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2 to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"examples": [
{
"products": [
{
"checked": false,
"dimensions": {
"width": 5,
"height": 10
},
"id": 1,
"name": "A green door",
"price": 12.5,
"tags": [
"home",
"green"
]
}
]
}
],
"required": [
"products"
],
"properties": {
"products": {
"$id": "#/properties/products",
"type": "array",
"title": "The products schema",
"description": "An explanation about the purpose of this instance.",
"default": [],
"examples": [
[
{
"checked": false,
"dimensions": {
"width": 5,
"height": 10
},
"id": 1,
"name": "A green door",
"price": 12.5,
"tags": [
"home",
"green"
]
}
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/products/items",
"anyOf": [
{
"$id": "#/properties/products/items/anyOf/0",
"type": "object",
"title": "The first anyOf schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"checked": false,
"dimensions": {
"width": 5,
"height": 10
},
"id": 1,
"name": "A green door",
"price": 12.5,
"tags": [
"home",
"green"
]
}
],
"required": [
"checked",
"dimensions",
"id",
"name",
"price",
"tags"
],
"properties": {
"checked": {
"$id": "#/properties/products/items/anyOf/0/properties/checked",
"type": "boolean",
"title": "The checked schema",
"description": "An explanation about the purpose of this instance.",
"default": false,
"examples": [
false
]
},
"dimensions": {
"$id": "#/properties/products/items/anyOf/0/properties/dimensions",
"type": "object",
"title": "The dimensions schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"width": 5,
"height": 10
}
],
"required": [
"width",
"height"
],
"properties": {
"width": {
"$id": "#/properties/products/items/anyOf/0/properties/dimensions/properties/width",
"type": "integer",
"title": "The width schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
5
]
},
"height": {
"$id": "#/properties/products/items/anyOf/0/properties/dimensions/properties/height",
"type": "integer",
"title": "The height schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
10
]
}
},
"additionalProperties": true
},
"id": {
"$id": "#/properties/products/items/anyOf/0/properties/id",
"type": "integer",
"title": "The id schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
1
]
},
"name": {
"$id": "#/properties/products/items/anyOf/0/properties/name",
"type": "string",
"title": "The name schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"A green door"
]
},
"price": {
"$id": "#/properties/products/items/anyOf/0/properties/price",
"type": "number",
"title": "The price schema",
"description": "An explanation about the purpose of this instance.",
"default": 0.0,
"examples": [
12.5
]
},
"tags": {
"$id": "#/properties/products/items/anyOf/0/properties/tags",
"type": "array",
"title": "The tags schema",
"description": "An explanation about the purpose of this instance.",
"default": [],
"examples": [
[
"home",
"green"
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/products/items/anyOf/0/properties/tags/items",
"anyOf": [
{
"$id": "#/properties/products/items/anyOf/0/properties/tags/items/anyOf/0",
"type": "string",
"title": "The first anyOf schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"home",
"green"
]
}
]
}
}
},
"additionalProperties": true
}
]
}
}
},
"additionalProperties": true
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"description": "The root schema is the schema that comprises the entire JSON document.",
"default": {},
"required": [
"checked",
"dimensions",
"id",
"name",
"price",
"tags"
],
"properties": {
"checked": {
"$id": "#/properties/checked",
"type": "boolean",
"title": "The Checked Schema",
"description": "An explanation about the purpose of this instance.",
"default": false,
"examples": [
false
]
},
"dimensions": {
"$id": "#/properties/dimensions",
"type": "object",
"title": "The Dimensions Schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"height": 10.0,
"width": 5.0
}
],
"required": [
"width",
"height"
],
"properties": {
"width": {
"$id": "#/properties/dimensions/properties/width",
"type": "integer",
"title": "The Width Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
5
]
},
"height": {
"$id": "#/properties/dimensions/properties/height",
"type": "integer",
"title": "The Height Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
10
]
}
}
},
"id": {
"$id": "#/properties/id",
"type": "integer",
"title": "The Id Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
1
]
},
"name": {
"$id": "#/properties/name",
"type": "string",
"title": "The Name Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"A green door"
]
},
"price": {
"$id": "#/properties/price",
"type": "number",
"title": "The Price Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
12.5
]
},
"tags": {
"$id": "#/properties/tags",
"type": "array",
"title": "The Tags Schema",
"description": "An explanation about the purpose of this instance.",
"default": [],
"examples": [
[
"home",
"green"
]
],
"items": {
"$id": "#/properties/tags/items",
"type": "string",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"home",
"green"
]
}
}
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"required": [
"checked",
"dimensions",
"id",
"name",
"price",
"tags"
],
"properties": {
"checked": {
"id": "#/properties/checked",
"type": "boolean",
"title": "The checked schema",
"description": "An explanation about the purpose of this instance."
},
"dimensions": {
"id": "#/properties/dimensions",
"type": "object",
"title": "The dimensions schema",
"description": "An explanation about the purpose of this instance.",
"required": [
"width",
"height"
],
"properties": {
"width": {
"id": "#/properties/dimensions/properties/width",
"type": "number",
"title": "The width schema",
"description": "An explanation about the purpose of this instance."
},
"height": {
"id": "#/properties/dimensions/properties/height",
"type": "number",
"title": "The height schema",
"description": "An explanation about the purpose of this instance."
}
}
},
"id": {
"id": "#/properties/id",
"type": "number",
"title": "The id schema",
"description": "An explanation about the purpose of this instance."
},
"name": {
"id": "#/properties/name",
"type": "string",
"title": "The name schema",
"description": "An explanation about the purpose of this instance."
},
"price": {
"id": "#/properties/price",
"type": "number",
"title": "The price schema",
"description": "An explanation about the purpose of this instance."
},
"tags": {
"id": "#/properties/tags",
"type": "array",
"title": "The tags schema",
"description": "An explanation about the purpose of this instance.",
"items": {
"anyOf": [
{
"id": "#/properties/tags/items/anyOf/0",
"type": "string",
"title": "The first anyOf schema",
"description": "An explanation about the purpose of this instance."
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment