247 lines
7.1 KiB
JSON
247 lines
7.1 KiB
JSON
[
|
|
{
|
|
"description": "merging: properties accumulate",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"$id": "base_0",
|
|
"properties": {
|
|
"base_prop": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"$ref": "base_0",
|
|
"properties": {
|
|
"child_prop": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"$id": "merge_0_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "valid with both properties",
|
|
"data": {
|
|
"base_prop": "a",
|
|
"child_prop": "b"
|
|
},
|
|
"valid": true,
|
|
"schema_id": "merge_0_0"
|
|
},
|
|
{
|
|
"description": "invalid when base property has wrong type",
|
|
"data": {
|
|
"base_prop": 1,
|
|
"child_prop": "b"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "TYPE_MISMATCH",
|
|
"path": "/base_prop"
|
|
}
|
|
],
|
|
"schema_id": "merge_0_0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "merging: required fields accumulate",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"$id": "base_1",
|
|
"properties": {
|
|
"a": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"a"
|
|
]
|
|
},
|
|
{
|
|
"$ref": "base_1",
|
|
"properties": {
|
|
"b": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"b"
|
|
],
|
|
"$id": "merge_1_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "valid when both present",
|
|
"data": {
|
|
"a": "ok",
|
|
"b": "ok"
|
|
},
|
|
"valid": true,
|
|
"schema_id": "merge_1_0"
|
|
},
|
|
{
|
|
"description": "invalid when base required missing",
|
|
"data": {
|
|
"b": "ok"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "REQUIRED_FIELD_MISSING",
|
|
"path": "/a"
|
|
}
|
|
],
|
|
"schema_id": "merge_1_0"
|
|
},
|
|
{
|
|
"description": "invalid when child required missing",
|
|
"data": {
|
|
"a": "ok"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "REQUIRED_FIELD_MISSING",
|
|
"path": "/b"
|
|
}
|
|
],
|
|
"schema_id": "merge_1_0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "merging: dependencies accumulate",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"$id": "base_2",
|
|
"properties": {
|
|
"trigger": {
|
|
"type": "string"
|
|
},
|
|
"base_dep": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"trigger": [
|
|
"base_dep"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"$ref": "base_2",
|
|
"properties": {
|
|
"child_dep": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"trigger": [
|
|
"child_dep"
|
|
]
|
|
},
|
|
"$id": "merge_2_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "valid with all deps",
|
|
"data": {
|
|
"trigger": "go",
|
|
"base_dep": "ok",
|
|
"child_dep": "ok"
|
|
},
|
|
"valid": true,
|
|
"schema_id": "merge_2_0"
|
|
},
|
|
{
|
|
"description": "invalid missing base dep",
|
|
"data": {
|
|
"trigger": "go",
|
|
"child_dep": "ok"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/base_dep"
|
|
}
|
|
],
|
|
"schema_id": "merge_2_0"
|
|
},
|
|
{
|
|
"description": "invalid missing child dep",
|
|
"data": {
|
|
"trigger": "go",
|
|
"base_dep": "ok"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/child_dep"
|
|
}
|
|
],
|
|
"schema_id": "merge_2_0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "merging: form and display do NOT merge",
|
|
"database": {
|
|
"schemas": [
|
|
{
|
|
"$id": "base_3",
|
|
"properties": {
|
|
"a": {
|
|
"type": "string"
|
|
},
|
|
"b": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"form": [
|
|
"a",
|
|
"b"
|
|
]
|
|
},
|
|
{
|
|
"$ref": "base_3",
|
|
"properties": {
|
|
"c": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"form": [
|
|
"c"
|
|
],
|
|
"$id": "merge_3_0"
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "child schema validation",
|
|
"data": {
|
|
"a": "ok",
|
|
"b": "ok",
|
|
"c": "ok"
|
|
},
|
|
"valid": true,
|
|
"comment": "Verifies validator handles the unmerged metadata correctly (ignores it or handles replacement)",
|
|
"schema_id": "merge_3_0"
|
|
}
|
|
]
|
|
}
|
|
] |