200 lines
4.5 KiB
JSON
200 lines
4.5 KiB
JSON
[
|
|
{
|
|
"description": "punc-specific resolution and local refs",
|
|
"enums": [],
|
|
"types": [
|
|
{
|
|
"name": "global_thing",
|
|
"schemas": [
|
|
{
|
|
"$id": "global_thing",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"format": "uuid"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "punc_entity",
|
|
"schemas": [
|
|
{
|
|
"$id": "punc_entity",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "punc_person",
|
|
"schemas": [
|
|
{
|
|
"$id": "punc_person",
|
|
"$ref": "punc_entity",
|
|
"properties": {
|
|
"first_name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"last_name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"address": {
|
|
"type": "object",
|
|
"properties": {
|
|
"street": {
|
|
"type": "string"
|
|
},
|
|
"city": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"street",
|
|
"city"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"puncs": [
|
|
{
|
|
"name": "public_ref_test",
|
|
"public": true,
|
|
"schemas": [
|
|
{
|
|
"$id": "public_ref_test.request",
|
|
"$ref": "punc_person"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "private_ref_test",
|
|
"public": false,
|
|
"schemas": [
|
|
{
|
|
"$id": "private_ref_test.request",
|
|
"$ref": "punc_person"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "punc_with_local_ref_test",
|
|
"public": false,
|
|
"schemas": [
|
|
{
|
|
"$id": "local_address",
|
|
"type": "object",
|
|
"properties": {
|
|
"street": {
|
|
"type": "string"
|
|
},
|
|
"city": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"street",
|
|
"city"
|
|
]
|
|
},
|
|
{
|
|
"$id": "punc_with_local_ref_test.request",
|
|
"$ref": "local_address"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "punc_with_local_ref_to_global_test",
|
|
"public": false,
|
|
"schemas": [
|
|
{
|
|
"$id": "local_user_with_thing",
|
|
"type": "object",
|
|
"properties": {
|
|
"user_name": {
|
|
"type": "string"
|
|
},
|
|
"thing": {
|
|
"$ref": "global_thing"
|
|
}
|
|
},
|
|
"required": [
|
|
"user_name",
|
|
"thing"
|
|
]
|
|
},
|
|
{
|
|
"$id": "punc_with_local_ref_to_global_test.request",
|
|
"$ref": "local_user_with_thing"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid instance with address passes in public punc",
|
|
"schema_id": "public_ref_test.request",
|
|
"data": {},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "punc local ref resolution",
|
|
"schema_id": "punc_with_local_ref_test.request",
|
|
"data": {},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "punc local ref missing requirement",
|
|
"schema_id": "punc_with_local_ref_test.request",
|
|
"data": {},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "REQUIRED_FIELD_MISSING",
|
|
"path": "/city"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "punc local ref to global type - invalid format",
|
|
"schema_id": "punc_with_local_ref_to_global_test.request",
|
|
"data": {},
|
|
"valid": false,
|
|
"expect_errors": [
|
|
{
|
|
"code": "FORMAT_INVALID",
|
|
"path": "/thing/id"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
] |