1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
use Mojo::Base -strict;
use Test::More;
use Mojo::JSON;
use JSON::Validator;
my $validator = JSON::Validator->new->schema('data://main/spec.json');
my @errors = $validator->validate(
{prop1 => Mojo::JSON->false, prop2 => Mojo::JSON->false});
is "@errors", "";
done_testing;
__DATA__
@@ spec.json
{
"type": "object",
"properties": {
"prop1": {
"$ref": "data://main/defs.json#/definitions/item"
},
"prop2": {
"$ref": "data://main/defs.json#/definitions/item"
}
}
}
@@ defs.json
{
"definitions": {
"item": {
"oneOf": [
{"type": "object"},
{"type": "boolean"}
]
}
}
}
|