Last active
July 3, 2018 17:19
-
-
Save reitzig/9fd7c1c2718b46bb43dcd3506ec3437a to your computer and use it in GitHub Desktop.
MWE for voxpupuli/json-schema#411
This file contains 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
{ | |
"b": { | |
"c": { | |
"foo": "bar" | |
} | |
} | |
} |
This file contains 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-04/schema#", | |
"title": "Schema A", | |
"type": "object", | |
"properties": { | |
"b": { | |
"$ref": "schemas/more/schemaB.json" | |
} | |
} | |
} |
This file contains 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-04/schema#", | |
"title": "Schema B", | |
"type": "object", | |
"properties": { | |
"c": { | |
"$ref": "schemas/more/schemaC.json" | |
} | |
} | |
} |
This file contains 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-04/schema#", | |
"title": "Schema C", | |
"type": "object", | |
"properties": { | |
"foo": { | |
"type": "string" | |
} | |
} | |
} |
This file contains 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
#!/usr/bin/env ruby | |
require 'json-schema' | |
schemaA = File.read("schemas/stuff/schemaA.json") | |
example = File.read("example.json") | |
puts JSON::Validator.validate(schemaA, example) ? 0 : 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment