diff --git a/fixtures/contains.json b/fixtures/contains.json index 0125fe0..f330613 100644 --- a/fixtures/contains.json +++ b/fixtures/contains.json @@ -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", diff --git a/fixtures/database.json b/fixtures/database.json index 03a9184..e90ae91 100644 --- a/fixtures/database.json +++ b/fixtures/database.json @@ -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" diff --git a/fixtures/dependencies.json b/fixtures/dependencies.json index a52022f..0fb32ad 100644 --- a/fixtures/dependencies.json +++ b/fixtures/dependencies.json @@ -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": "", diff --git a/fixtures/dict.json b/fixtures/dict.json index 1de127e..2a7fd03 100644 --- a/fixtures/dict.json +++ b/fixtures/dict.json @@ -128,8 +128,8 @@ { "code": "PATTERN_VIOLATED", "values": { - "value": "abcd", - "pattern": "^[a-z]{3}$" + "pattern": "^[a-z]{3}$", + "value": "abcd" }, "details": { "path": "keys/abcd", diff --git a/fixtures/exclusiveMaximum.json b/fixtures/exclusiveMaximum.json index eff6122..ad236d9 100644 --- a/fixtures/exclusiveMaximum.json +++ b/fixtures/exclusiveMaximum.json @@ -56,8 +56,8 @@ { "code": "EXCLUSIVE_MAXIMUM_VIOLATED", "values": { - "limit": "3", - "value": "3.5" + "value": "3.5", + "limit": "3" }, "details": { "path": "", diff --git a/fixtures/exclusiveMinimum.json b/fixtures/exclusiveMinimum.json index fc49d5e..159374e 100644 --- a/fixtures/exclusiveMinimum.json +++ b/fixtures/exclusiveMinimum.json @@ -34,8 +34,8 @@ { "code": "EXCLUSIVE_MINIMUM_VIOLATED", "values": { - "value": "1.1", - "limit": "1.1" + "limit": "1.1", + "value": "1.1" }, "details": { "path": "", diff --git a/fixtures/filter.json b/fixtures/filter.json index 745f703..5ce1415 100644 --- a/fixtures/filter.json +++ b/fixtures/filter.json @@ -87,34 +87,6 @@ "type": "string" } } - }, - "schedule": { - "type": [ - "opening_hours", - "null" - ] - } - } - }, - "season": { - "type": "object", - "properties": { - "label": { - "type": "string" - } - } - }, - "opening_hours": { - "type": "object", - "properties": { - "open": { - "type": "string" - }, - "seasons": { - "type": "array", - "items": { - "type": "season" - } } } } @@ -290,7 +262,6 @@ "uuid_field", "tags", "ad_hoc", - "schedule", "$and", "$or" ], @@ -306,7 +277,6 @@ "uuid_field", "tags", "ad_hoc", - "schedule", "$and", "$or" ], @@ -328,7 +298,6 @@ "uuid_field", "tags", "ad_hoc", - "schedule", "$and", "$or" ], @@ -397,12 +366,6 @@ "string.condition", "null" ] - }, - "schedule": { - "type": [ - "opening_hours.filter", - "null" - ] } }, "type": "filter" @@ -520,66 +483,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": {} + } } } } ] } -] +] \ No newline at end of file diff --git a/fixtures/format.json b/fixtures/format.json index 44a202d..a87daa5 100644 --- a/fixtures/format.json +++ b/fixtures/format.json @@ -155,8 +155,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date-time", - "error": "invalid time element: invalid leap second" + "error": "invalid time element: invalid leap second", + "format": "date-time" }, "details": { "path": "", @@ -177,8 +177,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date-time", - "error": "invalid time element: invalid leap second" + "error": "invalid time element: invalid leap second", + "format": "date-time" }, "details": { "path": "", @@ -199,8 +199,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid date element: february has 28 days only", - "format": "date-time" + "format": "date-time", + "error": "invalid date element: february has 28 days only" }, "details": { "path": "", @@ -243,8 +243,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid time element: offset must be 6 characters long", - "format": "date-time" + "format": "date-time", + "error": "invalid time element: offset must be 6 characters long" }, "details": { "path": "", @@ -296,8 +296,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "less than 20 characters long", - "format": "date-time" + "format": "date-time", + "error": "less than 20 characters long" }, "details": { "path": "", @@ -340,8 +340,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "11th character must be t or T", - "format": "date-time" + "format": "date-time", + "error": "11th character must be t or T" }, "details": { "path": "", @@ -406,8 +406,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "11th character must be t or T", - "format": "date-time" + "format": "date-time", + "error": "11th character must be t or T" }, "details": { "path": "", @@ -579,8 +579,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "february has 29 days only", - "format": "date" + "format": "date", + "error": "february has 29 days only" }, "details": { "path": "", @@ -610,8 +610,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "32 days in month" + "error": "32 days in month", + "format": "date" }, "details": { "path": "", @@ -641,8 +641,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "month has 30 days only", - "format": "date" + "format": "date", + "error": "month has 30 days only" }, "details": { "path": "", @@ -703,8 +703,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "month has 30 days only" + "error": "month has 30 days only", + "format": "date" }, "details": { "path": "", @@ -765,8 +765,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "32 days in month" + "error": "32 days in month", + "format": "date" }, "details": { "path": "", @@ -796,8 +796,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "month has 30 days only" + "error": "month has 30 days only", + "format": "date" }, "details": { "path": "", @@ -827,8 +827,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "32 days in month" + "error": "32 days in month", + "format": "date" }, "details": { "path": "", @@ -858,8 +858,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "month has 30 days only" + "error": "month has 30 days only", + "format": "date" }, "details": { "path": "", @@ -911,8 +911,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "13 months in year", - "format": "date" + "format": "date", + "error": "13 months in year" }, "details": { "path": "", @@ -933,8 +933,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "missing hyphen in correct place" + "error": "missing hyphen in correct place", + "format": "date" }, "details": { "path": "", @@ -955,8 +955,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "must be 10 characters long" + "error": "must be 10 characters long", + "format": "date" }, "details": { "path": "", @@ -1206,8 +1206,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "date", - "error": "must be 10 characters long" + "error": "must be 10 characters long", + "format": "date" }, "details": { "path": "", @@ -1330,8 +1330,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "duration", - "error": "must start with P" + "error": "must start with P", + "format": "duration" }, "details": { "path": "", @@ -1374,8 +1374,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "duration", - "error": "no time elements" + "error": "no time elements", + "format": "duration" }, "details": { "path": "", @@ -1462,8 +1462,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "duration", - "error": "invalid unit S" + "error": "invalid unit S", + "format": "duration" }, "details": { "path": "", @@ -1578,8 +1578,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing number", - "format": "duration" + "format": "duration", + "error": "missing number" }, "details": { "path": "", @@ -1822,8 +1822,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "starts with dot", - "format": "email" + "format": "email", + "error": "starts with dot" }, "details": { "path": "", @@ -1941,8 +1941,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "email", - "error": "invalid character '@'" + "error": "invalid character '@'", + "format": "email" }, "details": { "path": "", @@ -2110,8 +2110,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "label must be 1 to 63 characters long", - "format": "hostname" + "format": "hostname", + "error": "label must be 1 to 63 characters long" }, "details": { "path": "", @@ -2132,8 +2132,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "label must be 1 to 63 characters long" + "error": "label must be 1 to 63 characters long", + "format": "hostname" }, "details": { "path": "", @@ -2176,8 +2176,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid character '.'" + "error": "invalid character '.'", + "format": "hostname" }, "details": { "path": "", @@ -2207,8 +2207,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "label starts with hyphen" + "error": "label starts with hyphen", + "format": "hostname" }, "details": { "path": "", @@ -2229,8 +2229,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "label ends with hyphen" + "error": "label ends with hyphen", + "format": "hostname" }, "details": { "path": "", @@ -2252,8 +2252,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "label has -- in 3rd/4th position but does not start with xn--" + "error": "label has -- in 3rd/4th position but does not start with xn--", + "format": "hostname" }, "details": { "path": "", @@ -2296,8 +2296,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "more than 253 characters long", - "format": "hostname" + "format": "hostname", + "error": "more than 253 characters long" }, "details": { "path": "", @@ -2444,8 +2444,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode" + "error": "invalid punycode", + "format": "hostname" }, "details": { "path": "", @@ -2467,8 +2467,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -2510,8 +2510,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: contains disallowed character", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: contains disallowed character" }, "details": { "path": "", @@ -2602,8 +2602,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only" + "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only", + "format": "hostname" }, "details": { "path": "", @@ -2625,8 +2625,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only" + "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only", + "format": "hostname" }, "details": { "path": "", @@ -2658,8 +2658,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode/IDN: Greek KERAIA must be followed by Greek character" + "error": "invalid punycode/IDN: Greek KERAIA must be followed by Greek character", + "format": "hostname" }, "details": { "path": "", @@ -2681,8 +2681,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: Greek KERAIA must be followed by Greek character", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: Greek KERAIA must be followed by Greek character" }, "details": { "path": "", @@ -2737,8 +2737,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode/IDN: Hebrew GERESH must be preceded by Hebrew character" + "error": "invalid punycode/IDN: Hebrew GERESH must be preceded by Hebrew character", + "format": "hostname" }, "details": { "path": "", @@ -2849,8 +2849,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" + "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", + "format": "hostname" }, "details": { "path": "", @@ -2902,8 +2902,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "hostname", - "error": "invalid punycode" + "error": "invalid punycode", + "format": "hostname" }, "details": { "path": "", @@ -2945,8 +2945,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -2968,8 +2968,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -3100,8 +3100,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing @", - "format": "idn-email" + "format": "idn-email", + "error": "missing @" }, "details": { "path": "", @@ -3255,8 +3255,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "contains disallowed character" + "error": "contains disallowed character", + "format": "idn-hostname" }, "details": { "path": "", @@ -3300,8 +3300,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -3379,8 +3379,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3402,8 +3402,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -3425,8 +3425,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3448,8 +3448,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3494,8 +3494,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -3583,8 +3583,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "MIDDLE DOT is allowed between 'l' characters only" + "error": "MIDDLE DOT is allowed between 'l' characters only", + "format": "idn-hostname" }, "details": { "path": "", @@ -3652,8 +3652,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "MIDDLE DOT is allowed between 'l' characters only", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "MIDDLE DOT is allowed between 'l' characters only" }, "details": { "path": "", @@ -3685,8 +3685,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "Greek KERAIA must be followed by Greek character" + "error": "Greek KERAIA must be followed by Greek character", + "format": "idn-hostname" }, "details": { "path": "", @@ -3797,8 +3797,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -3853,8 +3853,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" + "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", + "format": "idn-hostname" }, "details": { "path": "", @@ -3876,8 +3876,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" + "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", + "format": "idn-hostname" }, "details": { "path": "", @@ -3929,8 +3929,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3995,8 +3995,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4124,8 +4124,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4146,8 +4146,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -4168,8 +4168,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4190,8 +4190,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -4270,8 +4270,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -4314,8 +4314,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -4358,8 +4358,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4380,8 +4380,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "idn-hostname", - "error": "idna error: Errors" + "error": "idna error: Errors", + "format": "idn-hostname" }, "details": { "path": "", @@ -4540,8 +4540,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv4", - "error": "invalid IPv4 address syntax" + "error": "invalid IPv4 address syntax", + "format": "ipv4" }, "details": { "path": "", @@ -4606,8 +4606,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv4", - "error": "invalid IPv4 address syntax" + "error": "invalid IPv4 address syntax", + "format": "ipv4" }, "details": { "path": "", @@ -4651,8 +4651,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4806,8 +4806,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -4930,8 +4930,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -4952,8 +4952,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5005,8 +5005,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5045,8 +5045,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5067,8 +5067,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5098,8 +5098,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5129,8 +5129,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5195,8 +5195,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5261,8 +5261,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5283,8 +5283,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5336,8 +5336,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5358,8 +5358,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5380,8 +5380,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "ipv6", - "error": "invalid IPv6 address syntax" + "error": "invalid IPv6 address syntax", + "format": "ipv6" }, "details": { "path": "", @@ -5500,8 +5500,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "iri-reference", - "error": "contains \\\\" + "error": "contains \\\\", + "format": "iri-reference" }, "details": { "path": "", @@ -5540,8 +5540,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "iri-reference", - "error": "contains \\\\" + "error": "contains \\\\", + "format": "iri-reference" }, "details": { "path": "", @@ -5678,8 +5678,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid port number", - "format": "iri" + "format": "iri", + "error": "invalid port number" }, "details": { "path": "", @@ -5700,8 +5700,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "relative url", - "format": "iri" + "format": "iri", + "error": "relative url" }, "details": { "path": "", @@ -5722,8 +5722,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "iri", - "error": "relative url" + "error": "relative url", + "format": "iri" }, "details": { "path": "", @@ -6061,8 +6061,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "not starting with slash", - "format": "json-pointer" + "format": "json-pointer", + "error": "not starting with slash" }, "details": { "path": "", @@ -6105,8 +6105,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "json-pointer", - "error": "~ must be followed by 0 or 1" + "error": "~ must be followed by 0 or 1", + "format": "json-pointer" }, "details": { "path": "", @@ -6237,8 +6237,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "not starting with slash", - "format": "json-pointer" + "format": "json-pointer", + "error": "not starting with slash" }, "details": { "path": "", @@ -6477,8 +6477,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "relative-json-pointer", - "error": "must start with non-negative integer" + "error": "must start with non-negative integer", + "format": "relative-json-pointer" }, "details": { "path": "", @@ -6499,8 +6499,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "must start with non-negative integer", - "format": "relative-json-pointer" + "format": "relative-json-pointer", + "error": "must start with non-negative integer" }, "details": { "path": "", @@ -6521,8 +6521,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "relative-json-pointer", - "error": "must start with non-negative integer" + "error": "must start with non-negative integer", + "format": "relative-json-pointer" }, "details": { "path": "", @@ -6565,8 +6565,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "starts with zero", - "format": "relative-json-pointer" + "format": "relative-json-pointer", + "error": "starts with zero" }, "details": { "path": "", @@ -6707,8 +6707,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "missing colon in correct place" + "error": "missing colon in correct place", + "format": "time" }, "details": { "path": "", @@ -6729,8 +6729,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "less than 9 characters long", - "format": "time" + "format": "time", + "error": "less than 9 characters long" }, "details": { "path": "", @@ -6751,8 +6751,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "missing colon in correct place" + "error": "missing colon in correct place", + "format": "time" }, "details": { "path": "", @@ -6835,8 +6835,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "invalid leap second" + "error": "invalid leap second", + "format": "time" }, "details": { "path": "", @@ -6857,8 +6857,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "invalid leap second" + "error": "invalid leap second", + "format": "time" }, "details": { "path": "", @@ -6897,8 +6897,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "invalid leap second" + "error": "invalid leap second", + "format": "time" }, "details": { "path": "", @@ -6959,8 +6959,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -6981,8 +6981,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "invalid leap second" + "error": "invalid leap second", + "format": "time" }, "details": { "path": "", @@ -7039,8 +7039,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing colon in offset at correct place", - "format": "time" + "format": "time", + "error": "missing colon in offset at correct place" }, "details": { "path": "", @@ -7070,8 +7070,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "hour/min/sec out of range", - "format": "time" + "format": "time", + "error": "hour/min/sec out of range" }, "details": { "path": "", @@ -7136,8 +7136,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "invalid leap second" + "error": "invalid leap second", + "format": "time" }, "details": { "path": "", @@ -7180,8 +7180,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "hour/min in offset out of range", - "format": "time" + "format": "time", + "error": "hour/min in offset out of range" }, "details": { "path": "", @@ -7268,8 +7268,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "offset must be 6 characters long" + "error": "offset must be 6 characters long", + "format": "time" }, "details": { "path": "", @@ -7334,8 +7334,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "time", - "error": "missing colon in correct place" + "error": "missing colon in correct place", + "format": "time" }, "details": { "path": "", @@ -7356,8 +7356,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "offset must begin with plus/minus", - "format": "time" + "format": "time", + "error": "offset must begin with plus/minus" }, "details": { "path": "", @@ -7400,8 +7400,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing colon in correct place", - "format": "time" + "format": "time", + "error": "missing colon in correct place" }, "details": { "path": "", @@ -7600,8 +7600,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 0", - "format": "uri-reference" + "format": "uri-reference", + "error": "unexpected character at index 0" }, "details": { "path": "", @@ -7640,8 +7640,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 5", - "format": "uri-reference" + "format": "uri-reference", + "error": "unexpected character at index 5" }, "details": { "path": "", @@ -7684,8 +7684,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uri-reference", - "error": "unexpected character at index 26" + "error": "unexpected character at index 26", + "format": "uri-reference" }, "details": { "path": "", @@ -8058,8 +8058,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 0", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 0" }, "details": { "path": "", @@ -8102,8 +8102,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 7", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 7" }, "details": { "path": "", @@ -8124,8 +8124,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uri", - "error": "unexpected character at index 0" + "error": "unexpected character at index 0", + "format": "uri" }, "details": { "path": "", @@ -8256,8 +8256,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uri", - "error": "unexpected character at index 26" + "error": "unexpected character at index 26", + "format": "uri" }, "details": { "path": "", @@ -8278,8 +8278,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 26", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 26" }, "details": { "path": "", @@ -8300,8 +8300,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 26", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 26" }, "details": { "path": "", @@ -8344,8 +8344,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uri", - "error": "unexpected character at index 23" + "error": "unexpected character at index 23", + "format": "uri" }, "details": { "path": "", @@ -8366,8 +8366,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uri", - "error": "unexpected character at index 26" + "error": "unexpected character at index 26", + "format": "uri" }, "details": { "path": "", @@ -8495,8 +8495,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "element 5 must be 12 characters long", - "format": "uuid" + "format": "uuid", + "error": "element 5 must be 12 characters long" }, "details": { "path": "", @@ -8517,8 +8517,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "element 4 must be 4 characters long", - "format": "uuid" + "format": "uuid", + "error": "element 4 must be 4 characters long" }, "details": { "path": "", @@ -8539,8 +8539,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uuid", - "error": "non-hex character 'g'" + "error": "non-hex character 'g'", + "format": "uuid" }, "details": { "path": "", @@ -8583,8 +8583,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "element 1 must be 8 characters long", - "format": "uuid" + "format": "uuid", + "error": "element 1 must be 8 characters long" }, "details": { "path": "", @@ -8627,8 +8627,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "format": "uuid", - "error": "element 1 must be 8 characters long" + "error": "element 1 must be 8 characters long", + "format": "uuid" }, "details": { "path": "", diff --git a/fixtures/maxContains.json b/fixtures/maxContains.json index 7bfe516..1c70fd3 100644 --- a/fixtures/maxContains.json +++ b/fixtures/maxContains.json @@ -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": "", diff --git a/fixtures/maxLength.json b/fixtures/maxLength.json index 800e762..29c5640 100644 --- a/fixtures/maxLength.json +++ b/fixtures/maxLength.json @@ -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": "", diff --git a/fixtures/maxProperties.json b/fixtures/maxProperties.json index afa641a..1741a29 100644 --- a/fixtures/maxProperties.json +++ b/fixtures/maxProperties.json @@ -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": "", diff --git a/fixtures/maximum.json b/fixtures/maximum.json index ac5a0a1..c99f981 100644 --- a/fixtures/maximum.json +++ b/fixtures/maximum.json @@ -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": "", diff --git a/fixtures/merge.json b/fixtures/merge.json index ef9f7b1..76dd3c8 100644 --- a/fixtures/merge.json +++ b/fixtures/merge.json @@ -264,8 +264,8 @@ { "code": "DEPENDENCY_MISSING", "values": { - "required_property": "child_dep", - "property_name": "trigger" + "property_name": "trigger", + "required_property": "child_dep" }, "details": { "path": "", diff --git a/fixtures/merger.json b/fixtures/merger.json index f2fd396..aabe9e1 100644 --- a/fixtures/merger.json +++ b/fixtures/merger.json @@ -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'", @@ -1320,17 +1320,62 @@ " AND \"pronouns\" = 'they/them'))" ], [ - "UPDATE agreego.\"entity\" SET", - " modified_at = '{{timestamp}}',", - " modified_by = '00000000-0000-0000-0000-000000000000'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"entity\" (", + " \"created_at\",", + " \"created_by\",", + " \"id\",", + " \"modified_at\",", + " \"modified_by\",", + " \"type\"", + ")", + "VALUES (", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " '{{uuid:generated_0}}',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'person'", + ")" ], [ - "UPDATE agreego.\"person\" SET", - " contact_id = 'abc-contact'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"organization\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:generated_0}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"user\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:generated_0}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"person\" (", + " \"contact_id\",", + " \"date_of_birth\",", + " \"first_name\",", + " \"id\",", + " \"last_name\",", + " \"pronouns\",", + " \"type\"", + ")", + "VALUES (", + " 'abc-contact',", + " '{{timestamp}}',", + " 'LookupFirst',", + " '{{uuid:generated_0}}',", + " 'LookupLast',", + " 'they/them',", + " 'person'", + ")" ], [ "INSERT INTO agreego.change (", @@ -1343,40 +1388,45 @@ " \"modified_by\"", ")", "VALUES (", + " NULL,", " '{", - " \"contact_id\": \"old-contact\"", - " }',", - " '{", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", " \"type\": \"person\"", " }',", - " '{{uuid:mocks.0.id}}',", " '{{uuid:generated_0}}',", - " 'update',", + " '{{uuid:generated_1}}',", + " 'create',", " '{{timestamp}}',", " '00000000-0000-0000-0000-000000000000'", ")" ], [ "(SELECT pg_notify('entity', '{", - " \"kind\": \"update\",", + " \"kind\": \"create\",", " \"complete\": {", - " \"id\": \"{{uuid:mocks.0.id}}\",", - " \"type\": \"person\",", " \"first_name\": \"LookupFirst\",", " \"last_name\": \"LookupLast\",", " \"date_of_birth\": \"{{timestamp}}\",", " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", + " \"id\": \"{{uuid:generated_0}}\",", + " \"type\": \"person\",", + " \"created_by\": \"00000000-0000-0000-0000-000000000000\",", + " \"created_at\": \"{{timestamp}}\",", " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", " \"modified_at\": \"{{timestamp}}\"", " },", " \"new\": {", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", " \"type\": \"person\"", - " },", - " \"old\": {", - " \"contact_id\": \"old-contact\"", " }", "}'))" ] @@ -1411,20 +1461,81 @@ "success": true, "sql": [ [ - "(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 t1.id = '{{uuid:data.id}}' 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'))" + "(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", + " t1.id = '{{uuid:data.id}}'", + "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'))" ], [ - "UPDATE agreego.\"entity\" SET", - " modified_at = '{{timestamp}}',", - " modified_by = '00000000-0000-0000-0000-000000000000'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"entity\" (", + " \"created_at\",", + " \"created_by\",", + " \"id\",", + " \"modified_at\",", + " \"modified_by\",", + " \"type\"", + ")", + "VALUES (", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " '{{uuid:data.id}}',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'person'", + ")" ], [ - "UPDATE agreego.\"person\" SET", - " contact_id = 'abc-contact'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"organization\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:data.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"user\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:data.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"person\" (", + " \"contact_id\",", + " \"date_of_birth\",", + " \"first_name\",", + " \"id\",", + " \"last_name\",", + " \"pronouns\",", + " \"type\"", + ")", + "VALUES (", + " 'abc-contact',", + " '{{timestamp}}',", + " 'LookupFirst',", + " '{{uuid:data.id}}',", + " 'LookupLast',", + " 'they/them',", + " 'person'", + ")" ], [ "INSERT INTO agreego.change (", @@ -1437,42 +1548,46 @@ " \"modified_by\"", ")", "VALUES (", + " NULL,", " '{", - " \"contact_id\": \"old-contact\"", - " }',", - " '{", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", " \"type\": \"person\"", " }',", - " '{{uuid:mocks.0.id}}',", + " '{{uuid:data.id}}',", " '{{uuid:generated_0}}',", - " 'update',", + " 'create',", " '{{timestamp}}',", " '00000000-0000-0000-0000-000000000000'", ")" ], [ "(SELECT pg_notify('entity', '{", - " \"kind\": \"update\",", + " \"kind\": \"create\",", " \"complete\": {", - " \"id\": \"{{uuid:mocks.0.id}}\",", - " \"type\": \"person\",", " \"first_name\": \"LookupFirst\",", " \"last_name\": \"LookupLast\",", " \"date_of_birth\": \"{{timestamp}}\",", " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", + " \"id\": \"{{uuid:data.id}}\",", + " \"type\": \"person\",", + " \"created_by\": \"00000000-0000-0000-0000-000000000000\",", + " \"created_at\": \"{{timestamp}}\",", " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", " \"modified_at\": \"{{timestamp}}\"", " },", " \"new\": {", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", " \"contact_id\": \"abc-contact\",", " \"type\": \"person\"", - " },", - " \"old\": {", - " \"contact_id\": \"old-contact\"", - " },", - " \"replaces\": \"{{uuid:data.id}}\"", + " }", "}'))" ] ] @@ -1505,26 +1620,128 @@ "success": true, "sql": [ [ - "(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 t1.id = '{{uuid:data.id}}' 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'))" + "(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", + " t1.id = '{{uuid:data.id}}'", + "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'))" ], [ - "(SELECT pg_notify('entity', '{", - " \"kind\": \"replace\",", - " \"complete\": {", - " \"id\": \"{{uuid:mocks.0.id}}\",", - " \"type\": \"person\",", + "INSERT INTO agreego.\"entity\" (", + " \"created_at\",", + " \"created_by\",", + " \"id\",", + " \"modified_at\",", + " \"modified_by\",", + " \"type\"", + ")", + "VALUES (", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " '{{uuid:data.id}}',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"organization\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:data.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"user\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:data.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"person\" (", + " \"date_of_birth\",", + " \"first_name\",", + " \"id\",", + " \"last_name\",", + " \"pronouns\",", + " \"type\"", + ")", + "VALUES (", + " '{{timestamp}}',", + " 'LookupFirst',", + " '{{uuid:data.id}}',", + " 'LookupLast',", + " 'they/them',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.change (", + " \"old\",", + " \"new\",", + " \"entity_id\",", + " \"id\",", + " \"kind\",", + " \"modified_at\",", + " \"modified_by\"", + ")", + "VALUES (", + " NULL,", + " '{", " \"first_name\": \"LookupFirst\",", " \"last_name\": \"LookupLast\",", " \"date_of_birth\": \"{{timestamp}}\",", " \"pronouns\": \"they/them\",", - " \"contact_id\": \"old-contact\",", + " \"type\": \"person\"", + " }',", + " '{{uuid:data.id}}',", + " '{{uuid:generated_0}}',", + " 'create',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000'", + ")" + ], + [ + "(SELECT pg_notify('entity', '{", + " \"kind\": \"create\",", + " \"complete\": {", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", + " \"id\": \"{{uuid:data.id}}\",", + " \"type\": \"person\",", + " \"created_by\": \"00000000-0000-0000-0000-000000000000\",", + " \"created_at\": \"{{timestamp}}\",", " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", " \"modified_at\": \"{{timestamp}}\"", " },", " \"new\": {", + " \"first_name\": \"LookupFirst\",", + " \"last_name\": \"LookupLast\",", + " \"date_of_birth\": \"{{timestamp}}\",", + " \"pronouns\": \"they/them\",", " \"type\": \"person\"", - " },", - " \"replaces\": \"{{uuid:data.id}}\"", + " }", "}'))" ] ] @@ -1554,25 +1771,63 @@ [ "(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}}')" ], [ - "UPDATE agreego.\"entity\" SET", - " modified_at = '{{timestamp}}',", - " modified_by = '00000000-0000-0000-0000-000000000000'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"entity\" (", + " \"created_at\",", + " \"created_by\",", + " \"id\",", + " \"modified_at\",", + " \"modified_by\",", + " \"type\"", + ")", + "VALUES (", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " '{{uuid:mocks.0.id}}',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'person'", + ")" ], [ - "UPDATE agreego.\"person\" SET", - " first_name = 'NewFirst',", - " last_name = 'NewLast'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" + "INSERT INTO agreego.\"organization\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:mocks.0.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"user\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " '{{uuid:mocks.0.id}}',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"person\" (", + " \"first_name\",", + " \"id\",", + " \"last_name\",", + " \"type\"", + ")", + "VALUES (", + " 'NewFirst',", + " '{{uuid:mocks.0.id}}',", + " 'NewLast',", + " 'person'", + ")" ], [ "INSERT INTO agreego.change (", @@ -1585,10 +1840,7 @@ " \"modified_by\"", ")", "VALUES (", - " '{", - " \"first_name\": \"OldFirst\",", - " \"last_name\": \"OldLast\"", - " }',", + " NULL,", " '{", " \"first_name\": \"NewFirst\",", " \"last_name\": \"NewLast\",", @@ -1596,19 +1848,21 @@ " }',", " '{{uuid:mocks.0.id}}',", " '{{uuid:generated_0}}',", - " 'update',", + " 'create',", " '{{timestamp}}',", " '00000000-0000-0000-0000-000000000000'", ")" ], [ "(SELECT pg_notify('entity', '{", - " \"kind\": \"update\",", + " \"kind\": \"create\",", " \"complete\": {", - " \"id\": \"{{uuid:mocks.0.id}}\",", - " \"type\": \"person\",", " \"first_name\": \"NewFirst\",", " \"last_name\": \"NewLast\",", + " \"id\": \"{{uuid:mocks.0.id}}\",", + " \"type\": \"person\",", + " \"created_by\": \"00000000-0000-0000-0000-000000000000\",", + " \"created_at\": \"{{timestamp}}\",", " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", " \"modified_at\": \"{{timestamp}}\"", " },", @@ -1616,10 +1870,6 @@ " \"first_name\": \"NewFirst\",", " \"last_name\": \"NewLast\",", " \"type\": \"person\"", - " },", - " \"old\": {", - " \"first_name\": \"OldFirst\",", - " \"last_name\": \"OldLast\"", " }", "}'))" ] @@ -1644,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')" ], @@ -1981,7 +2231,16 @@ "success": true, "sql": [ [ - "(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) FROM agreego.\"entity\" t1 LEFT JOIN agreego.\"order\" t2 ON t2.id = t1.id WHERE t1.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'))" + "(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)", + "FROM agreego.\"entity\" t1", + "LEFT JOIN agreego.\"order\" t2 ON t2.id = t1.id", + "WHERE", + " t1.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\" (", @@ -2781,19 +3040,61 @@ [ "(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')" ], [ - "UPDATE agreego.\"entity\" SET", - " archived = true,", - " modified_at = '{{timestamp}}',", - " modified_by = '00000000-0000-0000-0000-000000000000'", - "WHERE", - " id = 'abc-archived'" + "INSERT INTO agreego.\"entity\" (", + " \"archived\",", + " \"created_at\",", + " \"created_by\",", + " \"id\",", + " \"modified_at\",", + " \"modified_by\",", + " \"type\"", + ")", + "VALUES (", + " true,", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'abc-archived',", + " '{{timestamp}}',", + " '00000000-0000-0000-0000-000000000000',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"organization\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " 'abc-archived',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"user\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " 'abc-archived',", + " 'person'", + ")" + ], + [ + "INSERT INTO agreego.\"person\" (", + " \"id\",", + " \"type\"", + ")", + "VALUES (", + " 'abc-archived',", + " 'person'", + ")" ], [ "INSERT INTO agreego.change (", @@ -2806,38 +3107,33 @@ " \"modified_by\"", ")", "VALUES (", - " '{", - " \"archived\": false", - " }',", + " NULL,", " '{", " \"archived\": true,", " \"type\": \"person\"", " }',", " 'abc-archived',", " '{{uuid:generated_0}}',", - " 'delete',", + " 'create',", " '{{timestamp}}',", " '00000000-0000-0000-0000-000000000000'", ")" ], [ "(SELECT pg_notify('entity', '{", - " \"kind\": \"delete\",", + " \"kind\": \"create\",", " \"complete\": {", + " \"archived\": true,", " \"id\": \"abc-archived\",", " \"type\": \"person\",", - " \"first_name\": \"ArchivedFirst\",", - " \"last_name\": \"ArchivedLast\",", - " \"archived\": true,", + " \"created_by\": \"00000000-0000-0000-0000-000000000000\",", + " \"created_at\": \"{{timestamp}}\",", " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", " \"modified_at\": \"{{timestamp}}\"", " },", " \"new\": {", " \"archived\": true,", " \"type\": \"person\"", - " },", - " \"old\": {", - " \"archived\": false", " }", "}'))" ] @@ -3097,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}}')" ], @@ -3219,7 +3515,16 @@ "success": true, "sql": [ [ - "(SELECT to_jsonb(t1.*) || to_jsonb(t2.*) FROM agreego.\"entity\" t1 LEFT JOIN agreego.\"invoice\" t2 ON t2.id = t1.id WHERE t1.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}}'))" + "(SELECT to_jsonb(t1.*) || to_jsonb(t2.*)", + "FROM agreego.\"entity\" t1", + "LEFT JOIN agreego.\"invoice\" t2 ON t2.id = t1.id", + "WHERE", + " t1.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\" (", @@ -3333,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}}')" ], @@ -3772,143 +4077,6 @@ ] ] } - }, - { - "description": "Existence probes hit the same row via id and lookup key (dedup, updates)", - "action": "merge", - "data": { - "id": "22222222-2222-2222-2222-222222222222", - "type": "person", - "first_name": "LookupFirst", - "last_name": "LookupLast", - "date_of_birth": "1990-01-01T00:00:00Z", - "pronouns": "they/them", - "contact_id": "new-contact" - }, - "mocks": [ - { - "id": "22222222-2222-2222-2222-222222222222", - "type": "person", - "first_name": "LookupFirst", - "last_name": "LookupLast", - "date_of_birth": "1990-01-01T00:00:00Z", - "pronouns": "they/them", - "contact_id": "old-contact" - } - ], - "schema_id": "person", - "expect": { - "success": true, - "sql": [ - [ - "(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 t1.id = '{{uuid:mocks.0.id}}' 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'))" - ], - [ - "UPDATE agreego.\"entity\" SET", - " modified_at = '{{timestamp}}',", - " modified_by = '00000000-0000-0000-0000-000000000000'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" - ], - [ - "UPDATE agreego.\"person\" SET", - " contact_id = 'new-contact'", - "WHERE", - " id = '{{uuid:mocks.0.id}}'" - ], - [ - "INSERT INTO agreego.change (", - " \"old\",", - " \"new\",", - " \"entity_id\",", - " \"id\",", - " \"kind\",", - " \"modified_at\",", - " \"modified_by\"", - ")", - "VALUES (", - " '{", - " \"contact_id\": \"old-contact\"", - " }',", - " '{", - " \"contact_id\": \"new-contact\",", - " \"type\": \"person\"", - " }',", - " '{{uuid:mocks.0.id}}',", - " '{{uuid:generated_0}}',", - " 'update',", - " '{{timestamp}}',", - " '00000000-0000-0000-0000-000000000000'", - ")" - ], - [ - "(SELECT pg_notify('entity', '{", - " \"kind\": \"update\",", - " \"complete\": {", - " \"id\": \"{{uuid:mocks.0.id}}\",", - " \"type\": \"person\",", - " \"first_name\": \"LookupFirst\",", - " \"last_name\": \"LookupLast\",", - " \"date_of_birth\": \"{{timestamp}}\",", - " \"pronouns\": \"they/them\",", - " \"contact_id\": \"new-contact\",", - " \"modified_by\": \"00000000-0000-0000-0000-000000000000\",", - " \"modified_at\": \"{{timestamp}}\"", - " },", - " \"new\": {", - " \"contact_id\": \"new-contact\",", - " \"type\": \"person\"", - " },", - " \"old\": {", - " \"contact_id\": \"old-contact\"", - " }", - "}'))" - ] - ] - } - }, - { - "description": "Id probe and lookup probe find different rows (TOO_MANY_LOOKUP_ROWS)", - "action": "merge", - "data": { - "id": "22222222-2222-2222-2222-222222222222", - "type": "person", - "first_name": "OtherFirst", - "last_name": "OtherLast", - "date_of_birth": "1991-02-02T00:00:00Z", - "pronouns": "she/her" - }, - "mocks": [ - { - "id": "22222222-2222-2222-2222-222222222222", - "type": "person", - "first_name": "LookupFirst", - "last_name": "LookupLast", - "date_of_birth": "1990-01-01T00:00:00Z", - "pronouns": "they/them" - }, - { - "id": "44444444-4444-4444-4444-444444444444", - "type": "person", - "first_name": "OtherFirst", - "last_name": "OtherLast", - "date_of_birth": "1991-02-02T00:00:00Z", - "pronouns": "she/her" - } - ], - "schema_id": "person", - "expect": { - "success": false, - "errors": [ - { - "code": "MERGE_FAILED", - "values": { - "error": "TOO_MANY_LOOKUP_ROWS: Lookup for person found too many existing rows" - }, - "details": {} - } - ] - } } ] } diff --git a/fixtures/minContains.json b/fixtures/minContains.json index 20eb2dd..a8b98bc 100644 --- a/fixtures/minContains.json +++ b/fixtures/minContains.json @@ -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": "", diff --git a/fixtures/minItems.json b/fixtures/minItems.json index 2528639..ed5f123 100644 --- a/fixtures/minItems.json +++ b/fixtures/minItems.json @@ -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": "", diff --git a/fixtures/minimum.json b/fixtures/minimum.json index 182ef37..7a330c3 100644 --- a/fixtures/minimum.json +++ b/fixtures/minimum.json @@ -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": "", diff --git a/fixtures/multipleOf.json b/fixtures/multipleOf.json index 2d153d1..2e7959e 100644 --- a/fixtures/multipleOf.json +++ b/fixtures/multipleOf.json @@ -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": "", diff --git a/fixtures/objectTypes.json b/fixtures/objectTypes.json index 6ce51b9..ed67d5f 100644 --- a/fixtures/objectTypes.json +++ b/fixtures/objectTypes.json @@ -156,8 +156,8 @@ { "code": "MAXIMUM_VIOLATED", "values": { - "value": "60", - "limit": "50" + "limit": "50", + "value": "60" }, "details": { "path": "max", diff --git a/fixtures/pattern.json b/fixtures/pattern.json index e200bcb..a1748d5 100644 --- a/fixtures/pattern.json +++ b/fixtures/pattern.json @@ -34,8 +34,8 @@ { "code": "PATTERN_VIOLATED", "values": { - "pattern": "^a*$", - "value": "abc" + "value": "abc", + "pattern": "^a*$" }, "details": { "path": "", diff --git a/fixtures/polymorphism.json b/fixtures/polymorphism.json index a65193c..d38a288 100644 --- a/fixtures/polymorphism.json +++ b/fixtures/polymorphism.json @@ -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": "", diff --git a/fixtures/propertyNames.json b/fixtures/propertyNames.json index 1b96a34..adb2f47 100644 --- a/fixtures/propertyNames.json +++ b/fixtures/propertyNames.json @@ -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": "", diff --git a/fixtures/queryer.json b/fixtures/queryer.json index e09ed07..fafb704 100644 --- a/fixtures/queryer.json +++ b/fixtures/queryer.json @@ -1293,8 +1293,8 @@ " 'age', person_3.age", " )", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", - " JOIN agreego.person person_3 ON person_3.id = organization_2.id", + " JOIN agreego.organization organization_2", + " JOIN agreego.person person_3", " WHERE", " NOT entity_1.archived", "))))" @@ -1336,15 +1336,15 @@ " 'number', phone_number_8.number", " )", " FROM agreego.entity entity_7", - " JOIN agreego.phone_number phone_number_8 ON phone_number_8.id = entity_7.id", + " JOIN agreego.phone_number phone_number_8", " WHERE", " NOT entity_7.archived", " AND relationship_5.target_id = entity_7.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_4", - " JOIN agreego.relationship relationship_5 ON relationship_5.id = entity_4.id", - " JOIN agreego.contact contact_6 ON contact_6.id = relationship_5.id", + " JOIN agreego.relationship relationship_5", + " JOIN agreego.contact contact_6", " WHERE", " NOT entity_4.archived", " AND relationship_5.target_type = 'phone_number'", @@ -1366,15 +1366,15 @@ " 'address', email_address_13.address", " )", " FROM agreego.entity entity_12", - " JOIN agreego.email_address email_address_13 ON email_address_13.id = entity_12.id", + " JOIN agreego.email_address email_address_13", " WHERE", " NOT entity_12.archived", " AND relationship_10.target_id = entity_12.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_9", - " JOIN agreego.relationship relationship_10 ON relationship_10.id = entity_9.id", - " JOIN agreego.contact contact_11 ON contact_11.id = relationship_10.id", + " JOIN agreego.relationship relationship_10", + " JOIN agreego.contact contact_11", " WHERE", " NOT entity_9.archived", " AND relationship_10.target_type = 'email_address'", @@ -1396,15 +1396,15 @@ " 'city', address_18.city", " )", " FROM agreego.entity entity_17", - " JOIN agreego.address address_18 ON address_18.id = entity_17.id", + " JOIN agreego.address address_18", " WHERE", " NOT entity_17.archived", " AND relationship_15.target_id = entity_17.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_14", - " JOIN agreego.relationship relationship_15 ON relationship_15.id = entity_14.id", - " JOIN agreego.contact contact_16 ON contact_16.id = relationship_15.id", + " JOIN agreego.relationship relationship_15", + " JOIN agreego.contact contact_16", " WHERE", " NOT entity_14.archived", " AND relationship_15.target_type = 'address'", @@ -1427,7 +1427,7 @@ " 'number', phone_number_23.number", " )", " FROM agreego.entity entity_22", - " JOIN agreego.phone_number phone_number_23 ON phone_number_23.id = entity_22.id", + " JOIN agreego.phone_number phone_number_23", " WHERE", " NOT entity_22.archived", " AND relationship_20.target_id = entity_22.id", @@ -1441,7 +1441,7 @@ " 'address', email_address_25.address", " )", " FROM agreego.entity entity_24", - " JOIN agreego.email_address email_address_25 ON email_address_25.id = entity_24.id", + " JOIN agreego.email_address email_address_25", " WHERE", " NOT entity_24.archived", " AND relationship_20.target_id = entity_24.id", @@ -1455,7 +1455,7 @@ " 'city', address_27.city", " )", " FROM agreego.entity entity_26", - " JOIN agreego.address address_27 ON address_27.id = entity_26.id", + " JOIN agreego.address address_27", " WHERE", " NOT entity_26.archived", " AND relationship_20.target_id = entity_26.id", @@ -1464,16 +1464,16 @@ " END", " )), '[]'::jsonb)", " FROM agreego.entity entity_19", - " JOIN agreego.relationship relationship_20 ON relationship_20.id = entity_19.id", - " JOIN agreego.contact contact_21 ON contact_21.id = relationship_20.id", + " JOIN agreego.relationship relationship_20", + " JOIN agreego.contact contact_21", " WHERE", " NOT entity_19.archived", " AND relationship_20.source_id = entity_1.id", " )", " )", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", - " JOIN agreego.person person_3 ON person_3.id = organization_2.id", + " JOIN agreego.organization organization_2", + " JOIN agreego.person person_3", " WHERE", " NOT entity_1.archived", "))))" @@ -1586,7 +1586,7 @@ " 'number', phone_number_8.number", " )", " FROM agreego.entity entity_7", - " JOIN agreego.phone_number phone_number_8 ON phone_number_8.id = entity_7.id", + " JOIN agreego.phone_number phone_number_8", " WHERE", " NOT entity_7.archived", " AND phone_number_8.number ILIKE $32 #>> '{}'", @@ -1594,8 +1594,8 @@ " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_4", - " JOIN agreego.relationship relationship_5 ON relationship_5.id = entity_4.id", - " JOIN agreego.contact contact_6 ON contact_6.id = relationship_5.id", + " JOIN agreego.relationship relationship_5", + " JOIN agreego.contact contact_6", " WHERE", " NOT entity_4.archived", " AND relationship_5.target_type = 'phone_number'", @@ -1617,15 +1617,15 @@ " 'address', email_address_13.address", " )", " FROM agreego.entity entity_12", - " JOIN agreego.email_address email_address_13 ON email_address_13.id = entity_12.id", + " JOIN agreego.email_address email_address_13", " WHERE", " NOT entity_12.archived", " AND relationship_10.target_id = entity_12.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_9", - " JOIN agreego.relationship relationship_10 ON relationship_10.id = entity_9.id", - " JOIN agreego.contact contact_11 ON contact_11.id = relationship_10.id", + " JOIN agreego.relationship relationship_10", + " JOIN agreego.contact contact_11", " WHERE", " NOT entity_9.archived", " AND relationship_10.target_type = 'email_address'", @@ -1647,15 +1647,15 @@ " 'city', address_18.city", " )", " FROM agreego.entity entity_17", - " JOIN agreego.address address_18 ON address_18.id = entity_17.id", + " JOIN agreego.address address_18", " WHERE", " NOT entity_17.archived", " AND relationship_15.target_id = entity_17.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_14", - " JOIN agreego.relationship relationship_15 ON relationship_15.id = entity_14.id", - " JOIN agreego.contact contact_16 ON contact_16.id = relationship_15.id", + " JOIN agreego.relationship relationship_15", + " JOIN agreego.contact contact_16", " WHERE", " NOT entity_14.archived", " AND relationship_15.target_type = 'address'", @@ -1678,7 +1678,7 @@ " 'number', phone_number_23.number", " )", " FROM agreego.entity entity_22", - " JOIN agreego.phone_number phone_number_23 ON phone_number_23.id = entity_22.id", + " JOIN agreego.phone_number phone_number_23", " WHERE", " NOT entity_22.archived", " AND relationship_20.target_id = entity_22.id", @@ -1692,7 +1692,7 @@ " 'address', email_address_25.address", " )", " FROM agreego.entity entity_24", - " JOIN agreego.email_address email_address_25 ON email_address_25.id = entity_24.id", + " JOIN agreego.email_address email_address_25", " WHERE", " NOT entity_24.archived", " AND relationship_20.target_id = entity_24.id", @@ -1706,7 +1706,7 @@ " 'city', address_27.city", " )", " FROM agreego.entity entity_26", - " JOIN agreego.address address_27 ON address_27.id = entity_26.id", + " JOIN agreego.address address_27", " WHERE", " NOT entity_26.archived", " AND relationship_20.target_id = entity_26.id", @@ -1715,8 +1715,8 @@ " END", " )), '[]'::jsonb)", " FROM agreego.entity entity_19", - " JOIN agreego.relationship relationship_20 ON relationship_20.id = entity_19.id", - " JOIN agreego.contact contact_21 ON contact_21.id = relationship_20.id", + " JOIN agreego.relationship relationship_20", + " JOIN agreego.contact contact_21", " WHERE", " NOT entity_19.archived", " AND contact_21.is_primary = ($11 #>> '{}')::BOOLEAN", @@ -1724,8 +1724,8 @@ " )", " )", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", - " JOIN agreego.person person_3 ON person_3.id = organization_2.id", + " JOIN agreego.organization organization_2", + " JOIN agreego.person person_3", " WHERE", " NOT entity_1.archived", " AND person_3.age = ($1 #>> '{}')::NUMERIC", @@ -1787,15 +1787,15 @@ " 'address', email_address_5.address", " )", " FROM agreego.entity entity_4", - " JOIN agreego.email_address email_address_5 ON email_address_5.id = entity_4.id", + " JOIN agreego.email_address email_address_5", " WHERE", " NOT entity_4.archived", " AND relationship_2.target_id = entity_4.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_1", - " JOIN agreego.relationship relationship_2 ON relationship_2.id = entity_1.id", - " JOIN agreego.contact contact_3 ON contact_3.id = relationship_2.id", + " JOIN agreego.relationship relationship_2", + " JOIN agreego.contact contact_3", " WHERE", " NOT entity_1.archived", " AND relationship_2.target_type = 'email_address'", @@ -1832,8 +1832,8 @@ " 'age', person_5.age", " )", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", - " JOIN agreego.person person_5 ON person_5.id = organization_4.id", + " JOIN agreego.organization organization_4", + " JOIN agreego.person person_5", " WHERE", " NOT entity_3.archived", " AND order_2.customer_id = person_5.id", @@ -1849,14 +1849,14 @@ " 'price', order_line_7.price", " )), '[]'::jsonb)", " FROM agreego.entity entity_6", - " JOIN agreego.order_line order_line_7 ON order_line_7.id = entity_6.id", + " JOIN agreego.order_line order_line_7", " WHERE", " NOT entity_6.archived", " AND order_line_7.order_id = order_2.id", " )", " )", " FROM agreego.entity entity_1", - " JOIN agreego.order order_2 ON order_2.id = entity_1.id", + " JOIN agreego.order order_2", " WHERE", " NOT entity_1.archived", "))))" @@ -1881,7 +1881,7 @@ " 'name', organization_2.name", " )", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", + " JOIN agreego.organization organization_2", " WHERE", " NOT entity_1.archived", "))))" @@ -1910,8 +1910,8 @@ " 'role', bot_5.role", " )", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", - " JOIN agreego.bot bot_5 ON bot_5.id = organization_4.id", + " JOIN agreego.organization organization_4", + " JOIN agreego.bot bot_5", " WHERE", " NOT entity_3.archived", " AND entity_3.id = entity_1.id", @@ -1925,7 +1925,7 @@ " 'name', organization_7.name", " )", " FROM agreego.entity entity_6", - " JOIN agreego.organization organization_7 ON organization_7.id = entity_6.id", + " JOIN agreego.organization organization_7", " WHERE", " NOT entity_6.archived", " AND entity_6.id = entity_1.id", @@ -1942,8 +1942,8 @@ " 'age', person_10.age", " )", " FROM agreego.entity entity_8", - " JOIN agreego.organization organization_9 ON organization_9.id = entity_8.id", - " JOIN agreego.person person_10 ON person_10.id = organization_9.id", + " JOIN agreego.organization organization_9", + " JOIN agreego.person person_10", " WHERE", " NOT entity_8.archived", " AND entity_8.id = entity_1.id", @@ -1951,7 +1951,7 @@ " ELSE NULL", " END), '[]'::jsonb)", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", + " JOIN agreego.organization organization_2", " WHERE", " NOT entity_1.archived", "))))" @@ -1979,8 +1979,8 @@ " 'token', bot_5.token", " )", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", - " JOIN agreego.bot bot_5 ON bot_5.id = organization_4.id", + " JOIN agreego.organization organization_4", + " JOIN agreego.bot bot_5", " WHERE", " NOT entity_3.archived", " AND entity_3.id = entity_1.id", @@ -1996,8 +1996,8 @@ " 'last_name', person_8.last_name", " )", " FROM agreego.entity entity_6", - " JOIN agreego.organization organization_7 ON organization_7.id = entity_6.id", - " JOIN agreego.person person_8 ON person_8.id = organization_7.id", + " JOIN agreego.organization organization_7", + " JOIN agreego.person person_8", " WHERE", " NOT entity_6.archived", " AND entity_6.id = entity_1.id", @@ -2005,7 +2005,7 @@ " ELSE NULL", " END", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", + " JOIN agreego.organization organization_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2049,15 +2049,15 @@ " 'number', phone_number_10.number", " )", " FROM agreego.entity entity_9", - " JOIN agreego.phone_number phone_number_10 ON phone_number_10.id = entity_9.id", + " JOIN agreego.phone_number phone_number_10", " WHERE", " NOT entity_9.archived", " AND relationship_7.target_id = entity_9.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_6", - " JOIN agreego.relationship relationship_7 ON relationship_7.id = entity_6.id", - " JOIN agreego.contact contact_8 ON contact_8.id = relationship_7.id", + " JOIN agreego.relationship relationship_7", + " JOIN agreego.contact contact_8", " WHERE", " NOT entity_6.archived", " AND relationship_7.target_type = 'phone_number'", @@ -2079,15 +2079,15 @@ " 'address', email_address_15.address", " )", " FROM agreego.entity entity_14", - " JOIN agreego.email_address email_address_15 ON email_address_15.id = entity_14.id", + " JOIN agreego.email_address email_address_15", " WHERE", " NOT entity_14.archived", " AND relationship_12.target_id = entity_14.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_11", - " JOIN agreego.relationship relationship_12 ON relationship_12.id = entity_11.id", - " JOIN agreego.contact contact_13 ON contact_13.id = relationship_12.id", + " JOIN agreego.relationship relationship_12", + " JOIN agreego.contact contact_13", " WHERE", " NOT entity_11.archived", " AND relationship_12.target_type = 'email_address'", @@ -2109,15 +2109,15 @@ " 'city', address_20.city", " )", " FROM agreego.entity entity_19", - " JOIN agreego.address address_20 ON address_20.id = entity_19.id", + " JOIN agreego.address address_20", " WHERE", " NOT entity_19.archived", " AND relationship_17.target_id = entity_19.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_16", - " JOIN agreego.relationship relationship_17 ON relationship_17.id = entity_16.id", - " JOIN agreego.contact contact_18 ON contact_18.id = relationship_17.id", + " JOIN agreego.relationship relationship_17", + " JOIN agreego.contact contact_18", " WHERE", " NOT entity_16.archived", " AND relationship_17.target_type = 'address'", @@ -2140,7 +2140,7 @@ " 'number', phone_number_25.number", " )", " FROM agreego.entity entity_24", - " JOIN agreego.phone_number phone_number_25 ON phone_number_25.id = entity_24.id", + " JOIN agreego.phone_number phone_number_25", " WHERE", " NOT entity_24.archived", " AND relationship_22.target_id = entity_24.id", @@ -2154,7 +2154,7 @@ " 'address', email_address_27.address", " )", " FROM agreego.entity entity_26", - " JOIN agreego.email_address email_address_27 ON email_address_27.id = entity_26.id", + " JOIN agreego.email_address email_address_27", " WHERE", " NOT entity_26.archived", " AND relationship_22.target_id = entity_26.id", @@ -2168,7 +2168,7 @@ " 'city', address_29.city", " )", " FROM agreego.entity entity_28", - " JOIN agreego.address address_29 ON address_29.id = entity_28.id", + " JOIN agreego.address address_29", " WHERE", " NOT entity_28.archived", " AND relationship_22.target_id = entity_28.id", @@ -2177,16 +2177,16 @@ " END", " )), '[]'::jsonb)", " FROM agreego.entity entity_21", - " JOIN agreego.relationship relationship_22 ON relationship_22.id = entity_21.id", - " JOIN agreego.contact contact_23 ON contact_23.id = relationship_22.id", + " JOIN agreego.relationship relationship_22", + " JOIN agreego.contact contact_23", " WHERE", " NOT entity_21.archived", " AND relationship_22.source_id = entity_3.id", " )", " )", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", - " JOIN agreego.person person_5 ON person_5.id = organization_4.id", + " JOIN agreego.organization organization_4", + " JOIN agreego.person person_5", " WHERE", " NOT entity_3.archived", " AND entity_3.id = entity_1.id", @@ -2194,7 +2194,7 @@ " ELSE NULL", " END", " FROM agreego.entity entity_1", - " JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id", + " JOIN agreego.organization organization_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2230,15 +2230,15 @@ " 'age', person_5.age", " )", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", - " JOIN agreego.person person_5 ON person_5.id = organization_4.id", + " JOIN agreego.organization organization_4", + " JOIN agreego.person person_5", " WHERE", " NOT entity_3.archived", " AND order_2.customer_id = person_5.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_1", - " JOIN agreego.order order_2 ON order_2.id = entity_1.id", + " JOIN agreego.order order_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2273,7 +2273,7 @@ " ELSE NULL", " END), '[]'::jsonb)", " FROM agreego.entity entity_1", - " JOIN agreego.widget widget_2 ON widget_2.id = entity_1.id", + " JOIN agreego.widget widget_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2306,7 +2306,7 @@ " 'price', invoice_line_4.price", " )), '[]'::jsonb)", " FROM agreego.entity entity_3", - " JOIN agreego.invoice_line invoice_line_4 ON invoice_line_4.id = entity_3.id", + " JOIN agreego.invoice_line invoice_line_4", " WHERE", " NOT entity_3.archived", " AND invoice_line_4.invoice_id = invoice_2.id", @@ -2317,7 +2317,7 @@ " 'metadata_nested_lines', invoice_2.metadata_nested_lines", " )", " FROM agreego.entity entity_1", - " JOIN agreego.invoice invoice_2 ON invoice_2.id = entity_1.id", + " JOIN agreego.invoice invoice_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2344,7 +2344,7 @@ " 'card_number', account_2.card_number", " )", " FROM agreego.entity entity_1", - " JOIN agreego.account account_2 ON account_2.id = entity_1.id", + " JOIN agreego.account account_2", " WHERE", " NOT entity_1.archived", "))))" @@ -2381,8 +2381,8 @@ " 'role', bot_7.role", " )", " FROM agreego.entity entity_5", - " JOIN agreego.organization organization_6 ON organization_6.id = entity_5.id", - " JOIN agreego.bot bot_7 ON bot_7.id = organization_6.id", + " JOIN agreego.organization organization_6", + " JOIN agreego.bot bot_7", " WHERE", " NOT entity_5.archived", " AND entity_5.id = entity_3.id", @@ -2396,7 +2396,7 @@ " 'name', organization_9.name", " )", " FROM agreego.entity entity_8", - " JOIN agreego.organization organization_9 ON organization_9.id = entity_8.id", + " JOIN agreego.organization organization_9", " WHERE", " NOT entity_8.archived", " AND entity_8.id = entity_3.id", @@ -2413,8 +2413,8 @@ " 'age', person_12.age", " )", " FROM agreego.entity entity_10", - " JOIN agreego.organization organization_11 ON organization_11.id = entity_10.id", - " JOIN agreego.person person_12 ON person_12.id = organization_11.id", + " JOIN agreego.organization organization_11", + " JOIN agreego.person person_12", " WHERE", " NOT entity_10.archived", " AND entity_10.id = entity_3.id", @@ -2422,14 +2422,14 @@ " ELSE NULL", " END", " FROM agreego.entity entity_3", - " JOIN agreego.organization organization_4 ON organization_4.id = entity_3.id", + " JOIN agreego.organization organization_4", " WHERE", " NOT entity_3.archived", " AND order_2.counterparty_id = entity_3.id", " )", " )), '[]'::jsonb)", " FROM agreego.entity entity_1", - " JOIN agreego.order order_2 ON order_2.id = entity_1.id", + " JOIN agreego.order order_2", " WHERE", " NOT entity_1.archived", " AND order_2.counterparty_type IN ('bot', 'organization', 'person')", diff --git a/fixtures/traits.json b/fixtures/traits.json index 109b01b..d274fae 100644 --- a/fixtures/traits.json +++ b/fixtures/traits.json @@ -139,8 +139,8 @@ { "code": "MAX_LENGTH_VIOLATED", "values": { - "count": "26", - "limit": "5" + "limit": "5", + "count": "26" }, "details": { "path": "email", diff --git a/flows b/flows index 0d9bd86..89748a2 160000 --- a/flows +++ b/flows @@ -1 +1 @@ -Subproject commit 0d9bd8644eadf89fe5bcaba37f6833c688822d16 +Subproject commit 89748a246e36a34c0b6ca2b27b4e6a2ab198cce0 diff --git a/src/database/compile/filter.rs b/src/database/compile/filter.rs index 0a97c8d..2474432 100644 --- a/src/database/compile/filter.rs +++ b/src/database/compile/filter.rs @@ -165,20 +165,8 @@ 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. - 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 { - Some(vec![format!("{}.filter", custom)]) - } else { - None - } + // Assume anything else is a Relational cross-boundary that already has its own .filter dynamically built + Some(vec![format!("{}.filter", custom)]) } } } diff --git a/src/database/executors/mock.rs b/src/database/executors/mock.rs index 92e6c3d..4a037b6 100644 --- a/src/database/executors/mock.rs +++ b/src/database/executors/mock.rs @@ -116,17 +116,99 @@ fn parse_and_match_mocks(sql: &str, mocks: &[Value]) -> Option> { return None; } - // The merger's existence read emits one SELECT per probe (id / lookup key) - // joined by UNION. Match each arm independently against its own tables and - // WHERE clause; a mock matching any arm is returned once, mirroring UNION's - // dedup semantics. - let union_regex = Regex::new(r"(?i)\s+UNION\s+(?:ALL\s+)?").ok()?; - let arms: Vec<&str> = union_regex.split(sql).collect(); + // 1. Extract table name + let table_regex = Regex::new(r#"(?i)\s+FROM\s+(?:[a-zA-Z_]\w*\.)?"?([a-zA-Z_]\w*)"?"#).ok()?; + let table = if let Some(caps) = table_regex.captures(sql) { + caps.get(1)?.as_str() + } else { + return None; + }; + // 2. Extract WHERE conditions string + let mut where_clause = String::new(); + if let Some(where_idx) = sql_upper.find(" WHERE ") { + let mut where_end = sql_upper.find(" ORDER BY ").unwrap_or(sql_upper.len()); + if let Some(limit_idx) = sql_upper.find(" LIMIT ") { + if limit_idx < where_end { + where_end = limit_idx; + } + } + where_clause = sql[where_idx + 7..where_end].to_string(); + } + + // 3. Find matching mocks let mut matches = Vec::new(); + let or_regex = Regex::new(r"(?i)\s+OR\s+").ok()?; + let and_regex = Regex::new(r"(?i)\s+AND\s+").ok()?; + for mock in mocks { if let Some(mock_obj) = mock.as_object() { - if arms.iter().any(|arm| arm_matches_mock(arm, mock_obj)) { + if let Some(t) = mock_obj.get("type") { + if t.as_str() != Some(table) { + continue; + } + } + + if where_clause.is_empty() { + matches.push(mock.clone()); + continue; + } + + let or_parts = or_regex.split(&where_clause); + let mut any_branch_matched = false; + + for or_part in or_parts { + let branch_str = or_part.replace('(', "").replace(')', ""); + let mut branch_matches = true; + + for part in and_regex.split(&branch_str) { + if let Some(eq_idx) = part.find('=') { + let left = part[..eq_idx] + .trim() + .split('.') + .last() + .unwrap_or("") + .trim_matches('"'); + let right = part[eq_idx + 1..].trim().trim_matches('\''); + + let mock_val_str = match mock_obj.get(left) { + Some(Value::String(s)) => s.clone(), + Some(Value::Number(n)) => n.to_string(), + Some(Value::Bool(b)) => b.to_string(), + Some(Value::Null) => "null".to_string(), + _ => "".to_string(), + }; + if mock_val_str != right { + branch_matches = false; + break; + } + } else if part.to_uppercase().contains(" IS NULL") { + let left = part[..part.to_uppercase().find(" IS NULL").unwrap()] + .trim() + .split('.') + .last() + .unwrap_or("") + .trim_matches('"'); + + let mock_val_str = match mock_obj.get(left) { + Some(Value::Null) => "null".to_string(), + _ => "".to_string(), + }; + + if mock_val_str != "null" { + branch_matches = false; + break; + } + } + } + + if branch_matches { + any_branch_matched = true; + break; + } + } + + if any_branch_matched { matches.push(mock.clone()); } } @@ -134,103 +216,3 @@ fn parse_and_match_mocks(sql: &str, mocks: &[Value]) -> Option> { Some(matches) } - -#[cfg(test)] -fn arm_matches_mock(arm: &str, mock_obj: &serde_json::Map) -> bool { - let arm_upper = arm.to_uppercase(); - - // 1. The mock's type must name one of the arm's tables. Hierarchy reads - // SELECT FROM the root (entity) and JOIN the subtype tables, so every - // FROM/JOIN table counts, not just the first. - let table_regex = match Regex::new(r#"(?i)\b(?:FROM|JOIN)\s+(?:[a-zA-Z_]\w*\.)?"?([a-zA-Z_]\w*)"?"#) { - Ok(r) => r, - Err(_) => return false, - }; - let tables: Vec<&str> = table_regex.captures_iter(arm).filter_map(|c| c.get(1)).map(|m| m.as_str()).collect(); - if tables.is_empty() { - return false; - } - if let Some(t) = mock_obj.get("type") { - if !tables.iter().any(|table| t.as_str() == Some(table)) { - return false; - } - } - - // 2. Extract this arm's WHERE conditions - let mut where_clause = String::new(); - if let Some(where_idx) = arm_upper.find(" WHERE ") { - let mut where_end = arm_upper.find(" ORDER BY ").unwrap_or(arm_upper.len()); - if let Some(limit_idx) = arm_upper.find(" LIMIT ") { - if limit_idx < where_end { - where_end = limit_idx; - } - } - where_clause = arm[where_idx + 7..where_end].to_string(); - } - - if where_clause.is_empty() { - return true; - } - - // 3. Match the mock against the conditions - let or_regex = match Regex::new(r"(?i)\s+OR\s+") { - Ok(r) => r, - Err(_) => return false, - }; - let and_regex = match Regex::new(r"(?i)\s+AND\s+") { - Ok(r) => r, - Err(_) => return false, - }; - - for or_part in or_regex.split(&where_clause) { - let branch_str = or_part.replace('(', "").replace(')', ""); - let mut branch_matches = true; - - for part in and_regex.split(&branch_str) { - if let Some(eq_idx) = part.find('=') { - let left = part[..eq_idx] - .trim() - .split('.') - .last() - .unwrap_or("") - .trim_matches('"'); - let right = part[eq_idx + 1..].trim().trim_matches('\''); - - let mock_val_str = match mock_obj.get(left) { - Some(Value::String(s)) => s.clone(), - Some(Value::Number(n)) => n.to_string(), - Some(Value::Bool(b)) => b.to_string(), - Some(Value::Null) => "null".to_string(), - _ => "".to_string(), - }; - if mock_val_str != right { - branch_matches = false; - break; - } - } else if part.to_uppercase().contains(" IS NULL") { - let left = part[..part.to_uppercase().find(" IS NULL").unwrap()] - .trim() - .split('.') - .last() - .unwrap_or("") - .trim_matches('"'); - - let mock_val_str = match mock_obj.get(left) { - Some(Value::Null) => "null".to_string(), - _ => "".to_string(), - }; - - if mock_val_str != "null" { - branch_matches = false; - break; - } - } - } - - if branch_matches { - return true; - } - } - - false -} diff --git a/src/database/mod.rs b/src/database/mod.rs index 2798e9b..1934cf4 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -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) -> 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) -> 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(); diff --git a/src/merger/mod.rs b/src/merger/mod.rs index 0159fea..4898a16 100644 --- a/src/merger/mod.rs +++ b/src/merger/mod.rs @@ -744,10 +744,6 @@ impl Merger { return Ok(None); } - // An OR across the hierarchy join is un-indexable — it forces a full scan - // of the subtype table on every child merge. UNION lets each arm use its - // own index (pk for the id arm, the lk_ unique index for the lookup arm) - // and still dedups, so TOO_MANY_LOOKUP_ROWS semantics are preserved. let final_sql = if where_parts.len() == 1 { format!("{} WHERE {}", fetch_sql_template, where_parts[0]) } else { diff --git a/src/tests/fixtures.rs b/src/tests/fixtures.rs index 9c854fa..b22d10c 100644 --- a/src/tests/fixtures.rs +++ b/src/tests/fixtures.rs @@ -7660,15 +7660,3 @@ fn test_merger_0_15() { let path = format!("{}/fixtures/merger.json", env!("CARGO_MANIFEST_DIR")); crate::tests::runner::run_test_case(&path, 0, 15).unwrap(); } - -#[test] -fn test_merger_0_16() { - let path = format!("{}/fixtures/merger.json", env!("CARGO_MANIFEST_DIR")); - crate::tests::runner::run_test_case(&path, 0, 16).unwrap(); -} - -#[test] -fn test_merger_0_17() { - let path = format!("{}/fixtures/merger.json", env!("CARGO_MANIFEST_DIR")); - crate::tests::runner::run_test_case(&path, 0, 17).unwrap(); -} diff --git a/src/tests/formatter.rs b/src/tests/formatter.rs index 5c6ff14..f81c963 100644 --- a/src/tests/formatter.rs +++ b/src/tests/formatter.rs @@ -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); } + _ => {} } }