199 lines
6.5 KiB
JSON
199 lines
6.5 KiB
JSON
[
|
|
{
|
|
"description": "Entity families via pure $ref graph",
|
|
"database": {
|
|
"types": [
|
|
{
|
|
"name": "entity",
|
|
"hierarchy": [
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "entity",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"$id": "entity.light",
|
|
"$ref": "entity"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "organization",
|
|
"hierarchy": [
|
|
"entity",
|
|
"organization"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "organization",
|
|
"$ref": "entity",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "person",
|
|
"hierarchy": [
|
|
"entity",
|
|
"organization",
|
|
"person"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "person",
|
|
"$ref": "organization",
|
|
"properties": {
|
|
"first_name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"$id": "person.light",
|
|
"$ref": "entity.light"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"puncs": [
|
|
{
|
|
"name": "get_entities",
|
|
"schemas": [
|
|
{
|
|
"$id": "get_entities.response",
|
|
"$family": "entity"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "get_light_entities",
|
|
"schemas": [
|
|
{
|
|
"$id": "get_light_entities.response",
|
|
"$family": "entity.light"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "Family matches base entity",
|
|
"schema_id": "get_entities.response",
|
|
"data": {
|
|
"id": "1",
|
|
"type": "entity"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "Family matches descendant person",
|
|
"schema_id": "get_entities.response",
|
|
"data": {
|
|
"id": "2",
|
|
"type": "person",
|
|
"name": "ACME",
|
|
"first_name": "John"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "Graph family matches entity.light",
|
|
"schema_id": "get_light_entities.response",
|
|
"data": {
|
|
"id": "3",
|
|
"type": "entity"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "Graph family matches person.light (because it $refs entity.light)",
|
|
"schema_id": "get_light_entities.response",
|
|
"data": {
|
|
"id": "4",
|
|
"type": "person"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "Graph family excludes organization (missing .light schema that $refs entity.light)",
|
|
"schema_id": "get_light_entities.response",
|
|
"data": {
|
|
"id": "5",
|
|
"type": "organization",
|
|
"name": "ACME"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "FAMILY_MISMATCH",
|
|
"path": ""
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "Ad-hoc non-entity families (using normal json-schema object structures)",
|
|
"database": {
|
|
"puncs": [
|
|
{
|
|
"name": "get_widgets",
|
|
"schemas": [
|
|
{
|
|
"$id": "widget",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"widget_type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"$id": "special_widget",
|
|
"$ref": "widget",
|
|
"properties": {
|
|
"special_feature": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"$id": "get_widgets.response",
|
|
"$family": "widget"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "Ad-hoc family matches strictly by shape (no magic variations for base schemas)",
|
|
"schema_id": "get_widgets.response",
|
|
"data": {
|
|
"id": "1",
|
|
"widget_type": "special",
|
|
"special_feature": "yes"
|
|
},
|
|
"valid": true
|
|
}
|
|
]
|
|
}
|
|
] |