Schema a now "parsed" into C++-validator-objects in a first step and then validation takes place with these objects. Errors are now handled via a user-provided error-handler allowing the user to collect all errors at once or bail out when a certain threshold is reached. Fixes #36 and #8. One (sub-)schema can now be referenced with different URIs. Fixes #9 JSON schema draft 7 is now supported. Fixes #35
79 lines
2.1 KiB
JSON
79 lines
2.1 KiB
JSON
[
|
|
{
|
|
"description": "propertyNames validation",
|
|
"schema": {
|
|
"propertyNames": {"maxLength": 3}
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "all property names valid",
|
|
"data": {
|
|
"f": {},
|
|
"foo": {}
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "some property names invalid",
|
|
"data": {
|
|
"foo": {},
|
|
"foobar": {}
|
|
},
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "object without properties is valid",
|
|
"data": {},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "ignores arrays",
|
|
"data": [1, 2, 3, 4],
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "ignores strings",
|
|
"data": "foobar",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "ignores other non-objects",
|
|
"data": 12,
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "propertyNames with boolean schema true",
|
|
"schema": {"propertyNames": true},
|
|
"tests": [
|
|
{
|
|
"description": "object with any properties is valid",
|
|
"data": {"foo": 1},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "empty object is valid",
|
|
"data": {},
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "propertyNames with boolean schema false",
|
|
"schema": {"propertyNames": false},
|
|
"tests": [
|
|
{
|
|
"description": "object with any properties is invalid",
|
|
"data": {"foo": 1},
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "empty object is valid",
|
|
"data": {},
|
|
"valid": true
|
|
}
|
|
]
|
|
}
|
|
]
|