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
78 lines
2.2 KiB
JSON
78 lines
2.2 KiB
JSON
[
|
|
{
|
|
"description": "validation of string-encoded content based on media type",
|
|
"schema": {
|
|
"contentMediaType": "application/json"
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid JSON document",
|
|
"data": "{\"foo\": \"bar\"}",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "an invalid JSON document",
|
|
"data": "{:}",
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "validation of binary string-encoding",
|
|
"schema": {
|
|
"contentEncoding": "base64"
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid base64 string",
|
|
"data": "eyJmb28iOiAiYmFyIn0K",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "an invalid base64 string (% is not a valid character)",
|
|
"data": "eyJmb28iOi%iYmFyIn0K",
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "validation of binary-encoded media type documents",
|
|
"schema": {
|
|
"contentMediaType": "application/json",
|
|
"contentEncoding": "base64"
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid base64-encoded JSON document",
|
|
"data": "eyJmb28iOiAiYmFyIn0K",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "a validly-encoded invalid JSON document",
|
|
"data": "ezp9Cg==",
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "an invalid base64 string that is valid JSON",
|
|
"data": "{}",
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"valid": true
|
|
}
|
|
]
|
|
}
|
|
]
|