Files
jspg/fixtures/database.json
2026-04-02 21:55:57 -04:00

80 lines
2.3 KiB
JSON

[
{
"description": "ambiguous M:M and missing boundaries",
"database": {
"types": [
{ "name": "unrelated", "schema": {}, "is_enum": false, "parents": [], "variations": ["unrelated"], "has_table": true },
{ "name": "actor", "schema": {}, "is_enum": false, "parents": [], "variations": ["actor"], "has_table": true },
{ "name": "movie", "schema": {}, "is_enum": false, "parents": [], "variations": ["movie"], "has_table": true },
{ "name": "junction", "schema": {}, "is_enum": false, "parents": [], "variations": ["junction"], "has_table": true }
],
"relations": [
{ "constraint": "fk_junction_actor1", "source_type": "junction", "destination_type": "actor", "is_array": true, "prefix": null },
{ "constraint": "fk_junction_actor2", "source_type": "junction", "destination_type": "actor", "is_array": true, "prefix": null }
],
"schemas": [
{
"$id": "get.actor",
"properties": {
"missing_edge": { "$ref": "unrelated" },
"ambiguous_edge": { "$ref": "junction" }
}
}
]
},
"tests": [
{
"description": "throws EDGE_MISSING when relation does not exist",
"action": "database_compile",
"expect": {
"success": false,
"errors": [
{
"code": "EDGE_MISSING"
}
]
}
},
{
"description": "throws AMBIGUOUS_TYPE_RELATIONS when junction has multi null prefixes",
"action": "database_compile",
"expect": {
"success": false,
"errors": [
{
"code": "AMBIGUOUS_TYPE_RELATIONS"
}
]
}
}
]
},
{
"description": "invalid metadata identifiers",
"database": {
"types": [],
"relations": [],
"schemas": [
{
"$id": "invalid@id",
"properties": {}
}
]
},
"tests": [
{
"description": "throws INVALID_IDENTIFIER for non-alphanumeric ids",
"action": "database_compile",
"expect": {
"success": false,
"errors": [
{
"code": "INVALID_IDENTIFIER"
}
]
}
}
]
}
]