325 lines
11 KiB
JSON
325 lines
11 KiB
JSON
[
|
|
{
|
|
"description": "basic field dependencies",
|
|
"enums": [],
|
|
"types": [],
|
|
"puncs": [
|
|
{
|
|
"name": "dependency_split_test",
|
|
"public": false,
|
|
"schemas": [
|
|
{
|
|
"$id": "dependency_split_test.request",
|
|
"type": "object",
|
|
"properties": {
|
|
"creating": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"kind": {
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"creating": [
|
|
"name",
|
|
"kind"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "missing both dependent fields",
|
|
"schema_id": "dependency_split_test.request",
|
|
"data": {
|
|
"creating": true,
|
|
"description": "desc"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/name"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/kind"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "missing one dependent field",
|
|
"schema_id": "dependency_split_test.request",
|
|
"data": {
|
|
"creating": true,
|
|
"name": "My Account"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/kind"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "no triggering field present",
|
|
"schema_id": "dependency_split_test.request",
|
|
"data": {
|
|
"description": "desc"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "triggering field is false but present - dependencies apply",
|
|
"schema_id": "dependency_split_test.request",
|
|
"data": {
|
|
"creating": false,
|
|
"description": "desc"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/name"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/kind"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "nested dependencies in array items",
|
|
"enums": [],
|
|
"types": [],
|
|
"puncs": [
|
|
{
|
|
"name": "nested_dep_test",
|
|
"public": false,
|
|
"schemas": [
|
|
{
|
|
"$id": "nested_dep_test.request",
|
|
"type": "object",
|
|
"properties": {
|
|
"items": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"creating": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"kind": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"id"
|
|
],
|
|
"dependencies": {
|
|
"creating": [
|
|
"name",
|
|
"kind"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"items"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "violations in array items",
|
|
"schema_id": "nested_dep_test.request",
|
|
"data": {
|
|
"items": [
|
|
{
|
|
"id": "item1",
|
|
"creating": true
|
|
},
|
|
{
|
|
"id": "item2",
|
|
"creating": true,
|
|
"name": "Item 2"
|
|
}
|
|
]
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/items/0/name"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/items/0/kind"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/items/1/kind"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "dependency merging across inheritance",
|
|
"enums": [],
|
|
"puncs": [],
|
|
"types": [
|
|
{
|
|
"name": "entity",
|
|
"schemas": [
|
|
{
|
|
"$id": "entity",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"format": "uuid"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
},
|
|
"created_by": {
|
|
"type": "string",
|
|
"format": "uuid"
|
|
},
|
|
"creating": {
|
|
"type": "boolean"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type",
|
|
"created_by"
|
|
],
|
|
"dependencies": {
|
|
"creating": [
|
|
"name"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "user",
|
|
"schemas": [
|
|
{
|
|
"$id": "user",
|
|
"$ref": "entity",
|
|
"properties": {
|
|
"password": {
|
|
"type": "string",
|
|
"minLength": 8
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"creating": [
|
|
"name"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "person",
|
|
"schemas": [
|
|
{
|
|
"$id": "person",
|
|
"$ref": "user",
|
|
"properties": {
|
|
"first_name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"last_name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"creating": [
|
|
"first_name",
|
|
"last_name"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "merged dependencies across inheritance",
|
|
"schema_id": "person",
|
|
"data": {
|
|
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"type": "person",
|
|
"created_by": "550e8400-e29b-41d4-a716-446655440001",
|
|
"creating": true,
|
|
"password": "securepass"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/name"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/first_name"
|
|
},
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/last_name"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "partial dependency satisfaction across inheritance",
|
|
"schema_id": "person",
|
|
"data": {
|
|
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"type": "person",
|
|
"created_by": "550e8400-e29b-41d4-a716-446655440001",
|
|
"creating": true,
|
|
"password": "securepass",
|
|
"name": "John Doe",
|
|
"first_name": "John"
|
|
},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "DEPENDENCY_FAILED",
|
|
"path": "/last_name"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
] |