402 lines
9.5 KiB
JSON
402 lines
9.5 KiB
JSON
[
|
|
{
|
|
"description": "Hybrid Array Pathing",
|
|
"database": {
|
|
"schemas": {
|
|
"hybrid_pathing": {
|
|
"type": "object",
|
|
"properties": {
|
|
"primitives": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"ad_hoc_objects": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"name"
|
|
]
|
|
}
|
|
},
|
|
"entities": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"value": {
|
|
"type": "number",
|
|
"minimum": 10
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"deep_entities": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"nested": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"flag": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "happy path passes structural validation",
|
|
"data": {
|
|
"primitives": [
|
|
"a",
|
|
"b"
|
|
],
|
|
"ad_hoc_objects": [
|
|
{
|
|
"name": "obj1"
|
|
}
|
|
],
|
|
"entities": [
|
|
{
|
|
"id": "entity-1",
|
|
"value": 15
|
|
}
|
|
],
|
|
"deep_entities": [
|
|
{
|
|
"id": "parent-1",
|
|
"nested": [
|
|
{
|
|
"id": "child-1",
|
|
"flag": true
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"schema_id": "hybrid_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": true
|
|
}
|
|
},
|
|
{
|
|
"description": "primitive arrays use numeric indexing",
|
|
"data": {
|
|
"primitives": [
|
|
"a",
|
|
123
|
|
]
|
|
},
|
|
"schema_id": "hybrid_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "INVALID_TYPE",
|
|
"details": {
|
|
"path": "primitives/1"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "ad-hoc objects without ids use numeric indexing",
|
|
"data": {
|
|
"ad_hoc_objects": [
|
|
{
|
|
"name": "valid"
|
|
},
|
|
{
|
|
"age": 30
|
|
}
|
|
]
|
|
},
|
|
"schema_id": "hybrid_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "REQUIRED_FIELD_MISSING",
|
|
"details": {
|
|
"path": "ad_hoc_objects/1/name"
|
|
}
|
|
},
|
|
{
|
|
"code": "STRICT_PROPERTY_VIOLATION",
|
|
"details": {
|
|
"path": "ad_hoc_objects/1/age"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "arrays of objects with ids use topological uuid indexing",
|
|
"data": {
|
|
"entities": [
|
|
{
|
|
"id": "entity-alpha",
|
|
"value": 20
|
|
},
|
|
{
|
|
"id": "entity-beta",
|
|
"value": 5
|
|
}
|
|
]
|
|
},
|
|
"schema_id": "hybrid_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "MINIMUM_VIOLATED",
|
|
"details": {
|
|
"path": "entities/entity-beta/value"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "deeply nested entity arrays retain full topological paths",
|
|
"data": {
|
|
"deep_entities": [
|
|
{
|
|
"id": "parent-omega",
|
|
"nested": [
|
|
{
|
|
"id": "child-alpha",
|
|
"flag": true
|
|
},
|
|
{
|
|
"id": "child-beta",
|
|
"flag": "invalid-string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"schema_id": "hybrid_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "INVALID_TYPE",
|
|
"details": {
|
|
"path": "deep_entities/parent-omega/nested/child-beta/flag"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "Ad-Hoc Union Pathing",
|
|
"database": {
|
|
"schemas": {
|
|
"ad_hoc_pathing": {
|
|
"type": "object",
|
|
"properties": {
|
|
"metadata_bubbles": {
|
|
"type": "array",
|
|
"items": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "oneOf arrays natively support disjoint primitive types dynamically mapped into topological paths natively",
|
|
"data": {
|
|
"metadata_bubbles": [
|
|
100,
|
|
"metadata string",
|
|
true
|
|
]
|
|
},
|
|
"schema_id": "ad_hoc_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "NO_ONEOF_MATCH",
|
|
"details": {
|
|
"path": "metadata_bubbles/2"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "Polymorphic Family Pathing",
|
|
"database": {
|
|
"types": [
|
|
{
|
|
"name": "widget",
|
|
"variations": [
|
|
"widget"
|
|
],
|
|
"schemas": {
|
|
"widget": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"stock.widget": {
|
|
"type": "widget",
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string"
|
|
},
|
|
"amount": {
|
|
"type": "integer"
|
|
},
|
|
"details": {
|
|
"type": "object",
|
|
"properties": {
|
|
"nested_metric": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"required": [
|
|
"nested_metric"
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"amount",
|
|
"details"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"schemas": {
|
|
"family_pathing": {
|
|
"type": "object",
|
|
"properties": {
|
|
"table_families": {
|
|
"type": "array",
|
|
"items": {
|
|
"$family": "widget"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"tests": [
|
|
|
|
{
|
|
"description": "families mechanically map physical variants directly onto topological uuid array paths",
|
|
"data": {
|
|
"table_families": [
|
|
{
|
|
"id": "widget-1",
|
|
"type": "widget",
|
|
"kind": "stock",
|
|
"amount": 500,
|
|
"details": {
|
|
"nested_metric": 42.0
|
|
}
|
|
},
|
|
{
|
|
"id": "widget-2",
|
|
"type": "widget",
|
|
"kind": "stock",
|
|
"amount": "not_an_int",
|
|
"details": {
|
|
"stray_child": true
|
|
},
|
|
"unexpected_root_prop": "hi"
|
|
}
|
|
]
|
|
},
|
|
"schema_id": "family_pathing",
|
|
"action": "validate",
|
|
"expect": {
|
|
"success": false,
|
|
"errors": [
|
|
{
|
|
"code": "INVALID_TYPE",
|
|
"details": {
|
|
"path": "table_families/widget-2/amount"
|
|
}
|
|
},
|
|
{
|
|
"code": "REQUIRED_FIELD_MISSING",
|
|
"details": {
|
|
"path": "table_families/widget-2/details/nested_metric"
|
|
}
|
|
},
|
|
{
|
|
"code": "STRICT_PROPERTY_VIOLATION",
|
|
"details": {
|
|
"path": "table_families/widget-2/details/stray_child"
|
|
}
|
|
},
|
|
{
|
|
"code": "STRICT_PROPERTY_VIOLATION",
|
|
"details": {
|
|
"path": "table_families/widget-2/unexpected_root_prop"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |