Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ddc86f1ba0 | |||
| 562e52e0eb | |||
| 569eb1d2ea | |||
| 6cebce3740 | |||
| d3de3961c1 | |||
| d0ae6eeddd | |||
| e741a7197f | |||
| cf3cabd1f5 | |||
| d608f5e963 | |||
| 95600551a7 | |||
| c18a8c1561 | |||
| 8ed588ca61 | |||
| edd0dd4763 | |||
| abf1d12e43 | |||
| a885713563 | |||
| d9b4f417f6 | |||
| eae39f92d6 | |||
| 2895f06074 | |||
| c1c16bc814 | |||
| 5885552192 |
@ -72,8 +72,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -177,8 +177,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -227,8 +227,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -268,8 +268,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -384,8 +384,8 @@
|
||||
{
|
||||
"code": "MULTIPLE_OF_VIOLATED",
|
||||
"values": {
|
||||
"value": "9",
|
||||
"multiple_of": "2"
|
||||
"multiple_of": "2",
|
||||
"value": "9"
|
||||
},
|
||||
"details": {
|
||||
"path": "2",
|
||||
@ -443,8 +443,8 @@
|
||||
{
|
||||
"code": "MULTIPLE_OF_VIOLATED",
|
||||
"values": {
|
||||
"multiple_of": "2",
|
||||
"value": "5"
|
||||
"value": "5",
|
||||
"multiple_of": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "1",
|
||||
|
||||
@ -62,8 +62,8 @@
|
||||
"code": "EDGE_MISSING",
|
||||
"values": {
|
||||
"parent_type": "org",
|
||||
"child_type": "user",
|
||||
"property_name": "missing_users"
|
||||
"property_name": "missing_users",
|
||||
"child_type": "user"
|
||||
},
|
||||
"details": {
|
||||
"path": "full.org/missing_users",
|
||||
@ -151,9 +151,9 @@
|
||||
{
|
||||
"code": "EDGE_MISSING",
|
||||
"values": {
|
||||
"property_name": "children",
|
||||
"child_type": "child",
|
||||
"parent_type": "parent",
|
||||
"child_type": "child"
|
||||
"property_name": "children"
|
||||
},
|
||||
"details": {
|
||||
"path": "full.parent/children",
|
||||
@ -254,9 +254,9 @@
|
||||
{
|
||||
"code": "AMBIGUOUS_TYPE_RELATIONS",
|
||||
"values": {
|
||||
"parent_type": "invoice",
|
||||
"child_type": "activity",
|
||||
"property_name": "activities",
|
||||
"parent_type": "invoice"
|
||||
"property_name": "activities"
|
||||
},
|
||||
"details": {
|
||||
"path": "full.invoice/activities",
|
||||
@ -390,9 +390,9 @@
|
||||
{
|
||||
"code": "AMBIGUOUS_TYPE_RELATIONS",
|
||||
"values": {
|
||||
"property_name": "ambiguous_edge",
|
||||
"parent_type": "actor",
|
||||
"child_type": "junction",
|
||||
"parent_type": "actor"
|
||||
"property_name": "ambiguous_edge"
|
||||
},
|
||||
"details": {
|
||||
"path": "full.actor/ambiguous_edge",
|
||||
@ -470,8 +470,8 @@
|
||||
{
|
||||
"code": "DATABASE_TYPE_PARSE_FAILED",
|
||||
"values": {
|
||||
"type": "failure",
|
||||
"reason": "invalid type: sequence, expected a string"
|
||||
"reason": "invalid type: sequence, expected a string",
|
||||
"type": "failure"
|
||||
},
|
||||
"details": {
|
||||
"context": "failure"
|
||||
|
||||
@ -65,8 +65,8 @@
|
||||
{
|
||||
"code": "DEPENDENCY_MISSING",
|
||||
"values": {
|
||||
"required_property": "foo",
|
||||
"property_name": "bar"
|
||||
"property_name": "bar",
|
||||
"required_property": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -276,8 +276,8 @@
|
||||
{
|
||||
"code": "DEPENDENCY_MISSING",
|
||||
"values": {
|
||||
"required_property": "foo",
|
||||
"property_name": "quux"
|
||||
"property_name": "quux",
|
||||
"required_property": "foo"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -287,8 +287,8 @@
|
||||
{
|
||||
"code": "DEPENDENCY_MISSING",
|
||||
"values": {
|
||||
"required_property": "bar",
|
||||
"property_name": "quux"
|
||||
"property_name": "quux",
|
||||
"required_property": "bar"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -362,8 +362,8 @@
|
||||
{
|
||||
"code": "DEPENDENCY_MISSING",
|
||||
"values": {
|
||||
"required_property": "foo\rbar",
|
||||
"property_name": "foo\nbar"
|
||||
"property_name": "foo\nbar",
|
||||
"required_property": "foo\rbar"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -829,8 +829,8 @@
|
||||
{
|
||||
"code": "MIN_PROPERTIES_VIOLATED",
|
||||
"values": {
|
||||
"count": "2",
|
||||
"limit": "4"
|
||||
"limit": "4",
|
||||
"count": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -128,8 +128,8 @@
|
||||
{
|
||||
"code": "PATTERN_VIOLATED",
|
||||
"values": {
|
||||
"value": "abcd",
|
||||
"pattern": "^[a-z]{3}$"
|
||||
"pattern": "^[a-z]{3}$",
|
||||
"value": "abcd"
|
||||
},
|
||||
"details": {
|
||||
"path": "keys/abcd",
|
||||
|
||||
@ -56,8 +56,8 @@
|
||||
{
|
||||
"code": "EXCLUSIVE_MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"limit": "3",
|
||||
"value": "3.5"
|
||||
"value": "3.5",
|
||||
"limit": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
{
|
||||
"code": "EXCLUSIVE_MINIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "1.1",
|
||||
"limit": "1.1"
|
||||
"limit": "1.1",
|
||||
"value": "1.1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -96,14 +96,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"season": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"opening_hours": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -117,6 +109,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"season": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -290,7 +290,6 @@
|
||||
"uuid_field",
|
||||
"tags",
|
||||
"ad_hoc",
|
||||
"schedule",
|
||||
"$and",
|
||||
"$or"
|
||||
],
|
||||
@ -306,7 +305,6 @@
|
||||
"uuid_field",
|
||||
"tags",
|
||||
"ad_hoc",
|
||||
"schedule",
|
||||
"$and",
|
||||
"$or"
|
||||
],
|
||||
@ -328,7 +326,6 @@
|
||||
"uuid_field",
|
||||
"tags",
|
||||
"ad_hoc",
|
||||
"schedule",
|
||||
"$and",
|
||||
"$or"
|
||||
],
|
||||
@ -397,12 +394,6 @@
|
||||
"string.condition",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"schedule": {
|
||||
"type": [
|
||||
"opening_hours.filter",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "filter"
|
||||
@ -522,64 +513,10 @@
|
||||
}
|
||||
},
|
||||
"opening_hours": {},
|
||||
"season": {},
|
||||
"opening_hours.filter": {
|
||||
"type": "filter",
|
||||
"compiledPropertyNames": [
|
||||
"open",
|
||||
"seasons",
|
||||
"$and",
|
||||
"$or"
|
||||
],
|
||||
"properties": {
|
||||
"open": {
|
||||
"type": [
|
||||
"string.condition",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"seasons": {
|
||||
"type": [
|
||||
"season.filter",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"$and": {
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"type": "opening_hours.filter",
|
||||
"compiledPropertyNames": [
|
||||
"open",
|
||||
"seasons",
|
||||
"$and",
|
||||
"$or"
|
||||
]
|
||||
}
|
||||
},
|
||||
"$or": {
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"type": "opening_hours.filter",
|
||||
"compiledPropertyNames": [
|
||||
"open",
|
||||
"seasons",
|
||||
"$and",
|
||||
"$or"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"season.filter": {}
|
||||
"season": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@ -70,8 +70,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -144,8 +144,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "2",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -43,8 +43,8 @@
|
||||
{
|
||||
"code": "MAX_LENGTH_VIOLATED",
|
||||
"values": {
|
||||
"count": "3",
|
||||
"limit": "2"
|
||||
"limit": "2",
|
||||
"count": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -109,8 +109,8 @@
|
||||
{
|
||||
"code": "MAX_LENGTH_VIOLATED",
|
||||
"values": {
|
||||
"count": "3",
|
||||
"limit": "2"
|
||||
"limit": "2",
|
||||
"count": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -139,8 +139,8 @@
|
||||
{
|
||||
"code": "MAX_PROPERTIES_VIOLATED",
|
||||
"values": {
|
||||
"count": "3",
|
||||
"limit": "2"
|
||||
"limit": "2",
|
||||
"count": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -190,8 +190,8 @@
|
||||
{
|
||||
"code": "MAX_PROPERTIES_VIOLATED",
|
||||
"values": {
|
||||
"count": "1",
|
||||
"limit": "0"
|
||||
"limit": "0",
|
||||
"count": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -234,8 +234,8 @@
|
||||
{
|
||||
"code": "MAX_PROPERTIES_VIOLATED",
|
||||
"values": {
|
||||
"limit": "2",
|
||||
"count": "3"
|
||||
"count": "3",
|
||||
"limit": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -43,8 +43,8 @@
|
||||
{
|
||||
"code": "MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"limit": "3",
|
||||
"value": "3.5"
|
||||
"value": "3.5",
|
||||
"limit": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -118,8 +118,8 @@
|
||||
{
|
||||
"code": "MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "300.5",
|
||||
"limit": "300"
|
||||
"limit": "300",
|
||||
"value": "300.5"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -264,8 +264,8 @@
|
||||
{
|
||||
"code": "DEPENDENCY_MISSING",
|
||||
"values": {
|
||||
"required_property": "child_dep",
|
||||
"property_name": "trigger"
|
||||
"property_name": "trigger",
|
||||
"required_property": "child_dep"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -1310,9 +1310,9 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" (\"first_name\" = 'LookupFirst'",
|
||||
" AND \"last_name\" = 'LookupLast'",
|
||||
@ -1463,12 +1463,18 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:data.id}}'",
|
||||
" OR (\"first_name\" = 'LookupFirst'",
|
||||
"UNION SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" (\"first_name\" = 'LookupFirst'",
|
||||
" AND \"last_name\" = 'LookupLast'",
|
||||
" AND \"date_of_birth\" = '{{timestamp}}'",
|
||||
" AND \"pronouns\" = 'they/them'))"
|
||||
@ -1616,12 +1622,18 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:data.id}}'",
|
||||
" OR (\"first_name\" = 'LookupFirst'",
|
||||
"UNION SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" (\"first_name\" = 'LookupFirst'",
|
||||
" AND \"last_name\" = 'LookupLast'",
|
||||
" AND \"date_of_birth\" = '{{timestamp}}'",
|
||||
" AND \"pronouns\" = 'they/them'))"
|
||||
@ -1759,9 +1771,9 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:mocks.0.id}}')"
|
||||
],
|
||||
@ -1882,9 +1894,9 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '123')"
|
||||
],
|
||||
@ -2221,10 +2233,14 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"order\" t2 ON ",
|
||||
"LEFT JOIN agreego.\"order\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = 'abc'",
|
||||
" OR (\"id\" = 'abc'))"
|
||||
"UNION SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"LEFT JOIN agreego.\"order\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" (\"id\" = 'abc'))"
|
||||
],
|
||||
[
|
||||
"INSERT INTO agreego.\"entity\" (",
|
||||
@ -3024,9 +3040,9 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) || to_jsonb(t3.*) || to_jsonb(t4.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"organization\" t2 ON ",
|
||||
"JOIN agreego.\"user\" t3 ON ",
|
||||
"JOIN agreego.\"person\" t4 ON ",
|
||||
"LEFT JOIN agreego.\"organization\" t2 ON t2.id = t1.id",
|
||||
"LEFT JOIN agreego.\"user\" t3 ON t3.id = t1.id",
|
||||
"LEFT JOIN agreego.\"person\" t4 ON t4.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = 'abc-archived')"
|
||||
],
|
||||
@ -3377,7 +3393,7 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"order_line\" t2 ON ",
|
||||
"LEFT JOIN agreego.\"order_line\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:data.lines.0.id}}')"
|
||||
],
|
||||
@ -3501,10 +3517,14 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"invoice\" t2 ON ",
|
||||
"LEFT JOIN agreego.\"invoice\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:data.id}}'",
|
||||
" OR (\"id\" = '{{uuid:data.id}}'))"
|
||||
"UNION SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"LEFT JOIN agreego.\"invoice\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" (\"id\" = '{{uuid:data.id}}'))"
|
||||
],
|
||||
[
|
||||
"INSERT INTO agreego.\"entity\" (",
|
||||
@ -3618,7 +3638,7 @@
|
||||
[
|
||||
"(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)",
|
||||
"FROM agreego.\"entity\" t1",
|
||||
"JOIN agreego.\"account\" t2 ON ",
|
||||
"LEFT JOIN agreego.\"account\" t2 ON t2.id = t1.id",
|
||||
"WHERE",
|
||||
" t1.id = '{{uuid:data.id}}')"
|
||||
],
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -91,8 +91,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -218,8 +218,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "2",
|
||||
"count": "1"
|
||||
"count": "1",
|
||||
"limit": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -357,8 +357,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "0",
|
||||
"limit": "2"
|
||||
"limit": "2",
|
||||
"count": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -381,8 +381,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "2",
|
||||
"count": "1"
|
||||
"count": "1",
|
||||
"limit": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -407,8 +407,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "2",
|
||||
"count": "3"
|
||||
"count": "3",
|
||||
"limit": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -463,8 +463,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "0",
|
||||
"limit": "3"
|
||||
"limit": "3",
|
||||
"count": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -487,8 +487,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "1",
|
||||
"limit": "3"
|
||||
"limit": "3",
|
||||
"count": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -513,8 +513,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "3",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -538,8 +538,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "3",
|
||||
"count": "2"
|
||||
"count": "2",
|
||||
"limit": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -549,8 +549,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "2"
|
||||
"count": "2",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -657,8 +657,8 @@
|
||||
{
|
||||
"code": "CONTAINS_VIOLATED",
|
||||
"values": {
|
||||
"count": "2",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "2"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -48,8 +48,8 @@
|
||||
{
|
||||
"code": "MIN_ITEMS_VIOLATED",
|
||||
"values": {
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -108,8 +108,8 @@
|
||||
{
|
||||
"code": "MIN_ITEMS_VIOLATED",
|
||||
"values": {
|
||||
"count": "0",
|
||||
"limit": "1"
|
||||
"limit": "1",
|
||||
"count": "0"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -43,8 +43,8 @@
|
||||
{
|
||||
"code": "MINIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "0.6",
|
||||
"limit": "1.1"
|
||||
"limit": "1.1",
|
||||
"value": "0.6"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -127,8 +127,8 @@
|
||||
{
|
||||
"code": "MINIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "-2.0001",
|
||||
"limit": "-2"
|
||||
"limit": "-2",
|
||||
"value": "-2.0001"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -100,8 +100,8 @@
|
||||
{
|
||||
"code": "MULTIPLE_OF_VIOLATED",
|
||||
"values": {
|
||||
"multiple_of": "1.5",
|
||||
"value": "35"
|
||||
"value": "35",
|
||||
"multiple_of": "1.5"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -148,8 +148,8 @@
|
||||
{
|
||||
"code": "MULTIPLE_OF_VIOLATED",
|
||||
"values": {
|
||||
"value": "0.00751",
|
||||
"multiple_of": "0.0001"
|
||||
"multiple_of": "0.0001",
|
||||
"value": "0.00751"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -156,8 +156,8 @@
|
||||
{
|
||||
"code": "MAXIMUM_VIOLATED",
|
||||
"values": {
|
||||
"value": "60",
|
||||
"limit": "50"
|
||||
"limit": "50",
|
||||
"value": "60"
|
||||
},
|
||||
"details": {
|
||||
"path": "max",
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
{
|
||||
"code": "PATTERN_VIOLATED",
|
||||
"values": {
|
||||
"pattern": "^a*$",
|
||||
"value": "abc"
|
||||
"value": "abc",
|
||||
"pattern": "^a*$"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -148,8 +148,8 @@
|
||||
{
|
||||
"code": "NO_FAMILY_MATCH",
|
||||
"values": {
|
||||
"discriminator": "type",
|
||||
"value": "alien"
|
||||
"value": "alien",
|
||||
"discriminator": "type"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -284,8 +284,8 @@
|
||||
{
|
||||
"code": "NO_FAMILY_MATCH",
|
||||
"values": {
|
||||
"discriminator": "type",
|
||||
"value": "bot"
|
||||
"value": "bot",
|
||||
"discriminator": "type"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
@ -43,8 +43,8 @@
|
||||
{
|
||||
"code": "MAX_LENGTH_VIOLATED",
|
||||
"values": {
|
||||
"limit": "3",
|
||||
"count": "6"
|
||||
"count": "6",
|
||||
"limit": "3"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
@ -431,8 +431,8 @@
|
||||
{
|
||||
"code": "MAX_LENGTH_VIOLATED",
|
||||
"values": {
|
||||
"count": "6",
|
||||
"limit": "3"
|
||||
"limit": "3",
|
||||
"count": "6"
|
||||
},
|
||||
"details": {
|
||||
"path": "",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -139,8 +139,8 @@
|
||||
{
|
||||
"code": "MAX_LENGTH_VIOLATED",
|
||||
"values": {
|
||||
"count": "26",
|
||||
"limit": "5"
|
||||
"limit": "5",
|
||||
"count": "26"
|
||||
},
|
||||
"details": {
|
||||
"path": "email",
|
||||
|
||||
2
flows
2
flows
Submodule flows updated: 0d9bd8644e...89748a246e
@ -165,16 +165,12 @@ impl Schema {
|
||||
} else if db.enums.contains_key(custom) {
|
||||
Some(vec![format!("{}.condition", custom)])
|
||||
} else {
|
||||
// A named type gets a reference to its dynamically built .filter — either a
|
||||
// Relational cross-boundary (table-backed) or a named value type, whose filter
|
||||
// is likewise synthesized (see Database::compile_filters). A named type with no
|
||||
// compilable structure gets no filter — omit it rather than dangle a reference.
|
||||
// Only a Table-Backed boundary has a synthesized Composed Filter to proxy to.
|
||||
// A Field-Backed JSONB Bubble has none — omit it like an inline object rather
|
||||
// than emit a dangling proxy reference, which breaks eager consumers of the
|
||||
// exported registry (downstream code generators).
|
||||
let base = custom.split('.').next_back().unwrap_or(custom);
|
||||
let has_value_filter = db
|
||||
.schemas
|
||||
.get(custom)
|
||||
.map_or(false, |s| Database::is_value_filter_candidate(custom, s));
|
||||
if db.types.contains_key(base) || has_value_filter {
|
||||
if db.types.contains_key(base) {
|
||||
Some(vec![format!("{}.filter", custom)])
|
||||
} else {
|
||||
None
|
||||
|
||||
@ -262,23 +262,15 @@ impl Database {
|
||||
}
|
||||
}
|
||||
|
||||
/// Synthesizes Composed Filter References for all table-backed boundaries — and for
|
||||
/// named non-table value types (schema-only objects, e.g. an operating-hours config),
|
||||
/// so a property reference resolves to ONE named filter instead of inlining anonymous
|
||||
/// per-path copies (which duplicate identical leaf type names for downstream codegen).
|
||||
/// Synthesizes Composed Filter References for all table-backed boundaries.
|
||||
fn compile_filters(&mut self, errors: &mut Vec<crate::drop::Error>) -> Vec<(String, String)> {
|
||||
let mut filter_schemas = Vec::new();
|
||||
let mut seen_value_ids = std::collections::HashSet::new();
|
||||
for (type_name, type_def) in &self.types {
|
||||
for (id, schema_arc) in &type_def.schemas {
|
||||
// Run synthesis on structured table-backed boundaries and named value types.
|
||||
// Exclude subschemas!
|
||||
// Only run synthesis on actual structured, table-backed boundaries. Exclude subschemas!
|
||||
let base_name = id.split('.').last().unwrap_or(id);
|
||||
let is_table_backed = base_name == type_def.name;
|
||||
let is_value_type = !is_table_backed
|
||||
&& Self::is_value_filter_candidate(id, schema_arc)
|
||||
&& seen_value_ids.insert(id.clone());
|
||||
if (is_table_backed || is_value_type) && !id.contains('/') {
|
||||
if is_table_backed && !id.contains('/') {
|
||||
if let Some(filter_schema) = schema_arc.compile_filter(self, id, errors) {
|
||||
filter_schemas.push((
|
||||
type_name.clone(),
|
||||
@ -301,20 +293,6 @@ impl Database {
|
||||
filter_ids
|
||||
}
|
||||
|
||||
/// A named non-table value type that earns its own synthesized filter: a bare-named
|
||||
/// (dotless) schema-only object with compiled properties. The base `filter`/`condition`
|
||||
/// schemas are infrastructure, not value types.
|
||||
pub fn is_value_filter_candidate(id: &str, schema: &Arc<Schema>) -> bool {
|
||||
!id.contains('.')
|
||||
&& id != "filter"
|
||||
&& id != "condition"
|
||||
&& schema
|
||||
.obj
|
||||
.compiled_properties
|
||||
.get()
|
||||
.map_or(false, |props| !props.is_empty())
|
||||
}
|
||||
|
||||
/// Synthesizes strong Enum Conditions mirroring the string.condition capabilities.
|
||||
fn compile_conditions(&mut self) -> Vec<(String, String)> {
|
||||
let mut enum_conditions = Vec::new();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
use crate::database::action::Action;
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
#[serde(default)]
|
||||
@ -13,6 +14,11 @@ pub struct Page {
|
||||
pub sidebar: Option<Sidebar>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub actions: Option<IndexMap<String, Action>>,
|
||||
/// The personal-scope filter template ("one surface, two scopes"): the
|
||||
/// "mine" predicate the page merges into its filter when the app is in
|
||||
/// personal scope, e.g. {"reserved_by": "$me"}. Opaque to the engine.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub personal: Option<Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
|
||||
@ -744,9 +744,15 @@ impl Merger {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let where_clause = format!("WHERE {}", where_parts.join(" OR "));
|
||||
|
||||
let final_sql = format!("{} {}", fetch_sql_template, where_clause);
|
||||
let final_sql = if where_parts.len() == 1 {
|
||||
format!("{} WHERE {}", fetch_sql_template, where_parts[0])
|
||||
} else {
|
||||
where_parts
|
||||
.iter()
|
||||
.map(|p| format!("{} WHERE {}", fetch_sql_template, p))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" UNION ")
|
||||
};
|
||||
|
||||
let fetched = match self.db.query(&final_sql, None) {
|
||||
Ok(Value::Array(table)) => {
|
||||
|
||||
@ -234,7 +234,17 @@ impl<'a> Compiler<'a> {
|
||||
let where_clauses = self.compile_where_clause(r#type, &table_aliases, node)?;
|
||||
|
||||
let selection = if is_array {
|
||||
format!("COALESCE(jsonb_agg({}), '[]'::jsonb)", jsonb_obj_sql)
|
||||
// Deterministic order: aggregation over an unordered heap made result
|
||||
// order vary run-to-run (flaky reads, unstable grids). Creation order
|
||||
// with id as the tiebreaker; the entity alias exists for every
|
||||
// entity-family type.
|
||||
match table_aliases.get("entity") {
|
||||
Some(entity_alias) => format!(
|
||||
"COALESCE(jsonb_agg({} ORDER BY {}.created_at, {}.id), '[]'::jsonb)",
|
||||
jsonb_obj_sql, entity_alias, entity_alias
|
||||
),
|
||||
None => format!("COALESCE(jsonb_agg({}), '[]'::jsonb)", jsonb_obj_sql),
|
||||
}
|
||||
} else {
|
||||
jsonb_obj_sql
|
||||
};
|
||||
@ -549,7 +559,7 @@ impl<'a> Compiler<'a> {
|
||||
where_clauses.push(format!("NOT {}.archived", entity_alias));
|
||||
}
|
||||
|
||||
self.compile_filter_conditions(r#type, type_aliases, &node, &base_alias, &mut where_clauses);
|
||||
self.compile_filter_conditions(r#type, type_aliases, &node, &base_alias, &mut where_clauses)?;
|
||||
self.compile_polymorphic_bounds(r#type, type_aliases, &node, &mut where_clauses);
|
||||
|
||||
let start_len = where_clauses.len();
|
||||
@ -689,6 +699,11 @@ impl<'a> Compiler<'a> {
|
||||
|| pg_type.contains("int")
|
||||
|| pg_type == "real"
|
||||
|| pg_type == "double precision"
|
||||
// pg catalog typnames for real / double precision — the SQL
|
||||
// names above never appear in field_types (they come from
|
||||
// pg_type.typname), so these are what actually arrives
|
||||
|| pg_type == "float4"
|
||||
|| pg_type == "float8"
|
||||
{
|
||||
cast = "::numeric";
|
||||
} else if pg_type == "text" || pg_type.contains("char") {
|
||||
@ -715,7 +730,7 @@ impl<'a> Compiler<'a> {
|
||||
node: &Node,
|
||||
base_alias: &str,
|
||||
where_clauses: &mut Vec<String>,
|
||||
) {
|
||||
) -> Result<(), String> {
|
||||
for (i, filter_key) in self.filter_keys.iter().enumerate() {
|
||||
let mut parts = filter_key.split(':');
|
||||
let full_field_path = parts.next().unwrap_or(filter_key);
|
||||
@ -745,6 +760,95 @@ impl<'a> Compiler<'a> {
|
||||
let param_index = i + 1;
|
||||
let p_val = format!("${}#>>'{{}}'", param_index);
|
||||
|
||||
// jsonb columns never type-check against the text parameter, and for
|
||||
// array-valued properties (tag lists) the meaning of a condition is
|
||||
// CONTAINMENT, not equality. Compile them explicitly; reject the rest
|
||||
// loudly at compile time instead of failing at execution.
|
||||
let is_jsonb = r#type
|
||||
.field_types
|
||||
.as_ref()
|
||||
.and_then(|v| v.as_object())
|
||||
.and_then(|ft| ft.get(field_name))
|
||||
.and_then(|v| v.as_str())
|
||||
== Some("jsonb");
|
||||
if is_jsonb {
|
||||
// The node schema may be a punc-response proxy without properties —
|
||||
// fall back to the type's own schema. Compiled schemas normalize to
|
||||
// the list form ("type": ["array"]), hand-written ones may use the
|
||||
// single form — accept both.
|
||||
let prop_schema = node
|
||||
.schema
|
||||
.obj
|
||||
.properties
|
||||
.as_ref()
|
||||
.and_then(|p| p.get(field_name))
|
||||
.cloned()
|
||||
.or_else(|| {
|
||||
r#type
|
||||
.schemas
|
||||
.get(&r#type.name)
|
||||
.and_then(|s| s.obj.properties.as_ref())
|
||||
.and_then(|p| p.get(field_name))
|
||||
.cloned()
|
||||
});
|
||||
let is_array_prop = prop_schema
|
||||
.map(|ps| match &ps.obj.type_ {
|
||||
Some(crate::database::object::SchemaTypeOrArray::Single(t)) => t == "array",
|
||||
Some(crate::database::object::SchemaTypeOrArray::Multiple(ts)) => {
|
||||
ts.iter().any(|t| t == "array") && ts.iter().all(|t| t == "array" || t == "null")
|
||||
}
|
||||
None => false,
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
if is_array_prop {
|
||||
match op {
|
||||
// "the array contains this value"
|
||||
"$eq" => where_clauses.push(format!(
|
||||
"{}.{} ? ({})",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
"$ne" => where_clauses.push(format!(
|
||||
"NOT ({}.{} ? ({}))",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
// "the array contains ANY of these values"
|
||||
"$of" => where_clauses.push(format!(
|
||||
"{}.{} ?| ARRAY(SELECT jsonb_array_elements_text(({})::jsonb))",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
"$nof" => where_clauses.push(format!(
|
||||
"NOT ({}.{} ?| ARRAY(SELECT jsonb_array_elements_text(({})::jsonb)))",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
other => {
|
||||
return Err(format!(
|
||||
"operator {} is not supported on array property '{}' (jsonb containment supports $eq/$ne/$of/$nof)",
|
||||
other, field_name
|
||||
))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
match op {
|
||||
"$eq" => where_clauses.push(format!(
|
||||
"{}.{} = ({})::jsonb",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
"$ne" => where_clauses.push(format!(
|
||||
"{}.{} != ({})::jsonb",
|
||||
filter_alias, field_name, p_val
|
||||
)),
|
||||
other => {
|
||||
return Err(format!(
|
||||
"operator {} is not supported on jsonb property '{}' (only $eq/$ne)",
|
||||
other, field_name
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if op == "$of" || op == "$nof" {
|
||||
let sql_op = if op == "$of" { "IN" } else { "NOT IN" };
|
||||
let subquery = format!(
|
||||
@ -796,6 +900,7 @@ impl<'a> Compiler<'a> {
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compile_relation_conditions(
|
||||
|
||||
@ -1301,6 +1301,18 @@ fn test_queryer_0_15() {
|
||||
crate::tests::runner::run_test_case(&path, 0, 15).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_queryer_0_16() {
|
||||
let path = format!("{}/fixtures/queryer.json", env!("CARGO_MANIFEST_DIR"));
|
||||
crate::tests::runner::run_test_case(&path, 0, 16).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_queryer_0_17() {
|
||||
let path = format!("{}/fixtures/queryer.json", env!("CARGO_MANIFEST_DIR"));
|
||||
crate::tests::runner::run_test_case(&path, 0, 17).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_polymorphism_0_0() {
|
||||
let path = format!("{}/fixtures/polymorphism.json", env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
@ -179,14 +179,35 @@ impl SqlFormatter {
|
||||
}
|
||||
|
||||
fn format_query(&mut self, query: &Query) {
|
||||
match &*query.body {
|
||||
self.format_set_expr(&query.body);
|
||||
}
|
||||
|
||||
fn format_set_expr(&mut self, set_expr: &SetExpr) {
|
||||
match set_expr {
|
||||
SetExpr::Select(select) => self.format_select(select),
|
||||
SetExpr::Query(inner_query) => {
|
||||
self.push_str("(");
|
||||
self.format_query(inner_query);
|
||||
self.push_str(")");
|
||||
}
|
||||
_ => self.push_str(&query.to_string()),
|
||||
SetExpr::SetOperation { op, left, right, set_quantifier } => {
|
||||
self.format_set_expr(left);
|
||||
let op_str = match op {
|
||||
sqlparser::ast::SetOperator::Union => "UNION",
|
||||
sqlparser::ast::SetOperator::Intersect => "INTERSECT",
|
||||
sqlparser::ast::SetOperator::Except => "EXCEPT",
|
||||
_ => "UNION",
|
||||
};
|
||||
let quant_str = match set_quantifier {
|
||||
sqlparser::ast::SetQuantifier::All => " ALL",
|
||||
sqlparser::ast::SetQuantifier::Distinct => " DISTINCT",
|
||||
sqlparser::ast::SetQuantifier::None => "",
|
||||
_ => "",
|
||||
};
|
||||
self.push_line(&format!("{}{} ", op_str, quant_str));
|
||||
self.format_set_expr(right);
|
||||
}
|
||||
_ => self.push_str(&set_expr.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,20 +257,22 @@ impl SqlFormatter {
|
||||
}
|
||||
|
||||
fn format_join(&mut self, join: &Join) {
|
||||
let op = match &join.join_operator {
|
||||
let op_str = match &join.join_operator {
|
||||
JoinOperator::Inner(_) => "JOIN",
|
||||
JoinOperator::LeftOuter(_) => "LEFT JOIN",
|
||||
JoinOperator::Left(_) => "LEFT JOIN",
|
||||
JoinOperator::Right(_) => "RIGHT JOIN",
|
||||
_ => "JOIN",
|
||||
};
|
||||
self.push_str(&format!("{} {} ON ", op, join.relation));
|
||||
self.push_str(&format!("{} {}", op_str, join.relation));
|
||||
|
||||
match &join.join_operator {
|
||||
JoinOperator::Inner(JoinConstraint::On(expr)) => self.format_expr(expr),
|
||||
JoinOperator::LeftOuter(JoinConstraint::On(expr)) => self.format_expr(expr),
|
||||
JoinOperator::Join(JoinConstraint::On(expr)) => self.format_expr(expr),
|
||||
_ => {
|
||||
println!("FALLBACK JOIN OP: {:?}", join.join_operator);
|
||||
JoinOperator::Inner(JoinConstraint::On(expr))
|
||||
| JoinOperator::Left(JoinConstraint::On(expr))
|
||||
| JoinOperator::Right(JoinConstraint::On(expr)) => {
|
||||
self.push_str(" ON ");
|
||||
self.format_expr(expr);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,6 +389,7 @@ impl SqlFormatter {
|
||||
i += 2;
|
||||
}
|
||||
self.indent -= 2;
|
||||
self.format_function_clauses(list);
|
||||
self.push_line(")");
|
||||
} else {
|
||||
for (i, arg) in list.args.iter().enumerate() {
|
||||
@ -373,6 +397,7 @@ impl SqlFormatter {
|
||||
self.format_function_arg(arg);
|
||||
self.push_str(comma);
|
||||
}
|
||||
self.format_function_clauses(list);
|
||||
self.push_str(")");
|
||||
}
|
||||
} else {
|
||||
@ -380,6 +405,25 @@ impl SqlFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
// Aggregate clauses (e.g. jsonb_agg(x ORDER BY y)) — without this the
|
||||
// snapshot silently drops the ORDER BY the compiler emits.
|
||||
fn format_function_clauses(&mut self, list: &sqlparser::ast::FunctionArgumentList) {
|
||||
for clause in &list.clauses {
|
||||
if let sqlparser::ast::FunctionArgumentClause::OrderBy(order) = clause {
|
||||
self.push_str(" ORDER BY ");
|
||||
for (i, ob) in order.iter().enumerate() {
|
||||
if i > 0 {
|
||||
self.push_str(", ");
|
||||
}
|
||||
self.format_expr(&ob.expr);
|
||||
if let Some(asc) = ob.options.asc {
|
||||
self.push_str(if asc { " ASC" } else { " DESC" });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn format_function_arg(&mut self, arg: &FunctionArg) {
|
||||
match arg {
|
||||
FunctionArg::Unnamed(sqlparser::ast::FunctionArgExpr::Expr(expr)) => self.format_expr(expr),
|
||||
|
||||
Reference in New Issue
Block a user