massively improves the jspg validator by removing mathmatical functions like allOf, anyOf, ref, etc to effectively use discriminators and OOP with types to determine valid pathing an nno intersections, unions, or guesswork; added cases to replace the former conditionals

This commit is contained in:
2026-04-08 13:08:24 -04:00
parent e4286ac6a9
commit 7c8df22709
30 changed files with 2526 additions and 4816 deletions

View File

@ -8,7 +8,7 @@
"schemas": [
{
"$id": "get_organization.response",
"$ref": "organization"
"type": "organization"
}
]
},
@ -40,7 +40,7 @@
"$id": "get_orders.response",
"type": "array",
"items": {
"$ref": "light.order"
"type": "light.order"
}
}
]
@ -238,7 +238,7 @@
"schemas": [
{
"$id": "organization",
"$ref": "entity",
"type": "entity",
"properties": {
"name": {
"type": "string"
@ -287,7 +287,7 @@
"schemas": [
{
"$id": "bot",
"$ref": "organization",
"type": "organization",
"properties": {
"token": {
"type": "string"
@ -345,7 +345,7 @@
"schemas": [
{
"$id": "person",
"$ref": "organization",
"type": "organization",
"properties": {
"first_name": {
"type": "string"
@ -360,20 +360,20 @@
},
{
"$id": "light.person",
"$ref": "person",
"type": "person",
"properties": {}
},
{
"$id": "full.person",
"$ref": "person",
"type": "person",
"properties": {
"phone_numbers": {
"type": "array",
"items": {
"$ref": "contact",
"type": "contact",
"properties": {
"target": {
"$ref": "phone_number"
"type": "phone_number"
}
}
}
@ -381,10 +381,10 @@
"email_addresses": {
"type": "array",
"items": {
"$ref": "contact",
"type": "contact",
"properties": {
"target": {
"$ref": "email_address"
"type": "email_address"
}
}
}
@ -392,10 +392,10 @@
"addresses": {
"type": "array",
"items": {
"$ref": "contact",
"type": "contact",
"properties": {
"target": {
"$ref": "address"
"type": "address"
}
}
}
@ -403,18 +403,18 @@
"contacts": {
"type": "array",
"items": {
"$ref": "contact",
"type": "contact",
"properties": {
"target": {
"oneOf": [
{
"$ref": "phone_number"
"type": "phone_number"
},
{
"$ref": "email_address"
"type": "email_address"
},
{
"$ref": "address"
"type": "address"
}
]
}
@ -472,7 +472,7 @@
"schemas": [
{
"$id": "relationship",
"$ref": "entity",
"type": "entity",
"properties": {}
}
],
@ -531,7 +531,7 @@
"schemas": [
{
"$id": "contact",
"$ref": "relationship",
"type": "relationship",
"properties": {
"is_primary": {
"type": "boolean"
@ -577,7 +577,7 @@
"schemas": [
{
"$id": "phone_number",
"$ref": "entity",
"type": "entity",
"properties": {
"number": {
"type": "string"
@ -623,7 +623,7 @@
"schemas": [
{
"$id": "email_address",
"$ref": "entity",
"type": "entity",
"properties": {
"address": {
"type": "string"
@ -669,7 +669,7 @@
"schemas": [
{
"$id": "address",
"$ref": "entity",
"type": "entity",
"properties": {
"city": {
"type": "string"
@ -686,7 +686,7 @@
"schemas": [
{
"$id": "order",
"$ref": "entity",
"type": "entity",
"properties": {
"total": {
"type": "number"
@ -698,24 +698,24 @@
},
{
"$id": "light.order",
"$ref": "order",
"type": "order",
"properties": {
"customer": {
"$ref": "person"
"type": "person"
}
}
},
{
"$id": "full.order",
"$ref": "order",
"type": "order",
"properties": {
"customer": {
"$ref": "person"
"type": "person"
},
"lines": {
"type": "array",
"items": {
"$ref": "order_line"
"type": "order_line"
}
}
}
@ -784,7 +784,7 @@
"schemas": [
{
"$id": "order_line",
"$ref": "entity",
"type": "entity",
"properties": {
"order_id": {
"type": "string"
@ -862,13 +862,13 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'archived', entity_1.archived,",
" 'created_at', entity_1.created_at,",
" 'id', entity_1.id,",
" 'type', entity_1.type)",
"FROM agreego.entity entity_1",
"WHERE NOT entity_1.archived)"
"WHERE NOT entity_1.archived)))"
]
]
}
@ -905,7 +905,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'archived', entity_1.archived,",
" 'created_at', entity_1.created_at,",
" 'id', entity_1.id,",
@ -926,7 +926,7 @@
" AND entity_1.id IN (SELECT value::uuid FROM jsonb_array_elements_text(($10#>>'{}')::jsonb))",
" AND entity_1.id != ($11#>>'{}')::uuid",
" AND entity_1.id NOT IN (SELECT value::uuid FROM jsonb_array_elements_text(($12#>>'{}')::jsonb))",
")"
")))"
]
]
}
@ -939,7 +939,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'age', person_1.age,",
" 'archived', entity_3.archived,",
" 'created_at', entity_3.created_at,",
@ -951,7 +951,7 @@
"FROM agreego.person person_1",
"JOIN agreego.organization organization_2 ON organization_2.id = person_1.id",
"JOIN agreego.entity entity_3 ON entity_3.id = organization_2.id",
"WHERE NOT entity_3.archived)"
"WHERE NOT entity_3.archived)))"
]
]
}
@ -964,7 +964,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'addresses',",
" (SELECT COALESCE(jsonb_agg(jsonb_build_object(",
" 'archived', entity_6.archived,",
@ -1116,7 +1116,7 @@
"FROM agreego.person person_1",
"JOIN agreego.organization organization_2 ON organization_2.id = person_1.id",
"JOIN agreego.entity entity_3 ON entity_3.id = organization_2.id",
"WHERE NOT entity_3.archived)"
"WHERE NOT entity_3.archived)))"
]
]
}
@ -1200,7 +1200,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'addresses',",
" (SELECT COALESCE(jsonb_agg(jsonb_build_object(",
" 'archived', entity_6.archived,",
@ -1385,7 +1385,7 @@
" AND entity_3.id != ($28#>>'{}')::uuid",
" AND entity_3.id NOT IN (SELECT value::uuid FROM jsonb_array_elements_text(($29#>>'{}')::jsonb))",
" AND person_1.last_name ILIKE $30#>>'{}'",
" AND person_1.last_name NOT ILIKE $31#>>'{}')"
" AND person_1.last_name NOT ILIKE $31#>>'{}')))"
]
]
}
@ -1398,7 +1398,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'archived', entity_3.archived,",
" 'created_at', entity_3.created_at,",
" 'id', entity_3.id,",
@ -1423,7 +1423,7 @@
"JOIN agreego.entity entity_3 ON entity_3.id = relationship_2.id",
"WHERE",
" NOT entity_3.archived",
" AND relationship_2.target_type = 'email_address')"
" AND relationship_2.target_type = 'email_address')))"
]
]
}
@ -1436,7 +1436,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'archived', entity_2.archived,",
" 'created_at', entity_2.created_at,",
" 'customer',",
@ -1478,7 +1478,7 @@
")",
"FROM agreego.order order_1",
"JOIN agreego.entity entity_2 ON entity_2.id = order_1.id",
"WHERE NOT entity_2.archived)"
"WHERE NOT entity_2.archived)))"
]
]
}
@ -1491,7 +1491,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'archived', entity_2.archived,",
" 'created_at', entity_2.created_at,",
" 'id', entity_2.id,",
@ -1500,7 +1500,7 @@
")",
"FROM agreego.organization organization_1",
"JOIN agreego.entity entity_2 ON entity_2.id = organization_1.id",
"WHERE NOT entity_2.archived)"
"WHERE NOT entity_2.archived)))"
]
]
}
@ -1513,7 +1513,7 @@
"success": true,
"sql": [
[
"(SELECT COALESCE(jsonb_agg(jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT COALESCE(jsonb_agg(jsonb_build_object(",
" 'id', organization_1.id,",
" 'type', CASE",
" WHEN organization_1.type = 'bot' THEN",
@ -1559,7 +1559,7 @@
")), '[]'::jsonb)",
"FROM agreego.organization organization_1",
"JOIN agreego.entity entity_2 ON entity_2.id = organization_1.id",
"WHERE NOT entity_2.archived)"
"WHERE NOT entity_2.archived)))"
]
]
}
@ -1572,7 +1572,7 @@
"success": true,
"sql": [
[
"(SELECT jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
" 'age', person_1.age,",
" 'archived', entity_3.archived,",
" 'created_at', entity_3.created_at,",
@ -1585,7 +1585,7 @@
"FROM agreego.person person_1",
"JOIN agreego.organization organization_2 ON organization_2.id = person_1.id",
"JOIN agreego.entity entity_3 ON entity_3.id = organization_2.id",
"WHERE NOT entity_3.archived)"
"WHERE NOT entity_3.archived)))"
]
]
}
@ -1598,7 +1598,7 @@
"success": true,
"sql": [
[
"(SELECT COALESCE(jsonb_agg(jsonb_build_object(",
"(SELECT jsonb_strip_nulls((SELECT COALESCE(jsonb_agg(jsonb_build_object(",
" 'archived', entity_2.archived,",
" 'created_at', entity_2.created_at,",
" 'customer',",
@ -1625,7 +1625,7 @@
")), '[]'::jsonb)",
"FROM agreego.order order_1",
"JOIN agreego.entity entity_2 ON entity_2.id = order_1.id",
"WHERE NOT entity_2.archived)"
"WHERE NOT entity_2.archived)))"
]
]
}