Files
jspg/fixtures/merge.json

276 lines
5.7 KiB
JSON

[
{
"description": "merging: properties accumulate",
"database": {
"schemas": {
"base_0": {
"properties": {
"base_prop": {
"type": "string"
}
}
},
"merge_0_0": {
"type": "base_0",
"properties": {
"child_prop": {
"type": "string"
}
}
}
}
},
"tests": [
{
"description": "valid with both properties",
"data": {
"base_prop": "a",
"child_prop": "b"
},
"schema_id": "merge_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "invalid when base property has wrong type",
"data": {
"base_prop": 1,
"child_prop": "b"
},
"schema_id": "merge_0_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "INVALID_TYPE",
"details": {
"path": "base_prop"
}
}
]
}
}
]
},
{
"description": "merging: required fields accumulate",
"database": {
"schemas": {
"base_1": {
"properties": {
"a": {
"type": "string"
}
},
"required": [
"a"
]
},
"merge_1_0": {
"type": "base_1",
"properties": {
"b": {
"type": "string"
}
},
"required": [
"b"
]
}
}
},
"tests": [
{
"description": "valid when both present",
"data": {
"a": "ok",
"b": "ok"
},
"schema_id": "merge_1_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "invalid when base required missing",
"data": {
"b": "ok"
},
"schema_id": "merge_1_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "REQUIRED_FIELD_MISSING",
"details": {
"path": "a"
}
}
]
}
},
{
"description": "invalid when child required missing",
"data": {
"a": "ok"
},
"schema_id": "merge_1_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "REQUIRED_FIELD_MISSING",
"details": {
"path": "b"
}
}
]
}
}
]
},
{
"description": "merging: dependencies accumulate",
"database": {
"schemas": {
"base_2": {
"properties": {
"trigger": {
"type": "string"
},
"base_dep": {
"type": "string"
}
},
"dependencies": {
"trigger": [
"base_dep"
]
}
},
"merge_2_0": {
"type": "base_2",
"properties": {
"child_dep": {
"type": "string"
}
},
"dependencies": {
"trigger": [
"child_dep"
]
}
}
}
},
"tests": [
{
"description": "valid with all deps",
"data": {
"trigger": "go",
"base_dep": "ok",
"child_dep": "ok"
},
"schema_id": "merge_2_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "invalid missing base dep",
"data": {
"trigger": "go",
"child_dep": "ok"
},
"schema_id": "merge_2_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "DEPENDENCY_MISSING",
"details": {
"path": ""
}
}
]
}
},
{
"description": "invalid missing child dep",
"data": {
"trigger": "go",
"base_dep": "ok"
},
"schema_id": "merge_2_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "DEPENDENCY_MISSING",
"details": {
"path": ""
}
}
]
}
}
]
},
{
"description": "merging: form and display do NOT merge",
"database": {
"schemas": {
"base_3": {
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "string"
}
},
"form": [
"a",
"b"
]
},
"merge_3_0": {
"type": "base_3",
"properties": {
"c": {
"type": "string"
}
},
"form": [
"c"
]
}
}
},
"tests": [
{
"description": "child schema validation",
"data": {
"a": "ok",
"b": "ok",
"c": "ok"
},
"comment": "Verifies validator handles the unmerged metadata correctly (ignores it or handles replacement)",
"schema_id": "merge_3_0",
"action": "validate",
"expect": {
"success": true
}
}
]
}
]