ES-DE/external/rapidjson/bin/jsonschema/tests/draft3/extends.json

95 lines
2.5 KiB
JSON
Raw Normal View History

[
{
"description": "extends",
"schema": {
"properties": {"bar": {"type": "integer", "required": true}},
"extends": {
"properties": {
"foo": {"type": "string", "required": true}
}
}
},
"tests": [
{
"description": "extends",
"data": {"foo": "baz", "bar": 2},
"valid": true
},
{
"description": "mismatch extends",
"data": {"foo": "baz"},
"valid": false
},
{
"description": "mismatch extended",
"data": {"bar": 2},
"valid": false
},
{
"description": "wrong type",
"data": {"foo": "baz", "bar": "quux"},
"valid": false
}
]
},
{
"description": "multiple extends",
"schema": {
"properties": {"bar": {"type": "integer", "required": true}},
"extends" : [
{
"properties": {
"foo": {"type": "string", "required": true}
}
},
{
"properties": {
"baz": {"type": "null", "required": true}
}
}
]
},
"tests": [
{
"description": "valid",
"data": {"foo": "quux", "bar": 2, "baz": null},
"valid": true
},
{
"description": "mismatch first extends",
"data": {"bar": 2, "baz": null},
"valid": false
},
{
"description": "mismatch second extends",
"data": {"foo": "quux", "bar": 2},
"valid": false
},
{
"description": "mismatch both",
"data": {"bar": 2},
"valid": false
}
]
},
{
"description": "extends simple types",
"schema": {
"minimum": 20,
"extends": {"maximum": 30}
},
"tests": [
{
"description": "valid",
"data": 25,
"valid": true
},
{
"description": "mismatch extends",
"data": 35,
"valid": false
}
]
}
]