618 lines
12 KiB
JSON
618 lines
12 KiB
JSON
[
|
|
{
|
|
"description": "not",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"type": "integer"
|
|
},
|
|
"$id": "not_0_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "allowed",
|
|
"data": "foo",
|
|
"schema_id": "not_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "disallowed",
|
|
"data": 1,
|
|
"schema_id": "not_0_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "not multiple types",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"type": [
|
|
"integer",
|
|
"boolean"
|
|
]
|
|
},
|
|
"$id": "not_1_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "valid",
|
|
"data": "foo",
|
|
"schema_id": "not_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "mismatch",
|
|
"data": 1,
|
|
"schema_id": "not_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "other mismatch",
|
|
"data": true,
|
|
"schema_id": "not_1_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "not more complex schema",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"type": "object",
|
|
"properties": {
|
|
"foo": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"extensible": true,
|
|
"$id": "not_2_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "match",
|
|
"data": 1,
|
|
"schema_id": "not_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "other match",
|
|
"data": {
|
|
"foo": 1
|
|
},
|
|
"schema_id": "not_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "mismatch",
|
|
"data": {
|
|
"foo": "bar"
|
|
},
|
|
"schema_id": "not_2_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "forbidden property",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"properties": {
|
|
"foo": {
|
|
"not": {}
|
|
}
|
|
},
|
|
"$id": "not_3_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "property present",
|
|
"data": {
|
|
"foo": 1,
|
|
"bar": 2
|
|
},
|
|
"schema_id": "not_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "empty object is valid",
|
|
"data": {},
|
|
"schema_id": "not_3_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "forbid everything with empty schema",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {},
|
|
"$id": "not_4_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "number is invalid",
|
|
"data": 1,
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "string is invalid",
|
|
"data": "foo",
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean true is invalid",
|
|
"data": true,
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean false is invalid",
|
|
"data": false,
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "null is invalid",
|
|
"data": null,
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "object is invalid",
|
|
"data": {
|
|
"foo": "bar"
|
|
},
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "empty object is invalid",
|
|
"data": {},
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "array is invalid",
|
|
"data": [
|
|
"foo"
|
|
],
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "empty array is invalid",
|
|
"data": [],
|
|
"schema_id": "not_4_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "forbid everything with boolean schema true",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": true,
|
|
"$id": "not_5_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "number is invalid",
|
|
"data": 1,
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "string is invalid",
|
|
"data": "foo",
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean true is invalid",
|
|
"data": true,
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean false is invalid",
|
|
"data": false,
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "null is invalid",
|
|
"data": null,
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "object is invalid",
|
|
"data": {
|
|
"foo": "bar"
|
|
},
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "empty object is invalid",
|
|
"data": {},
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "array is invalid",
|
|
"data": [
|
|
"foo"
|
|
],
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "empty array is invalid",
|
|
"data": [],
|
|
"schema_id": "not_5_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "allow everything with boolean schema false",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": false,
|
|
"extensible": true,
|
|
"$id": "not_6_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "number is valid",
|
|
"data": 1,
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "string is valid",
|
|
"data": "foo",
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean true is valid",
|
|
"data": true,
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "boolean false is valid",
|
|
"data": false,
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "null is valid",
|
|
"data": null,
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "object is valid",
|
|
"data": {
|
|
"foo": "bar"
|
|
},
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "empty object is valid",
|
|
"data": {},
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "array is valid",
|
|
"data": [
|
|
"foo"
|
|
],
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "empty array is valid",
|
|
"data": [],
|
|
"schema_id": "not_6_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "double negation",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"not": {}
|
|
},
|
|
"$id": "not_7_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "any value is valid",
|
|
"data": "foo",
|
|
"schema_id": "not_7_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "extensible: true allows extra properties in not",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"type": "integer"
|
|
},
|
|
"extensible": true,
|
|
"$id": "not_8_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "extra property is valid (not integer matches)",
|
|
"data": {
|
|
"foo": 1
|
|
},
|
|
"schema_id": "not_8_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "extensible: false (default) forbids extra properties in not",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"not": {
|
|
"type": "integer"
|
|
},
|
|
"$id": "not_9_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "extra property is invalid due to strictness",
|
|
"data": {
|
|
"foo": 1
|
|
},
|
|
"schema_id": "not_9_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "property next to not (extensible: true)",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"properties": {
|
|
"bar": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"not": {
|
|
"type": "integer"
|
|
},
|
|
"extensible": true,
|
|
"$id": "not_10_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "extra property allowed",
|
|
"data": {
|
|
"bar": "baz",
|
|
"foo": 1
|
|
},
|
|
"schema_id": "not_10_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "property next to not (extensible: false)",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"properties": {
|
|
"bar": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"not": {
|
|
"type": "integer"
|
|
},
|
|
"$id": "not_11_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "extra property forbidden",
|
|
"data": {
|
|
"bar": "baz",
|
|
"foo": 1
|
|
},
|
|
"schema_id": "not_11_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false
|
|
}
|
|
},
|
|
{
|
|
"description": "defined property allowed",
|
|
"data": {
|
|
"bar": "baz"
|
|
},
|
|
"schema_id": "not_11_0",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |