164 lines
4.2 KiB
JSON
164 lines
4.2 KiB
JSON
[
|
|
{
|
|
"description": "anyOf with boolean schemas, all true",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
true,
|
|
true
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "any value is valid",
|
|
"data": "foo",
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "anyOf with boolean schemas, some true",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
true,
|
|
false
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "any value is valid",
|
|
"data": "foo",
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "anyOf with boolean schemas, all false",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
false,
|
|
false
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "any value is invalid",
|
|
"data": "foo",
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "anyOf complex types",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
{
|
|
"properties": {
|
|
"bar": {
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"bar"
|
|
]
|
|
},
|
|
{
|
|
"properties": {
|
|
"foo": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"foo"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "first anyOf valid (complex)",
|
|
"data": {
|
|
"bar": 2
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "second anyOf valid (complex)",
|
|
"data": {
|
|
"foo": "baz"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "both anyOf valid (complex)",
|
|
"data": {
|
|
"foo": "baz",
|
|
"bar": 2
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "neither anyOf valid (complex)",
|
|
"data": {
|
|
"foo": 2,
|
|
"bar": "quux"
|
|
},
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "anyOf with one empty schema",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
{
|
|
"type": "number"
|
|
},
|
|
{}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "string is valid",
|
|
"data": "foo",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "number is valid",
|
|
"data": 123,
|
|
"valid": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "nested anyOf, to check validation semantics",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"anyOf": [
|
|
{
|
|
"anyOf": [
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "null is valid",
|
|
"data": null,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "anything non-null is invalid",
|
|
"data": 123,
|
|
"valid": false
|
|
}
|
|
]
|
|
}
|
|
] |