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
61 lines
1.5 KiB
JSON
61 lines
1.5 KiB
JSON
[
|
|
{
|
|
"description": "by int",
|
|
"schema": {"multipleOf": 2},
|
|
"tests": [
|
|
{
|
|
"description": "int by int",
|
|
"data": 10,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "int by int fail",
|
|
"data": 7,
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "ignores non-numbers",
|
|
"data": "foo",
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "by number",
|
|
"schema": {"multipleOf": 1.5},
|
|
"tests": [
|
|
{
|
|
"description": "zero is multiple of anything",
|
|
"data": 0,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "4.5 is multiple of 1.5",
|
|
"data": 4.5,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "35 is not multiple of 1.5",
|
|
"data": 35,
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "by small number",
|
|
"schema": {"multipleOf": 0.0001},
|
|
"tests": [
|
|
{
|
|
"description": "0.0075 is multiple of 0.0001",
|
|
"data": 0.0075,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "0.00751 is not multiple of 0.0001",
|
|
"data": 0.00751,
|
|
"valid": false
|
|
}
|
|
]
|
|
}
|
|
]
|