Files
jspg/tests/fixtures/anyOf.json

356 lines
9.5 KiB
JSON

[
{
"description": "anyOf",
"database": {
"schemas": [
{
"anyOf": [
{
"type": "integer"
},
{
"minimum": 2
}
],
"$id": "anyOf_0_0"
}
]
},
"tests": [
{
"description": "first anyOf valid",
"data": 1,
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "second anyOf valid",
"data": 2.5,
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "both anyOf valid",
"data": 3,
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "neither anyOf valid",
"data": 1.5,
"valid": false,
"schema_id": "anyOf_0_0"
}
]
},
{
"description": "anyOf with base schema",
"database": {
"schemas": [
{
"type": "string",
"anyOf": [
{
"maxLength": 2
},
{
"minLength": 4
}
],
"$id": "anyOf_1_0"
}
]
},
"tests": [
{
"description": "mismatch base schema",
"data": 3,
"valid": false,
"schema_id": "anyOf_1_0"
},
{
"description": "one anyOf valid",
"data": "foobar",
"valid": true,
"schema_id": "anyOf_1_0"
},
{
"description": "both anyOf invalid",
"data": "foo",
"valid": false,
"schema_id": "anyOf_1_0"
}
]
},
{
"description": "anyOf with boolean schemas, all true",
"database": {
"schemas": [
{
"anyOf": [
true,
true
],
"$id": "anyOf_2_0"
}
]
},
"tests": [
{
"description": "any value is valid",
"data": "foo",
"valid": true,
"schema_id": "anyOf_2_0"
}
]
},
{
"description": "anyOf with boolean schemas, some true",
"database": {
"schemas": [
{
"anyOf": [
true,
false
],
"$id": "anyOf_3_0"
}
]
},
"tests": [
{
"description": "any value is valid",
"data": "foo",
"valid": true,
"schema_id": "anyOf_3_0"
}
]
},
{
"description": "anyOf with boolean schemas, all false",
"database": {
"schemas": [
{
"anyOf": [
false,
false
],
"$id": "anyOf_4_0"
}
]
},
"tests": [
{
"description": "any value is invalid",
"data": "foo",
"valid": false,
"schema_id": "anyOf_4_0"
}
]
},
{
"description": "anyOf complex types",
"database": {
"schemas": [
{
"anyOf": [
{
"properties": {
"bar": {
"type": "integer"
}
},
"required": [
"bar"
]
},
{
"properties": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
]
}
],
"$id": "anyOf_5_0"
}
]
},
"tests": [
{
"description": "first anyOf valid (complex)",
"data": {
"bar": 2
},
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "second anyOf valid (complex)",
"data": {
"foo": "baz"
},
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "both anyOf valid (complex)",
"data": {
"foo": "baz",
"bar": 2
},
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "neither anyOf valid (complex)",
"data": {
"foo": 2,
"bar": "quux"
},
"valid": false,
"schema_id": "anyOf_5_0"
}
]
},
{
"description": "anyOf with one empty schema",
"database": {
"schemas": [
{
"anyOf": [
{
"type": "number"
},
{}
],
"$id": "anyOf_6_0"
}
]
},
"tests": [
{
"description": "string is valid",
"data": "foo",
"valid": true,
"schema_id": "anyOf_6_0"
},
{
"description": "number is valid",
"data": 123,
"valid": true,
"schema_id": "anyOf_6_0"
}
]
},
{
"description": "nested anyOf, to check validation semantics",
"database": {
"schemas": [
{
"anyOf": [
{
"anyOf": [
{
"type": "null"
}
]
}
],
"$id": "anyOf_7_0"
}
]
},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true,
"schema_id": "anyOf_7_0"
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false,
"schema_id": "anyOf_7_0"
}
]
},
{
"description": "extensible: true allows extra properties in anyOf",
"database": {
"schemas": [
{
"anyOf": [
{
"type": "integer"
},
{
"minimum": 2
}
],
"extensible": true,
"$id": "anyOf_8_0"
}
]
},
"tests": [
{
"description": "extra property is valid",
"data": {
"foo": 1
},
"valid": true,
"schema_id": "anyOf_8_0"
}
]
},
{
"description": "strict by default with anyOf properties",
"database": {
"schemas": [
{
"anyOf": [
{
"properties": {
"foo": {
"const": 1
}
}
},
{
"properties": {
"bar": {
"const": 2
}
}
}
],
"$id": "anyOf_9_0"
}
]
},
"tests": [
{
"description": "valid match (foo)",
"data": {
"foo": 1
},
"valid": true,
"schema_id": "anyOf_9_0"
},
{
"description": "fails on extra property z explicitly",
"data": {
"foo": 1,
"z": 3
},
"valid": false,
"schema_id": "anyOf_9_0"
}
]
}
]