[ { "description": "Entity families with dot patterns", "database": { "types": [ { "name": "entity", "hierarchy": [ "entity" ], "schemas": [ { "$id": "entity", "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string", "const": "entity" } } }, { "$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": "person" } ] } ], "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": "Dot pattern family matches entity.light", "schema_id": "get_light_entities.response", "data": { "id": "3", "type": "entity" }, "valid": true }, { "description": "Dot pattern family matches person.light", "schema_id": "get_light_entities.response", "data": { "id": "4", "type": "person", "name": "ACME", "first_name": "John" }, "valid": true }, { "description": "Dot pattern family excludes organization (missing .light schema, constraint violation)", "schema_id": "get_light_entities.response", "data": { "id": "5", "type": "organization", "name": "ACME" }, "valid": false } ] }, { "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 does not implicitly match descendants (no magical implicit hierarchy on normal ad-hoc schemas)", "schema_id": "get_widgets.response", "data": { "id": "1", "widget_type": "special", "special_feature": "yes" }, "valid": false, "expect_errors": [ { "code": "FAMILY_MISMATCH", "path": "" } ] } ] } ]