Skip to content

Instantly share code, notes, and snippets.

@nicolasrouanne
Created August 21, 2018 09:11
Show Gist options
  • Save nicolasrouanne/c36d49e94de12240b0205a4345063a16 to your computer and use it in GitHub Desktop.
Save nicolasrouanne/c36d49e94de12240b0205a4345063a16 to your computer and use it in GitHub Desktop.
json-schema-issue#18
{
"included": [
{
"id": "1",
"type": "boat_model",
"attributes": {
"name": "Demacia",
"boat_type": "sailboat",
"loa": 16.63,
"beam": 1.23,
"draft": 1.74211606331017,
"cabins": 5,
"wc": 2
}
},
{
"id": "1",
"type": "image",
"attributes": {
"url": "http://roberts.co/krystina",
"main": true
}
}
]
}
{
"definitions": {},
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"included"
],
"properties": {
"included": {
"$id": "#/properties/included",
"type": "array",
"title": "The Included Schema",
"items": {
"$id": "#/properties/included/items",
"type": "object",
"title": "The Items Schema",
"required": [
"id",
"type",
"attributes"
],
"properties": {
"id": {
"$id": "#/properties/included/items/properties/id",
"type": "string",
"title": "The Id Schema",
"default": "",
"examples": [
"1"
],
"pattern": "^(.*)$"
},
"type": {
"$id": "#/properties/included/items/properties/type",
"type": "string",
"title": "The Type Schema",
"default": "",
"examples": [
"boat_model"
],
"pattern": "^(.*)$"
},
"attributes": {
"$id": "#/properties/included/items/properties/attributes",
"type": "object",
"title": "The Attributes Schema",
"required": [
"name",
"boat_type",
"loa",
"beam",
"draft",
"cabins",
"wc"
],
"properties": {
"name": {
"$id": "#/properties/included/items/properties/attributes/properties/name",
"type": "string",
"title": "The Name Schema",
"default": "",
"examples": [
"Demacia"
],
"pattern": "^(.*)$"
},
"boat_type": {
"$id": "#/properties/included/items/properties/attributes/properties/boat_type",
"type": "string",
"title": "The Boat_type Schema",
"default": "",
"examples": [
"sailboat"
],
"pattern": "^(.*)$"
},
"loa": {
"$id": "#/properties/included/items/properties/attributes/properties/loa",
"type": "number",
"title": "The Loa Schema",
"default": 0.0,
"examples": [
16.63
]
},
"beam": {
"$id": "#/properties/included/items/properties/attributes/properties/beam",
"type": "number",
"title": "The Beam Schema",
"default": 0.0,
"examples": [
1.23
]
},
"draft": {
"$id": "#/properties/included/items/properties/attributes/properties/draft",
"type": "number",
"title": "The Draft Schema",
"default": 0.0,
"examples": [
1.74211606331017
]
},
"cabins": {
"$id": "#/properties/included/items/properties/attributes/properties/cabins",
"type": "integer",
"title": "The Cabins Schema",
"default": 0,
"examples": [
5
]
},
"wc": {
"$id": "#/properties/included/items/properties/attributes/properties/wc",
"type": "integer",
"title": "The Wc Schema",
"default": 0,
"examples": [
2
]
}
}
}
}
}
}
}
}
{
"definitions": {},
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"included"
],
"properties": {
"included": {
"$id": "#/properties/included",
"type": "array",
"title": "The Included Schema",
"items": [
{
"$id": "#/properties/included/items/0",
"type": "object",
"title": "The 0 Schema",
"required": [
"id",
"type",
"attributes"
],
"properties": {
"id": {
"$id": "#/properties/included/items/0/properties/id",
"type": "string",
"title": "The Id Schema",
"default": "",
"examples": [
"1"
],
"pattern": "^(.*)$"
},
"type": {
"$id": "#/properties/included/items/0/properties/type",
"type": "string",
"title": "The Type Schema",
"default": "",
"examples": [
"boat_model"
],
"pattern": "^(.*)$"
},
"attributes": {
"$id": "#/properties/included/items/0/properties/attributes",
"type": "object",
"title": "The Attributes Schema",
"required": [
"name",
"boat_type",
"loa",
"beam",
"draft",
"cabins",
"wc"
],
"properties": {
"name": {
"$id": "#/properties/included/items/0/properties/attributes/properties/name",
"type": "string",
"title": "The Name Schema",
"default": "",
"examples": [
"Demacia"
],
"pattern": "^(.*)$"
},
"boat_type": {
"$id": "#/properties/included/items/0/properties/attributes/properties/boat_type",
"type": "string",
"title": "The Boat_type Schema",
"default": "",
"examples": [
"sailboat"
],
"pattern": "^(.*)$"
},
"loa": {
"$id": "#/properties/included/items/0/properties/attributes/properties/loa",
"type": "number",
"title": "The Loa Schema",
"default": 0.0,
"examples": [
16.63
]
},
"beam": {
"$id": "#/properties/included/items/0/properties/attributes/properties/beam",
"type": "number",
"title": "The Beam Schema",
"default": 0.0,
"examples": [
1.23
]
},
"draft": {
"$id": "#/properties/included/items/0/properties/attributes/properties/draft",
"type": "number",
"title": "The Draft Schema",
"default": 0.0,
"examples": [
1.74211606331017
]
},
"cabins": {
"$id": "#/properties/included/items/0/properties/attributes/properties/cabins",
"type": "integer",
"title": "The Cabins Schema",
"default": 0,
"examples": [
5
]
},
"wc": {
"$id": "#/properties/included/items/0/properties/attributes/properties/wc",
"type": "integer",
"title": "The Wc Schema",
"default": 0,
"examples": [
2
]
}
}
}
}
},
{
"$id": "#/properties/included/items/1",
"type": "object",
"title": "The 1 Schema",
"required": [
"id",
"type",
"attributes"
],
"properties": {
"id": {
"$id": "#/properties/included/items/1/properties/id",
"type": "string",
"title": "The Id Schema",
"default": "",
"examples": [
"1"
],
"pattern": "^(.*)$"
},
"type": {
"$id": "#/properties/included/items/1/properties/type",
"type": "string",
"title": "The Type Schema",
"default": "",
"examples": [
"image"
],
"pattern": "^(.*)$"
},
"attributes": {
"$id": "#/properties/included/items/1/properties/attributes",
"type": "object",
"title": "The Attributes Schema",
"required": [
"url",
"main"
],
"properties": {
"url": {
"$id": "#/properties/included/items/1/properties/attributes/properties/url",
"type": "string",
"title": "The Url Schema",
"default": "",
"examples": [
"http://roberts.co/krystina"
],
"pattern": "^(.*)$"
},
"main": {
"$id": "#/properties/included/items/1/properties/attributes/properties/main",
"type": "boolean",
"title": "The Main Schema",
"default": false,
"examples": [
true
]
}
}
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment