ajv/spec/tests/issues/27_recursive_reference.json

117 lines
2.6 KiB
JSON

[
{
"description": "Recursive reference (#27)",
"schemas": [
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "testrec_1",
"type": "object",
"properties": {
"layout": {
"$id": "layout",
"type": "object",
"properties": {
"layout": { "type": "string" },
"panels": {
"type": "array",
"items": {
"anyOf": [
{ "type": "string" },
{ "$ref": "layout" }
]
}
}
},
"required": [
"layout",
"panels"
]
}
}
},
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "testrec_2",
"type": "object",
"properties": {
"layout": {
"$id": "layout",
"type": "object",
"properties": {
"layout": { "type": "string" },
"panels": {
"type": "array",
"items": {
"anyOf": [
{ "type": "string" },
{ "$ref": "layout" }
]
}
}
},
"required": [
"layout",
"panels"
]
}
}
}
],
"tests": [
{
"description": "empty object is valid",
"data": {},
"valid": true
},
{
"description": "valid object",
"data": {
"layout": {
"layout": "test1",
"panels": [
"panel1",
{
"layout": "test2",
"panels": [
"panel2",
{
"layout": "test3",
"panels": [
"panel3"
]
}
]
}
]
}
},
"valid": true
},
{
"description": "invalid object",
"data": {
"layout": {
"layout": "test1",
"panels": [
"panel1",
{
"layout": "test2",
"panels": [
"panel2",
{
"layout": "test3",
"panels": [
3
]
}
]
}
]
}
},
"valid": false
}
]
}
]