223 lines
5.2 KiB
JSON
223 lines
5.2 KiB
JSON
[
|
|
{
|
|
"description": "Stem Engine Unit Tests",
|
|
"database": {
|
|
"puncs": [],
|
|
"enums": [],
|
|
"relations": [
|
|
{
|
|
"id": "rel1",
|
|
"type": "relation",
|
|
"constraint": "fk_contact_entity",
|
|
"source_type": "contact",
|
|
"source_columns": [
|
|
"entity_id"
|
|
],
|
|
"destination_type": "person",
|
|
"destination_columns": [
|
|
"id"
|
|
],
|
|
"prefix": null
|
|
},
|
|
{
|
|
"id": "rel2",
|
|
"type": "relation",
|
|
"constraint": "fk_relationship_target",
|
|
"source_type": "relationship",
|
|
"source_columns": [
|
|
"target_id",
|
|
"target_type"
|
|
],
|
|
"destination_type": "entity",
|
|
"destination_columns": [
|
|
"id",
|
|
"type"
|
|
],
|
|
"prefix": "target"
|
|
}
|
|
],
|
|
"types": [
|
|
{
|
|
"name": "entity",
|
|
"hierarchy": [
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "entity",
|
|
"type": "object",
|
|
"properties": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "person",
|
|
"hierarchy": [
|
|
"person",
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "person",
|
|
"$ref": "entity",
|
|
"properties": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "email_address",
|
|
"hierarchy": [
|
|
"email_address",
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "email_address",
|
|
"$ref": "entity",
|
|
"properties": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "phone_number",
|
|
"hierarchy": [
|
|
"phone_number",
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "phone_number",
|
|
"$ref": "entity",
|
|
"properties": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "relationship",
|
|
"relationship": true,
|
|
"hierarchy": [
|
|
"relationship",
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "relationship",
|
|
"$ref": "entity",
|
|
"properties": {}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "contact",
|
|
"relationship": true,
|
|
"hierarchy": [
|
|
"contact",
|
|
"relationship",
|
|
"entity"
|
|
],
|
|
"schemas": [
|
|
{
|
|
"$id": "contact",
|
|
"$ref": "relationship",
|
|
"properties": {
|
|
"target": {
|
|
"oneOf": [
|
|
{
|
|
"$ref": "phone_number"
|
|
},
|
|
{
|
|
"$ref": "email_address"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "save_person",
|
|
"schemas": [
|
|
{
|
|
"$id": "save_person.response",
|
|
"$ref": "person",
|
|
"properties": {
|
|
"contacts": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "contact"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "correctly squashes deep oneOf refs through array paths",
|
|
"action": "compile",
|
|
"expect": {
|
|
"success": true,
|
|
"stems": {
|
|
"save_person.response": {
|
|
"": {
|
|
"type": "person"
|
|
},
|
|
"contacts.#": {
|
|
"type": "contact",
|
|
"relation": "contacts_id"
|
|
},
|
|
"contacts.#.target#(type==\"email_address\")": {
|
|
"type": "email_address",
|
|
"relation": "target_id"
|
|
},
|
|
"contacts.#.target#(type==\"phone_number\")": {
|
|
"type": "phone_number",
|
|
"relation": "target_id"
|
|
}
|
|
},
|
|
"contact": {
|
|
"": {
|
|
"type": "contact"
|
|
},
|
|
"target#(type==\"email_address\")": {
|
|
"type": "email_address",
|
|
"relation": "target_id"
|
|
},
|
|
"target#(type==\"phone_number\")": {
|
|
"type": "phone_number",
|
|
"relation": "target_id"
|
|
}
|
|
},
|
|
"person": {
|
|
"": {
|
|
"type": "person"
|
|
}
|
|
},
|
|
"email_address": {
|
|
"": {
|
|
"type": "email_address"
|
|
}
|
|
},
|
|
"phone_number": {
|
|
"": {
|
|
"type": "phone_number"
|
|
}
|
|
},
|
|
"relationship": {
|
|
"": {
|
|
"type": "relationship"
|
|
}
|
|
},
|
|
"entity": {
|
|
"": {
|
|
"type": "entity"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |