jspg checkpoint
This commit is contained in:
@ -1,246 +0,0 @@
|
||||
[
|
||||
{
|
||||
"description": "additionalProperties validates properties not matched by properties",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "schema1",
|
||||
"schemas": {
|
||||
"schema1": {
|
||||
"properties": {
|
||||
"foo": {
|
||||
"type": "string"
|
||||
},
|
||||
"bar": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "defined properties are valid",
|
||||
"data": {
|
||||
"foo": "value",
|
||||
"bar": 123
|
||||
},
|
||||
"schema_id": "schema1",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "additional property matching schema is valid",
|
||||
"data": {
|
||||
"foo": "value",
|
||||
"is_active": true,
|
||||
"hidden": false
|
||||
},
|
||||
"schema_id": "schema1",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "additional property not matching schema is invalid",
|
||||
"data": {
|
||||
"foo": "value",
|
||||
"is_active": 1
|
||||
},
|
||||
"schema_id": "schema1",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "boolean"
|
||||
},
|
||||
"details": {
|
||||
"path": "is_active",
|
||||
"schema": "schema1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true with additionalProperties still validates structure",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "additionalProperties_1_0",
|
||||
"schemas": {
|
||||
"additionalProperties_1_0": {
|
||||
"properties": {
|
||||
"foo": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"extensible": true,
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "additional property matching schema is valid",
|
||||
"data": {
|
||||
"foo": "hello",
|
||||
"count": 5,
|
||||
"age": 42
|
||||
},
|
||||
"schema_id": "additionalProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "additional property not matching schema is invalid despite extensible: true",
|
||||
"data": {
|
||||
"foo": "hello",
|
||||
"count": "five"
|
||||
},
|
||||
"schema_id": "additionalProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "count",
|
||||
"schema": "additionalProperties_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "complex additionalProperties with object and array items",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "schema3",
|
||||
"schemas": {
|
||||
"schema3": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid array of strings",
|
||||
"data": {
|
||||
"type": "my_type",
|
||||
"group_a": [
|
||||
"field1",
|
||||
"field2"
|
||||
],
|
||||
"group_b": [
|
||||
"field3"
|
||||
]
|
||||
},
|
||||
"schema_id": "schema3",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid array of integers",
|
||||
"data": {
|
||||
"type": "my_type",
|
||||
"group_a": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
"schema_id": "schema3",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "string"
|
||||
},
|
||||
"details": {
|
||||
"path": "group_a/0",
|
||||
"schema": "schema3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "string"
|
||||
},
|
||||
"details": {
|
||||
"path": "group_a/1",
|
||||
"schema": "schema3"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid non-array type",
|
||||
"data": {
|
||||
"type": "my_type",
|
||||
"group_a": "field1"
|
||||
},
|
||||
"schema_id": "schema3",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "array"
|
||||
},
|
||||
"details": {
|
||||
"path": "group_a",
|
||||
"schema": "schema3"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -579,19 +579,7 @@
|
||||
"schema_id": "schema_schema1",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_ITEM_VIOLATION",
|
||||
"values": {
|
||||
"index": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "schema_schema1"
|
||||
}
|
||||
}
|
||||
]
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
284
fixtures/dict.json
Normal file
284
fixtures/dict.json
Normal file
@ -0,0 +1,284 @@
|
||||
[
|
||||
{
|
||||
"description": "basic dict type validation",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "dict_basic",
|
||||
"schemas": {
|
||||
"dict_basic": {
|
||||
"type": "dict"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid empty dict",
|
||||
"data": {},
|
||||
"schema_id": "dict_basic",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "valid simple dict",
|
||||
"data": {
|
||||
"key1": "value1",
|
||||
"key2": 123,
|
||||
"key3": true
|
||||
},
|
||||
"schema_id": "dict_basic",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid type - array is not dict",
|
||||
"data": [
|
||||
"a",
|
||||
"b"
|
||||
],
|
||||
"schema_id": "dict_basic",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "dict"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "dict_basic"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid type - string is not dict",
|
||||
"data": "not a dict",
|
||||
"schema_id": "dict_basic",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "dict"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "dict_basic"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "dict keys validation",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "dict_keys",
|
||||
"schemas": {
|
||||
"dict_keys": {
|
||||
"type": "dict",
|
||||
"keys": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z]{3}$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid 3-letter lowercase keys",
|
||||
"data": {
|
||||
"abc": 1,
|
||||
"xyz": "test"
|
||||
},
|
||||
"schema_id": "dict_keys",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid key format",
|
||||
"data": {
|
||||
"abc": 1,
|
||||
"abcd": 2
|
||||
},
|
||||
"schema_id": "dict_keys",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "PATTERN_VIOLATED",
|
||||
"values": {
|
||||
"value": "abcd",
|
||||
"pattern": "^[a-z]{3}$"
|
||||
},
|
||||
"details": {
|
||||
"path": "keys/abcd",
|
||||
"schema": "dict_keys"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "dict items (values) validation",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "dict_items",
|
||||
"schemas": {
|
||||
"dict_items": {
|
||||
"type": "dict",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid integer values",
|
||||
"data": {
|
||||
"a": 1,
|
||||
"b": 100
|
||||
},
|
||||
"schema_id": "dict_items",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid value type",
|
||||
"data": {
|
||||
"a": 1,
|
||||
"b": "string value"
|
||||
},
|
||||
"schema_id": "dict_items",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "b",
|
||||
"schema": "dict_items"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "dict keys and items validation combined",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "dict_combined",
|
||||
"schemas": {
|
||||
"dict_combined": {
|
||||
"type": "dict",
|
||||
"keys": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9]+$"
|
||||
},
|
||||
"items": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid numeric keys and boolean values",
|
||||
"data": {
|
||||
"123": true,
|
||||
"456": false
|
||||
},
|
||||
"schema_id": "dict_combined",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "invalid key and valid value",
|
||||
"data": {
|
||||
"123": true,
|
||||
"abc": false
|
||||
},
|
||||
"schema_id": "dict_combined",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "PATTERN_VIOLATED",
|
||||
"values": {
|
||||
"pattern": "^[0-9]+$",
|
||||
"value": "abc"
|
||||
},
|
||||
"details": {
|
||||
"path": "keys/abc",
|
||||
"schema": "dict_combined"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "valid key and invalid value",
|
||||
"data": {
|
||||
"123": "not a boolean"
|
||||
},
|
||||
"schema_id": "dict_combined",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "boolean"
|
||||
},
|
||||
"details": {
|
||||
"path": "123",
|
||||
"schema": "dict_combined"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -213,603 +213,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "items and subitems",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_3_0",
|
||||
"schemas": {
|
||||
"items_3_0": {
|
||||
"type": "array",
|
||||
"items": false,
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "item"
|
||||
},
|
||||
{
|
||||
"type": "item"
|
||||
},
|
||||
{
|
||||
"type": "item"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "item",
|
||||
"schemas": {
|
||||
"item": {
|
||||
"type": "array",
|
||||
"items": false,
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "sub-item"
|
||||
},
|
||||
{
|
||||
"type": "sub-item"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sub-item",
|
||||
"schemas": {
|
||||
"sub-item": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"foo"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid items",
|
||||
"data": [
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "too many items",
|
||||
"data": [
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "3",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "too many sub-items",
|
||||
"data": [
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "0/2",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "wrong item",
|
||||
"data": [
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "array"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "wrong sub-item",
|
||||
"data": [
|
||||
[
|
||||
{},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
},
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "REQUIRED_FIELD_MISSING",
|
||||
"values": {
|
||||
"field_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "2/1/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "fewer items is invalid",
|
||||
"data": [
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"foo": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"schema_id": "items_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "0/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "1/0/foo",
|
||||
"schema": "items_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "nested items",
|
||||
"database": {
|
||||
@ -1021,282 +424,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prefixItems with no additional items allowed",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_5_0",
|
||||
"schemas": {
|
||||
"items_5_0": {
|
||||
"prefixItems": [
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
],
|
||||
"items": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "empty array",
|
||||
"data": [],
|
||||
"schema_id": "items_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "fewer number of items present (1)",
|
||||
"data": [
|
||||
1
|
||||
],
|
||||
"schema_id": "items_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "fewer number of items present (2)",
|
||||
"data": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"schema_id": "items_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "equal number of items present",
|
||||
"data": [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"schema_id": "items_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "additional items are not permitted",
|
||||
"data": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"schema_id": "items_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "3",
|
||||
"schema": "items_5_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "items does not look in applicators, valid case",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_6_0",
|
||||
"schemas": {
|
||||
"items_6_0": {
|
||||
"allOf": [
|
||||
{
|
||||
"prefixItems": [
|
||||
{
|
||||
"minimum": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"items": {
|
||||
"minimum": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "prefixItems in allOf does not constrain items, invalid case",
|
||||
"data": [
|
||||
3,
|
||||
5
|
||||
],
|
||||
"schema_id": "items_6_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "MINIMUM_VIOLATED",
|
||||
"values": {
|
||||
"limit": "5",
|
||||
"value": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "items_6_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "prefixItems in allOf does not constrain items, valid case",
|
||||
"data": [
|
||||
5,
|
||||
5
|
||||
],
|
||||
"schema_id": "items_6_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prefixItems validation adjusts the starting index for items",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_7_0",
|
||||
"schemas": {
|
||||
"items_7_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid items",
|
||||
"data": [
|
||||
"x",
|
||||
2,
|
||||
3
|
||||
],
|
||||
"schema_id": "items_7_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "wrong type of second item",
|
||||
"data": [
|
||||
"x",
|
||||
"y"
|
||||
],
|
||||
"schema_id": "items_7_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "1",
|
||||
"schema": "items_7_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "items with heterogeneous array",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_8_0",
|
||||
"schemas": {
|
||||
"items_8_0": {
|
||||
"prefixItems": [
|
||||
{}
|
||||
],
|
||||
"items": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "heterogeneous invalid instance",
|
||||
"data": [
|
||||
"foo",
|
||||
"bar",
|
||||
37
|
||||
],
|
||||
"schema_id": "items_8_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "1",
|
||||
"schema": "items_8_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "2",
|
||||
"schema": "items_8_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "valid instance",
|
||||
"data": [
|
||||
null
|
||||
],
|
||||
"schema_id": "items_8_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "items with null instance elements",
|
||||
"database": {
|
||||
@ -1460,56 +587,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "array: strict array",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "items_13_0",
|
||||
"schemas": {
|
||||
"items_13_0": {
|
||||
"type": "array",
|
||||
"extensible": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "empty array is valid",
|
||||
"data": [],
|
||||
"schema_id": "items_13_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "array with items is invalid (strict)",
|
||||
"data": [
|
||||
1
|
||||
],
|
||||
"schema_id": "items_13_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_ITEM_VIOLATION",
|
||||
"values": {
|
||||
"index": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "items_13_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "array: items extensible",
|
||||
"database": {
|
||||
|
||||
@ -7,8 +7,7 @@
|
||||
"name": "maxItems_0_0",
|
||||
"schemas": {
|
||||
"maxItems_0_0": {
|
||||
"maxItems": 2,
|
||||
"extensible": true
|
||||
"maxItems": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,8 +82,7 @@
|
||||
"name": "maxItems_1_0",
|
||||
"schemas": {
|
||||
"maxItems_1_0": {
|
||||
"maxItems": 2,
|
||||
"extensible": true
|
||||
"maxItems": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,8 +136,7 @@
|
||||
"name": "maxItems_2_0",
|
||||
"schemas": {
|
||||
"maxItems_2_0": {
|
||||
"maxItems": 2,
|
||||
"extensible": true
|
||||
"maxItems": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,7 @@
|
||||
"name": "minItems_0_0",
|
||||
"schemas": {
|
||||
"minItems_0_0": {
|
||||
"minItems": 1,
|
||||
"extensible": true
|
||||
"minItems": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,8 +78,7 @@
|
||||
"name": "minItems_1_0",
|
||||
"schemas": {
|
||||
"minItems_1_0": {
|
||||
"minItems": 1,
|
||||
"extensible": true
|
||||
"minItems": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,580 +0,0 @@
|
||||
[
|
||||
{
|
||||
"description": "patternProperties validates properties matching a regex",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_0_0",
|
||||
"schemas": {
|
||||
"patternProperties_0_0": {
|
||||
"patternProperties": {
|
||||
"f.*o": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"items": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "a single valid match is valid",
|
||||
"data": {
|
||||
"foo": 1
|
||||
},
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "multiple valid matches is valid",
|
||||
"data": {
|
||||
"foo": 1,
|
||||
"foooooo": 2
|
||||
},
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "a single invalid match is invalid",
|
||||
"data": {
|
||||
"foo": "bar",
|
||||
"fooooo": 2
|
||||
},
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "foo",
|
||||
"schema": "patternProperties_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "multiple invalid matches is invalid",
|
||||
"data": {
|
||||
"foo": "bar",
|
||||
"foooooo": "baz"
|
||||
},
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "foo",
|
||||
"schema": "patternProperties_0_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "foooooo",
|
||||
"schema": "patternProperties_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "ignores arrays",
|
||||
"data": [
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "ignores strings",
|
||||
"data": "foo",
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "ignores other non-objects",
|
||||
"data": 12,
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "extra property not matching pattern is INVALID (strict by default)",
|
||||
"data": {
|
||||
"foo": 1,
|
||||
"extra": 2
|
||||
},
|
||||
"schema_id": "patternProperties_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "extra"
|
||||
},
|
||||
"details": {
|
||||
"path": "extra",
|
||||
"schema": "patternProperties_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "multiple simultaneous patternProperties are validated",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_1_0",
|
||||
"schemas": {
|
||||
"patternProperties_1_0": {
|
||||
"patternProperties": {
|
||||
"a*": {
|
||||
"type": "integer"
|
||||
},
|
||||
"aaa*": {
|
||||
"maximum": 20
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "a single valid match is valid",
|
||||
"data": {
|
||||
"a": 21
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "a simultaneous match is valid",
|
||||
"data": {
|
||||
"aaaa": 18
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "multiple matches is valid",
|
||||
"data": {
|
||||
"a": 21,
|
||||
"aaaa": 18
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "an invalid due to one is invalid",
|
||||
"data": {
|
||||
"a": "bar"
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "a",
|
||||
"schema": "patternProperties_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "an invalid due to the other is invalid",
|
||||
"data": {
|
||||
"aaaa": 31
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "31",
|
||||
"limit": "20"
|
||||
},
|
||||
"details": {
|
||||
"path": "aaaa",
|
||||
"schema": "patternProperties_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "an invalid due to both is invalid",
|
||||
"data": {
|
||||
"aaa": "foo",
|
||||
"aaaa": 31
|
||||
},
|
||||
"schema_id": "patternProperties_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "aaa",
|
||||
"schema": "patternProperties_1_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"limit": "20",
|
||||
"value": "31"
|
||||
},
|
||||
"details": {
|
||||
"path": "aaaa",
|
||||
"schema": "patternProperties_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "regexes are not anchored by default and are case sensitive",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_2_0",
|
||||
"schemas": {
|
||||
"patternProperties_2_0": {
|
||||
"patternProperties": {
|
||||
"[0-9]{2,}": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"X_": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "non recognized members are ignored",
|
||||
"data": {
|
||||
"answer 1": "42"
|
||||
},
|
||||
"schema_id": "patternProperties_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "recognized members are accounted for",
|
||||
"data": {
|
||||
"a31b": null
|
||||
},
|
||||
"schema_id": "patternProperties_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "boolean"
|
||||
},
|
||||
"details": {
|
||||
"path": "a31b",
|
||||
"schema": "patternProperties_2_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "regexes are case sensitive",
|
||||
"data": {
|
||||
"a_x_3": 3
|
||||
},
|
||||
"schema_id": "patternProperties_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "regexes are case sensitive, 2",
|
||||
"data": {
|
||||
"a_X_3": 3
|
||||
},
|
||||
"schema_id": "patternProperties_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "string"
|
||||
},
|
||||
"details": {
|
||||
"path": "a_X_3",
|
||||
"schema": "patternProperties_2_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "patternProperties with boolean schemas",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_3_0",
|
||||
"schemas": {
|
||||
"patternProperties_3_0": {
|
||||
"patternProperties": {
|
||||
"f.*": true,
|
||||
"b.*": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "object with property matching schema true is valid",
|
||||
"data": {
|
||||
"foo": 1
|
||||
},
|
||||
"schema_id": "patternProperties_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "object with property matching schema false is invalid",
|
||||
"data": {
|
||||
"bar": 2
|
||||
},
|
||||
"schema_id": "patternProperties_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "bar",
|
||||
"schema": "patternProperties_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "object with both properties is invalid",
|
||||
"data": {
|
||||
"foo": 1,
|
||||
"bar": 2
|
||||
},
|
||||
"schema_id": "patternProperties_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "bar",
|
||||
"schema": "patternProperties_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "object with a property matching both true and false is invalid",
|
||||
"data": {
|
||||
"foobar": 1
|
||||
},
|
||||
"schema_id": "patternProperties_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "foobar",
|
||||
"schema": "patternProperties_3_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "empty object is valid",
|
||||
"data": {},
|
||||
"schema_id": "patternProperties_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "patternProperties with null valued instance properties",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_4_0",
|
||||
"schemas": {
|
||||
"patternProperties_4_0": {
|
||||
"patternProperties": {
|
||||
"^.*bar$": {
|
||||
"type": "null"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "allows null values",
|
||||
"data": {
|
||||
"foobar": null
|
||||
},
|
||||
"schema_id": "patternProperties_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true allows extra properties NOT matching pattern",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "patternProperties_5_0",
|
||||
"schemas": {
|
||||
"patternProperties_5_0": {
|
||||
"patternProperties": {
|
||||
"f.*o": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "extra property not matching pattern is valid",
|
||||
"data": {
|
||||
"bar": 1
|
||||
},
|
||||
"schema_id": "patternProperties_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "property matching pattern MUST still be valid",
|
||||
"data": {
|
||||
"foo": "invalid string"
|
||||
},
|
||||
"schema_id": "patternProperties_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "foo",
|
||||
"schema": "patternProperties_5_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -1,324 +0,0 @@
|
||||
[
|
||||
{
|
||||
"description": "a schema given for prefixItems",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "prefixItems_0_0",
|
||||
"schemas": {
|
||||
"prefixItems_0_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "correct types",
|
||||
"data": [
|
||||
1,
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "wrong types",
|
||||
"data": [
|
||||
"foo",
|
||||
1
|
||||
],
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "integer"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "INVALID_TYPE",
|
||||
"values": {
|
||||
"expected": "string"
|
||||
},
|
||||
"details": {
|
||||
"path": "1",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "incomplete array of items",
|
||||
"data": [
|
||||
1
|
||||
],
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "array with additional items (invalid due to strictness)",
|
||||
"data": [
|
||||
1,
|
||||
"foo",
|
||||
true
|
||||
],
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_ITEM_VIOLATION",
|
||||
"values": {
|
||||
"index": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "2",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "empty array",
|
||||
"data": [],
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "JavaScript pseudo-array is valid (invalid due to strict object validation)",
|
||||
"data": {
|
||||
"0": "invalid",
|
||||
"1": "valid",
|
||||
"length": 2
|
||||
},
|
||||
"schema_id": "prefixItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "0",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "1",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "length"
|
||||
},
|
||||
"details": {
|
||||
"path": "length",
|
||||
"schema": "prefixItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prefixItems with boolean schemas",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "prefixItems_1_0",
|
||||
"schemas": {
|
||||
"prefixItems_1_0": {
|
||||
"prefixItems": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "array with one item is valid",
|
||||
"data": [
|
||||
1
|
||||
],
|
||||
"schema_id": "prefixItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "array with two items is invalid",
|
||||
"data": [
|
||||
1,
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "prefixItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "1",
|
||||
"schema": "prefixItems_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "empty array is valid",
|
||||
"data": [],
|
||||
"schema_id": "prefixItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "additional items are allowed by default",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "prefixItems_2_0",
|
||||
"schemas": {
|
||||
"prefixItems_2_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "only the first item is validated",
|
||||
"data": [
|
||||
1,
|
||||
"foo",
|
||||
false
|
||||
],
|
||||
"schema_id": "prefixItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "prefixItems with null instance elements",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "prefixItems_3_0",
|
||||
"schemas": {
|
||||
"prefixItems_3_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "allows null elements",
|
||||
"data": [
|
||||
null
|
||||
],
|
||||
"schema_id": "prefixItems_3_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true allows extra items with prefixItems",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "prefixItems_4_0",
|
||||
"schemas": {
|
||||
"prefixItems_4_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "extra item is valid",
|
||||
"data": [
|
||||
1,
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "prefixItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -316,536 +316,6 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique array of more than two arrays is invalid",
|
||||
"data": [
|
||||
[
|
||||
"foo"
|
||||
],
|
||||
[
|
||||
"bar"
|
||||
],
|
||||
[
|
||||
"foo"
|
||||
]
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "1 and true are unique",
|
||||
"data": [
|
||||
1,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "0 and false are unique",
|
||||
"data": [
|
||||
0,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[1] and [true] are unique",
|
||||
"data": [
|
||||
[
|
||||
1
|
||||
],
|
||||
[
|
||||
true
|
||||
]
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[0] and [false] are unique",
|
||||
"data": [
|
||||
[
|
||||
0
|
||||
],
|
||||
[
|
||||
false
|
||||
]
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "nested [1] and [true] are unique",
|
||||
"data": [
|
||||
[
|
||||
[
|
||||
1
|
||||
],
|
||||
"foo"
|
||||
],
|
||||
[
|
||||
[
|
||||
true
|
||||
],
|
||||
"foo"
|
||||
]
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "nested [0] and [false] are unique",
|
||||
"data": [
|
||||
[
|
||||
[
|
||||
0
|
||||
],
|
||||
"foo"
|
||||
],
|
||||
[
|
||||
[
|
||||
false
|
||||
],
|
||||
"foo"
|
||||
]
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "unique heterogeneous types are valid",
|
||||
"data": [
|
||||
{},
|
||||
[
|
||||
1
|
||||
],
|
||||
true,
|
||||
null,
|
||||
1,
|
||||
"{}"
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique heterogeneous types are invalid",
|
||||
"data": [
|
||||
{},
|
||||
[
|
||||
1
|
||||
],
|
||||
true,
|
||||
null,
|
||||
{},
|
||||
1
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "different objects are unique",
|
||||
"data": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 2
|
||||
},
|
||||
{
|
||||
"a": 2,
|
||||
"b": 1
|
||||
}
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "objects are non-unique despite key order",
|
||||
"data": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 2
|
||||
},
|
||||
{
|
||||
"b": 2,
|
||||
"a": 1
|
||||
}
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_0_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "{\"a\": false} and {\"a\": 0} are unique",
|
||||
"data": [
|
||||
{
|
||||
"a": false
|
||||
},
|
||||
{
|
||||
"a": 0
|
||||
}
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "{\"a\": true} and {\"a\": 1} are unique",
|
||||
"data": [
|
||||
{
|
||||
"a": true
|
||||
},
|
||||
{
|
||||
"a": 1
|
||||
}
|
||||
],
|
||||
"schema_id": "uniqueItems_0_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "uniqueItems with an array of items",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "uniqueItems_1_0",
|
||||
"schemas": {
|
||||
"uniqueItems_1_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"uniqueItems": true,
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "[false, true] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, false] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[false, false] from items array is not valid",
|
||||
"data": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, true] from items array is not valid",
|
||||
"data": [
|
||||
true,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "unique array extended from [false, true] is valid",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "unique array extended from [true, false] is valid",
|
||||
"data": [
|
||||
true,
|
||||
false,
|
||||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique array extended from [false, true] is not valid",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
"foo",
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique array extended from [true, false] is not valid",
|
||||
"data": [
|
||||
true,
|
||||
false,
|
||||
"foo",
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "uniqueItems_1_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_1_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "uniqueItems with an array of items and additionalItems=false",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "uniqueItems_2_0",
|
||||
"schemas": {
|
||||
"uniqueItems_2_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"uniqueItems": true,
|
||||
"items": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "[false, true] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, false] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[false, false] from items array is not valid",
|
||||
"data": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_2_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, true] from items array is not valid",
|
||||
"data": [
|
||||
true,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "UNIQUE_ITEMS_VIOLATED",
|
||||
"details": {
|
||||
"path": "",
|
||||
"schema": "uniqueItems_2_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "extra items are invalid even if unique",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
null
|
||||
],
|
||||
"schema_id": "uniqueItems_2_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "2",
|
||||
"schema": "uniqueItems_2_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1099,232 +569,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "uniqueItems=false with an array of items",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "uniqueItems_4_0",
|
||||
"schemas": {
|
||||
"uniqueItems_4_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"uniqueItems": false,
|
||||
"extensible": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "[false, true] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, false] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[false, false] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, true] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "unique array extended from [false, true] is valid",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "unique array extended from [true, false] is valid",
|
||||
"data": [
|
||||
true,
|
||||
false,
|
||||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique array extended from [false, true] is valid",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
"foo",
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "non-unique array extended from [true, false] is valid",
|
||||
"data": [
|
||||
true,
|
||||
false,
|
||||
"foo",
|
||||
"foo"
|
||||
],
|
||||
"schema_id": "uniqueItems_4_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "uniqueItems=false with an array of items and additionalItems=false",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "uniqueItems_5_0",
|
||||
"schemas": {
|
||||
"uniqueItems_5_0": {
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"uniqueItems": false,
|
||||
"items": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "[false, true] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, false] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[false, false] from items array is valid",
|
||||
"data": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"schema_id": "uniqueItems_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "[true, true] from items array is valid",
|
||||
"data": [
|
||||
true,
|
||||
true
|
||||
],
|
||||
"schema_id": "uniqueItems_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "extra items are invalid even if unique",
|
||||
"data": [
|
||||
false,
|
||||
true,
|
||||
null
|
||||
],
|
||||
"schema_id": "uniqueItems_5_0",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "FALSE_SCHEMA",
|
||||
"details": {
|
||||
"path": "2",
|
||||
"schema": "uniqueItems_5_0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true allows extra items in uniqueItems",
|
||||
"database": {
|
||||
|
||||
Reference in New Issue
Block a user