Last active
December 23, 2015 02:58
-
-
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/
This file contains hidden or 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
{ | |
"$schema": "#/subschema1", | |
"name": "n", | |
"y": { | |
"x": "abc" | |
}, | |
} |
This file contains hidden or 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
{ | |
"$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