1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
use lib '.';
use t::Helper;
# https://github.com/jhthorsen/json-validator/issues/22
validate_ok {foo => 'x'}, 'data://main/test.schema', E('/foo', 'Not in enum list: bar, baz.');
validate_ok {foo => 123}, 'data://main/test.schema', E('/foo', 'Expected string - got number.');
done_testing;
__DATA__
@@ test.schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "test",
"type": "object",
"properties": {
"foo": {"type": "string", "enum": ["bar", "baz"]}
}
}
|