232 lines
5.5 KiB
JSON
232 lines
5.5 KiB
JSON
[
|
|
{
|
|
"description": "validation of string-encoded content based on media type",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"contentMediaType": "application/json",
|
|
"$id": "content_0_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid JSON document",
|
|
"data": "{\"foo\": \"bar\"}",
|
|
"schema_id": "content_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an invalid JSON document; validates true",
|
|
"data": "{:}",
|
|
"schema_id": "content_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"schema_id": "content_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "validation of binary string-encoding",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"contentEncoding": "base64",
|
|
"$id": "content_1_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid base64 string",
|
|
"data": "eyJmb28iOiAiYmFyIn0K",
|
|
"schema_id": "content_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an invalid base64 string (% is not a valid character); validates true",
|
|
"data": "eyJmb28iOi%iYmFyIn0K",
|
|
"schema_id": "content_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"schema_id": "content_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "validation of binary-encoded media type documents",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"contentMediaType": "application/json",
|
|
"contentEncoding": "base64",
|
|
"$id": "content_2_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid base64-encoded JSON document",
|
|
"data": "eyJmb28iOiAiYmFyIn0K",
|
|
"schema_id": "content_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "a validly-encoded invalid JSON document; validates true",
|
|
"data": "ezp9Cg==",
|
|
"schema_id": "content_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an invalid base64 string that is valid JSON; validates true",
|
|
"data": "{}",
|
|
"schema_id": "content_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"schema_id": "content_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "validation of binary-encoded media type documents with schema",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"contentMediaType": "application/json",
|
|
"contentEncoding": "base64",
|
|
"contentSchema": {
|
|
"type": "object",
|
|
"required": [
|
|
"foo"
|
|
],
|
|
"properties": {
|
|
"foo": {
|
|
"type": "string"
|
|
},
|
|
"boo": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"$id": "content_3_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "a valid base64-encoded JSON document",
|
|
"data": "eyJmb28iOiAiYmFyIn0K",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "another valid base64-encoded JSON document",
|
|
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an invalid base64-encoded JSON document; validates true",
|
|
"data": "eyJib28iOiAyMH0=",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an empty object as a base64-encoded JSON document; validates true",
|
|
"data": "e30=",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an empty array as a base64-encoded JSON document",
|
|
"data": "W10=",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "a validly-encoded invalid JSON document; validates true",
|
|
"data": "ezp9Cg==",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "an invalid base64 string that is valid JSON; validates true",
|
|
"data": "{}",
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "ignores non-strings",
|
|
"data": 100,
|
|
"schema_id": "content_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |