Skip to content

Instantly share code, notes, and snippets.

@TakashiSasaki
Last active December 23, 2015 02:58
Show Gist options
  • Save TakashiSasaki/6570127 to your computer and use it in GitHub Desktop.
Save TakashiSasaki/6570127 to your computer and use it in GitHub Desktop.
JSONスキーマでサブスキーマを扱ってみた。 http://jsonschemalint.com/ で検証済みだが、これはdraft v3に準拠しているのでちょっと古い。現在はdraft v4。 https://datatracker.ietf.org/doc/draft-zyp-json-schema/
{
"$schema": "#/subschema1",
"name": "n",
"y": {
"x": "abc"
},
}
{
"$schema": "http://json-schema.org/draft-03/schema#",
"id": "https://gist.github.com/TakashiSasaki/6568391/raw/tags-labels-folders.schema.json#",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"y": {
"type": "object",
"oneOf": [
{
"$ref": "#subschema1"
}
],
"required": true
},
},
"title": "tt",
"subschema1": {
"id": "ss1",
"title": "t1",
"type": "object",
"properties": {
"x": {
"type": "string",
"required": true
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment