diff --git a/fixtures/contains.json b/fixtures/contains.json index f330613..75214c8 100644 --- a/fixtures/contains.json +++ b/fixtures/contains.json @@ -227,8 +227,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "0" + "count": "0", + "limit": "1" }, "details": { "path": "", @@ -268,8 +268,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "0" + "count": "0", + "limit": "1" }, "details": { "path": "", @@ -347,8 +347,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "0" + "count": "0", + "limit": "1" }, "details": { "path": "", @@ -373,8 +373,8 @@ { "code": "MULTIPLE_OF_VIOLATED", "values": { - "multiple_of": "2", - "value": "3" + "value": "3", + "multiple_of": "2" }, "details": { "path": "0", @@ -384,8 +384,8 @@ { "code": "MULTIPLE_OF_VIOLATED", "values": { - "multiple_of": "2", - "value": "9" + "value": "9", + "multiple_of": "2" }, "details": { "path": "2", @@ -432,8 +432,8 @@ { "code": "MULTIPLE_OF_VIOLATED", "values": { - "multiple_of": "2", - "value": "1" + "value": "1", + "multiple_of": "2" }, "details": { "path": "0", diff --git a/fixtures/database.json b/fixtures/database.json index e90ae91..8a7024f 100644 --- a/fixtures/database.json +++ b/fixtures/database.json @@ -62,8 +62,8 @@ "code": "EDGE_MISSING", "values": { "parent_type": "org", - "property_name": "missing_users", - "child_type": "user" + "child_type": "user", + "property_name": "missing_users" }, "details": { "path": "full.org/missing_users", @@ -151,8 +151,8 @@ { "code": "EDGE_MISSING", "values": { - "child_type": "child", "parent_type": "parent", + "child_type": "child", "property_name": "children" }, "details": { @@ -470,8 +470,8 @@ { "code": "DATABASE_TYPE_PARSE_FAILED", "values": { - "reason": "invalid type: sequence, expected a string", - "type": "failure" + "type": "failure", + "reason": "invalid type: sequence, expected a string" }, "details": { "context": "failure" diff --git a/fixtures/dependencies.json b/fixtures/dependencies.json index 0fb32ad..f4b55e3 100644 --- a/fixtures/dependencies.json +++ b/fixtures/dependencies.json @@ -227,8 +227,8 @@ { "code": "DEPENDENCY_MISSING", "values": { - "required_property": "bar", - "property_name": "quux" + "property_name": "quux", + "required_property": "bar" }, "details": { "path": "", @@ -386,8 +386,8 @@ { "code": "DEPENDENCY_MISSING", "values": { - "required_property": "foo'bar", - "property_name": "foo\"bar" + "property_name": "foo\"bar", + "required_property": "foo'bar" }, "details": { "path": "", @@ -829,8 +829,8 @@ { "code": "MIN_PROPERTIES_VIOLATED", "values": { - "limit": "4", - "count": "2" + "count": "2", + "limit": "4" }, "details": { "path": "", diff --git a/fixtures/exclusiveMaximum.json b/fixtures/exclusiveMaximum.json index ad236d9..6ec3f77 100644 --- a/fixtures/exclusiveMaximum.json +++ b/fixtures/exclusiveMaximum.json @@ -34,8 +34,8 @@ { "code": "EXCLUSIVE_MAXIMUM_VIOLATED", "values": { - "limit": "3", - "value": "3" + "value": "3", + "limit": "3" }, "details": { "path": "", diff --git a/fixtures/exclusiveMinimum.json b/fixtures/exclusiveMinimum.json index 159374e..fc49d5e 100644 --- a/fixtures/exclusiveMinimum.json +++ b/fixtures/exclusiveMinimum.json @@ -34,8 +34,8 @@ { "code": "EXCLUSIVE_MINIMUM_VIOLATED", "values": { - "limit": "1.1", - "value": "1.1" + "value": "1.1", + "limit": "1.1" }, "details": { "path": "", diff --git a/fixtures/filter.json b/fixtures/filter.json index 5ce1415..04ea3a3 100644 --- a/fixtures/filter.json +++ b/fixtures/filter.json @@ -211,13 +211,6 @@ "gender": {}, "gender.condition": { "type": "condition", - "compiledPropertyNames": [ - "kind", - "$eq", - "$ne", - "$of", - "$nof" - ], "properties": { "$eq": { "type": [ @@ -231,15 +224,6 @@ "null" ] }, - "$nof": { - "type": [ - "array", - "null" - ], - "items": { - "type": "gender" - } - }, "$of": { "type": [ "array", @@ -248,80 +232,32 @@ "items": { "type": "gender" } + }, + "$nof": { + "type": [ + "array", + "null" + ], + "items": { + "type": "gender" + } } - } + }, + "compiledPropertyNames": [ + "kind", + "$eq", + "$ne", + "$of", + "$nof" + ] }, "person": {}, "person.filter": { - "compiledPropertyNames": [ - "first_name", - "age", - "billing_address", - "gender", - "birth_date", - "uuid_field", - "tags", - "ad_hoc", - "$and", - "$or" - ], + "type": "filter", "properties": { - "$and": { - "items": { - "compiledPropertyNames": [ - "first_name", - "age", - "billing_address", - "gender", - "birth_date", - "uuid_field", - "tags", - "ad_hoc", - "$and", - "$or" - ], - "type": "person.filter" - }, + "first_name": { "type": [ - "array", - "null" - ] - }, - "$or": { - "items": { - "compiledPropertyNames": [ - "first_name", - "age", - "billing_address", - "gender", - "birth_date", - "uuid_field", - "tags", - "ad_hoc", - "$and", - "$or" - ], - "type": "person.filter" - }, - "type": [ - "array", - "null" - ] - }, - "ad_hoc": { - "compiledPropertyNames": [ - "foo" - ], - "properties": { - "foo": { - "type": [ - "string.condition", - "null" - ] - } - }, - "type": [ - "filter", + "string.condition", "null" ] }, @@ -337,6 +273,12 @@ "null" ] }, + "gender": { + "type": [ + "gender.condition", + "null" + ] + }, "birth_date": { "type": [ "date.condition", @@ -349,48 +291,48 @@ "null" ] }, - "first_name": { - "type": [ - "string.condition", - "null" - ] - }, - "gender": { - "type": [ - "gender.condition", - "null" - ] - }, "tags": { "type": [ "string.condition", "null" ] - } - }, - "type": "filter" - }, - "address": {}, - "address.filter": { - "type": "filter", - "compiledPropertyNames": [ - "city", - "$and", - "$or" - ], - "properties": { + }, + "ad_hoc": { + "type": [ + "filter", + "null" + ], + "properties": { + "foo": { + "type": [ + "string.condition", + "null" + ] + } + }, + "compiledPropertyNames": [ + "foo" + ] + }, "$and": { "type": [ "array", "null" ], "items": { + "type": "person.filter", "compiledPropertyNames": [ - "city", + "first_name", + "age", + "billing_address", + "gender", + "birth_date", + "uuid_field", + "tags", + "ad_hoc", "$and", "$or" - ], - "type": "address.filter" + ] } }, "$or": { @@ -399,21 +341,79 @@ "null" ], "items": { + "type": "person.filter", "compiledPropertyNames": [ - "city", + "first_name", + "age", + "billing_address", + "gender", + "birth_date", + "uuid_field", + "tags", + "ad_hoc", "$and", "$or" - ], - "type": "address.filter" + ] } - }, + } + }, + "compiledPropertyNames": [ + "first_name", + "age", + "billing_address", + "gender", + "birth_date", + "uuid_field", + "tags", + "ad_hoc", + "$and", + "$or" + ] + }, + "address": {}, + "address.filter": { + "type": "filter", + "properties": { "city": { "type": [ "string.condition", "null" ] + }, + "$and": { + "type": [ + "array", + "null" + ], + "items": { + "type": "address.filter", + "compiledPropertyNames": [ + "city", + "$and", + "$or" + ] + } + }, + "$or": { + "type": [ + "array", + "null" + ], + "items": { + "type": "address.filter", + "compiledPropertyNames": [ + "city", + "$and", + "$or" + ] + } } - } + }, + "compiledPropertyNames": [ + "city", + "$and", + "$or" + ] }, "condition": {}, "filter": {}, @@ -424,52 +424,7 @@ "search": {}, "search.filter": { "type": "filter", - "compiledPropertyNames": [ - "kind", - "name", - "filter", - "$and", - "$or" - ], "properties": { - "$and": { - "type": [ - "array", - "null" - ], - "items": { - "compiledPropertyNames": [ - "kind", - "name", - "filter", - "$and", - "$or" - ], - "type": "search.filter" - } - }, - "$or": { - "type": [ - "array", - "null" - ], - "items": { - "compiledPropertyNames": [ - "kind", - "name", - "filter", - "$and", - "$or" - ], - "type": "search.filter" - } - }, - "filter": { - "type": [ - "$kind.filter", - "null" - ] - }, "kind": { "type": [ "string.condition", @@ -481,8 +436,53 @@ "string.condition", "null" ] + }, + "filter": { + "type": [ + "$kind.filter", + "null" + ] + }, + "$and": { + "type": [ + "array", + "null" + ], + "items": { + "type": "search.filter", + "compiledPropertyNames": [ + "kind", + "name", + "filter", + "$and", + "$or" + ] + } + }, + "$or": { + "type": [ + "array", + "null" + ], + "items": { + "type": "search.filter", + "compiledPropertyNames": [ + "kind", + "name", + "filter", + "$and", + "$or" + ] + } } - } + }, + "compiledPropertyNames": [ + "kind", + "name", + "filter", + "$and", + "$or" + ] } } } diff --git a/fixtures/format.json b/fixtures/format.json index a87daa5..aec9069 100644 --- a/fixtures/format.json +++ b/fixtures/format.json @@ -155,8 +155,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid time element: invalid leap second", - "format": "date-time" + "format": "date-time", + "error": "invalid time element: invalid leap second" }, "details": { "path": "", @@ -177,8 +177,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid time element: invalid leap second", - "format": "date-time" + "format": "date-time", + "error": "invalid time element: invalid leap second" }, "details": { "path": "", @@ -265,8 +265,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": "", @@ -610,8 +610,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "32 days in month", - "format": "date" + "format": "date", + "error": "32 days in month" }, "details": { "path": "", @@ -703,8 +703,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "month has 30 days only", - "format": "date" + "format": "date", + "error": "month has 30 days only" }, "details": { "path": "", @@ -734,8 +734,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "32 days in month", - "format": "date" + "format": "date", + "error": "32 days in month" }, "details": { "path": "", @@ -765,8 +765,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "32 days in month", - "format": "date" + "format": "date", + "error": "32 days in month" }, "details": { "path": "", @@ -796,8 +796,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "month has 30 days only", - "format": "date" + "format": "date", + "error": "month has 30 days only" }, "details": { "path": "", @@ -827,8 +827,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "32 days in month", - "format": "date" + "format": "date", + "error": "32 days in month" }, "details": { "path": "", @@ -858,8 +858,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "month has 30 days only", - "format": "date" + "format": "date", + "error": "month has 30 days only" }, "details": { "path": "", @@ -933,8 +933,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing hyphen in correct place", - "format": "date" + "format": "date", + "error": "missing hyphen in correct place" }, "details": { "path": "", @@ -955,8 +955,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "must be 10 characters long", - "format": "date" + "format": "date", + "error": "must be 10 characters long" }, "details": { "path": "", @@ -1021,8 +1021,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "13 months in year", - "format": "date" + "format": "date", + "error": "13 months in year" }, "details": { "path": "", @@ -1140,8 +1140,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "must be 10 characters long", - "format": "date" + "format": "date", + "error": "must be 10 characters long" }, "details": { "path": "", @@ -1206,8 +1206,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "must be 10 characters long", - "format": "date" + "format": "date", + "error": "must be 10 characters long" }, "details": { "path": "", @@ -1308,8 +1308,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid unit D", - "format": "duration" + "format": "duration", + "error": "invalid unit D" }, "details": { "path": "", @@ -1330,8 +1330,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "must start with P", - "format": "duration" + "format": "duration", + "error": "must start with P" }, "details": { "path": "", @@ -1352,8 +1352,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "nothing after P", - "format": "duration" + "format": "duration", + "error": "nothing after P" }, "details": { "path": "", @@ -1374,8 +1374,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "no time elements", - "format": "duration" + "format": "duration", + "error": "no time elements" }, "details": { "path": "", @@ -1396,8 +1396,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "no time elements", - "format": "duration" + "format": "duration", + "error": "no time elements" }, "details": { "path": "", @@ -1462,8 +1462,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid unit S", - "format": "duration" + "format": "duration", + "error": "invalid unit S" }, "details": { "path": "", @@ -1556,8 +1556,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid week", - "format": "duration" + "format": "duration", + "error": "invalid week" }, "details": { "path": "", @@ -1600,8 +1600,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing unit", - "format": "duration" + "format": "duration", + "error": "missing unit" }, "details": { "path": "", @@ -1728,8 +1728,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing @", - "format": "email" + "format": "email", + "error": "missing @" }, "details": { "path": "", @@ -1897,8 +1897,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid domain: invalid character '='", - "format": "email" + "format": "email", + "error": "invalid domain: invalid character '='" }, "details": { "path": "", @@ -1941,8 +1941,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid character '@'", - "format": "email" + "format": "email", + "error": "invalid character '@'" }, "details": { "path": "", @@ -2132,8 +2132,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": "", @@ -2176,8 +2176,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid character '.'", - "format": "hostname" + "format": "hostname", + "error": "invalid character '.'" }, "details": { "path": "", @@ -2207,8 +2207,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "label starts with hyphen", - "format": "hostname" + "format": "hostname", + "error": "label starts with hyphen" }, "details": { "path": "", @@ -2229,8 +2229,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "label ends with hyphen", - "format": "hostname" + "format": "hostname", + "error": "label ends with hyphen" }, "details": { "path": "", @@ -2252,8 +2252,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "label has -- in 3rd/4th position but does not start with xn--", - "format": "hostname" + "format": "hostname", + "error": "label has -- in 3rd/4th position but does not start with xn--" }, "details": { "path": "", @@ -2274,8 +2274,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid character '_'", - "format": "hostname" + "format": "hostname", + "error": "invalid character '_'" }, "details": { "path": "", @@ -2367,8 +2367,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -2398,8 +2398,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": "", @@ -2444,8 +2444,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -2533,8 +2533,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": "", @@ -2579,8 +2579,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only" }, "details": { "path": "", @@ -2602,8 +2602,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only" }, "details": { "path": "", @@ -2625,8 +2625,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: MIDDLE DOT is allowed between 'l' characters only" }, "details": { "path": "", @@ -2658,8 +2658,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": { - "error": "invalid punycode/IDN: Hebrew GERESH must be preceded by Hebrew character", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: Hebrew GERESH must be preceded by Hebrew character" }, "details": { "path": "", @@ -2826,8 +2826,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" }, "details": { "path": "", @@ -2849,8 +2849,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode/IDN: KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" }, "details": { "path": "", @@ -2902,8 +2902,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid punycode", - "format": "hostname" + "format": "hostname", + "error": "invalid punycode" }, "details": { "path": "", @@ -3255,8 +3255,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "contains disallowed character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "contains disallowed character" }, "details": { "path": "", @@ -3300,8 +3300,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3333,8 +3333,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3356,8 +3356,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": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3494,8 +3494,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3560,8 +3560,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "contains disallowed character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "contains disallowed character" }, "details": { "path": "", @@ -3583,8 +3583,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": { - "error": "Greek KERAIA must be followed by Greek character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "Greek KERAIA must be followed by Greek character" }, "details": { "path": "", @@ -3708,8 +3708,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "Greek KERAIA must be followed by Greek character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "Greek KERAIA must be followed by Greek character" }, "details": { "path": "", @@ -3764,8 +3764,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "Hebrew GERESH must be preceded by Hebrew character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "Hebrew GERESH must be preceded by Hebrew character" }, "details": { "path": "", @@ -3797,8 +3797,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -3820,8 +3820,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "Hebrew GERESH must be preceded by Hebrew character", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "Hebrew GERESH must be preceded by Hebrew character" }, "details": { "path": "", @@ -3853,8 +3853,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" }, "details": { "path": "", @@ -3876,8 +3876,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "KATAKANA MIDDLE DOT must be with Hiragana, Katakana, or Han" }, "details": { "path": "", @@ -3972,8 +3972,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": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4190,8 +4190,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4270,8 +4270,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4314,8 +4314,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": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4402,8 +4402,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "idna error: Errors", - "format": "idn-hostname" + "format": "idn-hostname", + "error": "idna error: Errors" }, "details": { "path": "", @@ -4540,8 +4540,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4562,8 +4562,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4584,8 +4584,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4606,8 +4606,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4628,8 +4628,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv4 address syntax", - "format": "ipv4" + "format": "ipv4", + "error": "invalid IPv4 address syntax" }, "details": { "path": "", @@ -4930,8 +4930,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -4952,8 +4952,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -4974,8 +4974,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5005,8 +5005,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": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5098,8 +5098,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": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5217,8 +5217,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5314,8 +5314,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": { - "error": "invalid IPv6 address syntax", - "format": "ipv6" + "format": "ipv6", + "error": "invalid IPv6 address syntax" }, "details": { "path": "", @@ -5500,8 +5500,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "contains \\\\", - "format": "iri-reference" + "format": "iri-reference", + "error": "contains \\\\" }, "details": { "path": "", @@ -5540,8 +5540,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "contains \\\\", - "format": "iri-reference" + "format": "iri-reference", + "error": "contains \\\\" }, "details": { "path": "", @@ -5722,8 +5722,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "relative url", - "format": "iri" + "format": "iri", + "error": "relative url" }, "details": { "path": "", @@ -5744,8 +5744,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "relative url", - "format": "iri" + "format": "iri", + "error": "relative url" }, "details": { "path": "", @@ -5846,8 +5846,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "~ must be followed by 0 or 1", - "format": "json-pointer" + "format": "json-pointer", + "error": "~ must be followed by 0 or 1" }, "details": { "path": "", @@ -6105,8 +6105,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "~ must be followed by 0 or 1", - "format": "json-pointer" + "format": "json-pointer", + "error": "~ must be followed by 0 or 1" }, "details": { "path": "", @@ -6149,8 +6149,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "~ must be followed by 0 or 1", - "format": "json-pointer" + "format": "json-pointer", + "error": "~ must be followed by 0 or 1" }, "details": { "path": "", @@ -6193,8 +6193,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "~ must be followed by 0 or 1", - "format": "json-pointer" + "format": "json-pointer", + "error": "~ must be followed by 0 or 1" }, "details": { "path": "", @@ -6259,8 +6259,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": { - "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": { - "error": "must start with non-negative integer", - "format": "relative-json-pointer" + "format": "relative-json-pointer", + "error": "must start with non-negative integer" }, "details": { "path": "", @@ -6707,8 +6707,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing colon in correct place", - "format": "time" + "format": "time", + "error": "missing colon in correct place" }, "details": { "path": "", @@ -6751,8 +6751,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing colon in correct place", - "format": "time" + "format": "time", + "error": "missing colon in correct place" }, "details": { "path": "", @@ -6804,8 +6804,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -6835,8 +6835,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -6857,8 +6857,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -6897,8 +6897,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": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -7136,8 +7136,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "invalid leap second", - "format": "time" + "format": "time", + "error": "invalid leap second" }, "details": { "path": "", @@ -7224,8 +7224,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "offset must be 6 characters long", - "format": "time" + "format": "time", + "error": "offset must be 6 characters long" }, "details": { "path": "", @@ -7246,8 +7246,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "offset must be 6 characters long", - "format": "time" + "format": "time", + "error": "offset must be 6 characters long" }, "details": { "path": "", @@ -7268,8 +7268,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "offset must be 6 characters long", - "format": "time" + "format": "time", + "error": "offset must be 6 characters long" }, "details": { "path": "", @@ -7312,8 +7312,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "offset must be 6 characters long", - "format": "time" + "format": "time", + "error": "offset must be 6 characters long" }, "details": { "path": "", @@ -7334,8 +7334,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing colon in correct place", - "format": "time" + "format": "time", + "error": "missing colon in correct place" }, "details": { "path": "", @@ -7378,8 +7378,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "less than 9 characters long", - "format": "time" + "format": "time", + "error": "less than 9 characters long" }, "details": { "path": "", @@ -7662,8 +7662,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 7", - "format": "uri-reference" + "format": "uri-reference", + "error": "unexpected character at index 7" }, "details": { "path": "", @@ -7684,8 +7684,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 26", - "format": "uri-reference" + "format": "uri-reference", + "error": "unexpected character at index 26" }, "details": { "path": "", @@ -8036,8 +8036,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "relative url", - "format": "uri" + "format": "uri", + "error": "relative url" }, "details": { "path": "", @@ -8080,8 +8080,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "relative url", - "format": "uri" + "format": "uri", + "error": "relative url" }, "details": { "path": "", @@ -8124,8 +8124,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 0", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 0" }, "details": { "path": "", @@ -8256,8 +8256,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 26", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 26" }, "details": { "path": "", @@ -8322,8 +8322,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": { - "error": "unexpected character at index 23", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 23" }, "details": { "path": "", @@ -8366,8 +8366,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "unexpected character at index 26", - "format": "uri" + "format": "uri", + "error": "unexpected character at index 26" }, "details": { "path": "", @@ -8539,8 +8539,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "non-hex character 'g'", - "format": "uuid" + "format": "uuid", + "error": "non-hex character 'g'" }, "details": { "path": "", @@ -8561,8 +8561,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": "", @@ -8605,8 +8605,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": { - "error": "element 1 must be 8 characters long", - "format": "uuid" + "format": "uuid", + "error": "element 1 must be 8 characters long" }, "details": { "path": "", @@ -8751,8 +8751,8 @@ { "code": "FORMAT_MISMATCH", "values": { - "error": "missing slash", - "format": "period" + "format": "period", + "error": "missing slash" }, "details": { "path": "", diff --git a/fixtures/maxContains.json b/fixtures/maxContains.json index 1c70fd3..05134e5 100644 --- a/fixtures/maxContains.json +++ b/fixtures/maxContains.json @@ -106,8 +106,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "2" + "count": "2", + "limit": "1" }, "details": { "path": "", @@ -144,8 +144,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "2" + "count": "2", + "limit": "1" }, "details": { "path": "", @@ -284,8 +284,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "3", - "count": "4" + "count": "4", + "limit": "3" }, "details": { "path": "", diff --git a/fixtures/maxItems.json b/fixtures/maxItems.json index e6f7a41..0c600ec 100644 --- a/fixtures/maxItems.json +++ b/fixtures/maxItems.json @@ -52,8 +52,8 @@ { "code": "MAX_ITEMS_VIOLATED", "values": { - "limit": "2", - "count": "3" + "count": "3", + "limit": "2" }, "details": { "path": "", diff --git a/fixtures/maxLength.json b/fixtures/maxLength.json index 29c5640..800e762 100644 --- a/fixtures/maxLength.json +++ b/fixtures/maxLength.json @@ -43,8 +43,8 @@ { "code": "MAX_LENGTH_VIOLATED", "values": { - "limit": "2", - "count": "3" + "count": "3", + "limit": "2" }, "details": { "path": "", @@ -109,8 +109,8 @@ { "code": "MAX_LENGTH_VIOLATED", "values": { - "limit": "2", - "count": "3" + "count": "3", + "limit": "2" }, "details": { "path": "", diff --git a/fixtures/maxProperties.json b/fixtures/maxProperties.json index 1741a29..961ae3e 100644 --- a/fixtures/maxProperties.json +++ b/fixtures/maxProperties.json @@ -139,8 +139,8 @@ { "code": "MAX_PROPERTIES_VIOLATED", "values": { - "limit": "2", - "count": "3" + "count": "3", + "limit": "2" }, "details": { "path": "", @@ -190,8 +190,8 @@ { "code": "MAX_PROPERTIES_VIOLATED", "values": { - "limit": "0", - "count": "1" + "count": "1", + "limit": "0" }, "details": { "path": "", diff --git a/fixtures/maximum.json b/fixtures/maximum.json index c99f981..f2e8209 100644 --- a/fixtures/maximum.json +++ b/fixtures/maximum.json @@ -118,8 +118,8 @@ { "code": "MAXIMUM_VIOLATED", "values": { - "limit": "300", - "value": "300.5" + "value": "300.5", + "limit": "300" }, "details": { "path": "", diff --git a/fixtures/merge.json b/fixtures/merge.json index 76dd3c8..07385e7 100644 --- a/fixtures/merge.json +++ b/fixtures/merge.json @@ -239,8 +239,8 @@ { "code": "DEPENDENCY_MISSING", "values": { - "required_property": "base_dep", - "property_name": "trigger" + "property_name": "trigger", + "required_property": "base_dep" }, "details": { "path": "", diff --git a/fixtures/minContains.json b/fixtures/minContains.json index a8b98bc..0fdbc22 100644 --- a/fixtures/minContains.json +++ b/fixtures/minContains.json @@ -169,8 +169,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "2", - "count": "0" + "count": "0", + "limit": "2" }, "details": { "path": "", @@ -357,8 +357,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "2", - "count": "0" + "count": "0", + "limit": "2" }, "details": { "path": "", @@ -463,8 +463,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "3", - "count": "0" + "count": "0", + "limit": "3" }, "details": { "path": "", @@ -487,8 +487,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "3", - "count": "1" + "count": "1", + "limit": "3" }, "details": { "path": "", @@ -513,8 +513,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "3" + "count": "3", + "limit": "1" }, "details": { "path": "", @@ -657,8 +657,8 @@ { "code": "CONTAINS_VIOLATED", "values": { - "limit": "1", - "count": "2" + "count": "2", + "limit": "1" }, "details": { "path": "", diff --git a/fixtures/minItems.json b/fixtures/minItems.json index ed5f123..56b2bd1 100644 --- a/fixtures/minItems.json +++ b/fixtures/minItems.json @@ -108,8 +108,8 @@ { "code": "MIN_ITEMS_VIOLATED", "values": { - "limit": "1", - "count": "0" + "count": "0", + "limit": "1" }, "details": { "path": "", diff --git a/fixtures/minLength.json b/fixtures/minLength.json index 514765d..adf9100 100644 --- a/fixtures/minLength.json +++ b/fixtures/minLength.json @@ -43,8 +43,8 @@ { "code": "MIN_LENGTH_VIOLATED", "values": { - "limit": "2", - "count": "1" + "count": "1", + "limit": "2" }, "details": { "path": "", diff --git a/fixtures/minimum.json b/fixtures/minimum.json index 7a330c3..2c3c8af 100644 --- a/fixtures/minimum.json +++ b/fixtures/minimum.json @@ -43,8 +43,8 @@ { "code": "MINIMUM_VIOLATED", "values": { - "limit": "1.1", - "value": "0.6" + "value": "0.6", + "limit": "1.1" }, "details": { "path": "", @@ -127,8 +127,8 @@ { "code": "MINIMUM_VIOLATED", "values": { - "limit": "-2", - "value": "-2.0001" + "value": "-2.0001", + "limit": "-2" }, "details": { "path": "", @@ -149,8 +149,8 @@ { "code": "MINIMUM_VIOLATED", "values": { - "limit": "-2", - "value": "-3" + "value": "-3", + "limit": "-2" }, "details": { "path": "", diff --git a/fixtures/multipleOf.json b/fixtures/multipleOf.json index 2e7959e..8281a30 100644 --- a/fixtures/multipleOf.json +++ b/fixtures/multipleOf.json @@ -148,8 +148,8 @@ { "code": "MULTIPLE_OF_VIOLATED", "values": { - "multiple_of": "0.0001", - "value": "0.00751" + "value": "0.00751", + "multiple_of": "0.0001" }, "details": { "path": "", diff --git a/fixtures/objectTypes.json b/fixtures/objectTypes.json index dbd22d0..5bbf664 100644 --- a/fixtures/objectTypes.json +++ b/fixtures/objectTypes.json @@ -156,8 +156,8 @@ { "code": "MAXIMUM_VIOLATED", "values": { - "limit": "50", - "value": "60" + "value": "60", + "limit": "50" }, "details": { "path": "max", diff --git a/fixtures/paths.json b/fixtures/paths.json index fc48c12..78bfcc0 100644 --- a/fixtures/paths.json +++ b/fixtures/paths.json @@ -200,8 +200,8 @@ { "code": "MINIMUM_VIOLATED", "values": { - "limit": "10", - "value": "5" + "value": "5", + "limit": "10" }, "details": { "path": "entities/entity-beta/value", diff --git a/fixtures/pattern.json b/fixtures/pattern.json index a1748d5..e200bcb 100644 --- a/fixtures/pattern.json +++ b/fixtures/pattern.json @@ -34,8 +34,8 @@ { "code": "PATTERN_VIOLATED", "values": { - "value": "abc", - "pattern": "^a*$" + "pattern": "^a*$", + "value": "abc" }, "details": { "path": "", diff --git a/fixtures/polymorphism.json b/fixtures/polymorphism.json index d38a288..0856026 100644 --- a/fixtures/polymorphism.json +++ b/fixtures/polymorphism.json @@ -148,8 +148,8 @@ { "code": "NO_FAMILY_MATCH", "values": { - "value": "alien", - "discriminator": "type" + "discriminator": "type", + "value": "alien" }, "details": { "path": "", @@ -284,8 +284,8 @@ { "code": "NO_FAMILY_MATCH", "values": { - "value": "bot", - "discriminator": "type" + "discriminator": "type", + "value": "bot" }, "details": { "path": "", @@ -591,8 +591,8 @@ { "code": "NO_ONEOF_MATCH", "values": { - "value": "alien", - "discriminator": "type" + "discriminator": "type", + "value": "alien" }, "details": { "path": "", @@ -931,8 +931,8 @@ { "code": "NO_FAMILY_MATCH", "values": { - "value": "unknown_panel", - "discriminator": "kind" + "discriminator": "kind", + "value": "unknown_panel" }, "details": { "path": "", diff --git a/fixtures/propertyNames.json b/fixtures/propertyNames.json index adb2f47..d02866b 100644 --- a/fixtures/propertyNames.json +++ b/fixtures/propertyNames.json @@ -431,8 +431,8 @@ { "code": "MAX_LENGTH_VIOLATED", "values": { - "limit": "3", - "count": "6" + "count": "6", + "limit": "3" }, "details": { "path": "", diff --git a/fixtures/queryer.json b/fixtures/queryer.json index 5d790bb..a906a42 100644 --- a/fixtures/queryer.json +++ b/fixtures/queryer.json @@ -2670,7 +2670,8 @@ " WHERE", " NOT entity_3.archived", " AND attachment_4.kind = 'cover'", - " AND attachment_4.attachable_id = entity_1.id LIMIT 1", + " AND attachment_4.attachable_id = entity_1.id", + " LIMIT 1", " ),", " 'cover_attachments', (", " SELECT COALESCE(jsonb_agg(jsonb_build_object(", diff --git a/fixtures/traits.json b/fixtures/traits.json index d274fae..109b01b 100644 --- a/fixtures/traits.json +++ b/fixtures/traits.json @@ -139,8 +139,8 @@ { "code": "MAX_LENGTH_VIOLATED", "values": { - "limit": "5", - "count": "26" + "count": "26", + "limit": "5" }, "details": { "path": "email", diff --git a/src/database/compile/collection.rs b/src/database/compile/collection.rs index 2b6b5b1..df117f7 100644 --- a/src/database/compile/collection.rs +++ b/src/database/compile/collection.rs @@ -2,7 +2,7 @@ use crate::database::schema::Schema; #[allow(unused_imports)] use crate::drop::{Error, ErrorDetails}; #[allow(unused_imports)] -use std::collections::HashMap; +use indexmap::IndexMap; use std::sync::Arc; impl Schema { @@ -19,7 +19,7 @@ impl Schema { if !c.is_ascii_lowercase() && !c.is_ascii_digit() && c != '_' && c != '.' && c != '$' { errors.push(Error { code: "INVALID_IDENTIFIER".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("character".to_string(), c.to_string()), ("field_name".to_string(), field_name.to_string()), ("identifier".to_string(), id.to_string()), diff --git a/src/database/compile/mod.rs b/src/database/compile/mod.rs index 26a3218..523d3ee 100644 --- a/src/database/compile/mod.rs +++ b/src/database/compile/mod.rs @@ -7,7 +7,6 @@ pub mod polymorphism; use crate::database::schema::Schema; use crate::drop::{Error, ErrorDetails}; use indexmap::IndexMap; -use std::collections::HashMap; impl Schema { pub fn compile( @@ -64,7 +63,7 @@ impl Schema { if custom_type_count > 1 { errors.push(Error { code: "MULTIPLE_INHERITANCE_PROHIBITED".to_string(), - values: Some(HashMap::from([("types".to_string(), types.join(", "))])), + values: Some(IndexMap::from([("types".to_string(), types.join(", "))])), details: ErrorDetails { path: Some(path.clone()), schema: Some(root_id.to_string()), diff --git a/src/database/compile/polymorphism.rs b/src/database/compile/polymorphism.rs index abb0e48..757530b 100644 --- a/src/database/compile/polymorphism.rs +++ b/src/database/compile/polymorphism.rs @@ -1,6 +1,6 @@ use crate::drop::{Error, ErrorDetails}; use indexmap::IndexSet; -use std::collections::HashMap; +use indexmap::IndexMap; use crate::database::schema::Schema; impl Schema { @@ -144,7 +144,7 @@ impl Schema { if options.contains_key(&val) { errors.push(Error { code: "POLYMORPHIC_COLLISION".to_string(), - values: Some(HashMap::from([("value".to_string(), val.to_string())])), + values: Some(IndexMap::from([("value".to_string(), val.to_string())])), details: ErrorDetails { path: Some(path.to_string()), schema: Some(root_id.to_string()), diff --git a/src/database/compose/mod.rs b/src/database/compose/mod.rs index 3e020e6..f036398 100644 --- a/src/database/compose/mod.rs +++ b/src/database/compose/mod.rs @@ -1,6 +1,7 @@ use crate::drop::{Error, ErrorDetails}; use serde_json::Value; use std::collections::{HashMap, HashSet}; +use indexmap::IndexMap; pub fn compose(val: &mut Value, errors: &mut Vec) { let mut traits = HashMap::new(); @@ -114,7 +115,7 @@ fn resolve_in_place( if visited.contains(inc_name) { errors.push(Error { code: "CIRCULAR_INCLUDE_DETECTED".to_string(), - values: Some(HashMap::from([( + values: Some(IndexMap::from([( "include".to_string(), inc_name.to_string(), )])), @@ -218,7 +219,7 @@ fn resolve_in_place( } else { errors.push(Error { code: "TRAIT_NOT_FOUND".to_string(), - values: Some(HashMap::from([( + values: Some(IndexMap::from([( "include".to_string(), inc_name.to_string(), )])), diff --git a/src/database/mod.rs b/src/database/mod.rs index 1934cf4..64d889d 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -28,7 +28,7 @@ use serde_json::Value; use indexmap::IndexMap; use std::sync::Arc; use r#type::Type; -use std::collections::HashMap; + use crate::drop::{Drop, Error, ErrorDetails}; #[derive(serde::Serialize)] @@ -76,7 +76,7 @@ impl Database { Err(e) => { errors.push(Error { code: "DATABASE_ENUM_PARSE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("enum".to_string(), name.clone()), ("reason".to_string(), e.to_string()), ])), @@ -104,7 +104,7 @@ impl Database { Err(e) => { errors.push(Error { code: "DATABASE_TYPE_PARSE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("type".to_string(), name.clone()), ("reason".to_string(), e.to_string()), ])), @@ -136,7 +136,7 @@ impl Database { Err(e) => { errors.push(Error { code: "DATABASE_RELATION_PARSE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("relation".to_string(), constraint.clone()), ("reason".to_string(), e.to_string()), ])), @@ -164,7 +164,7 @@ impl Database { Err(e) => { errors.push(Error { code: "DATABASE_PUNC_PARSE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("punc".to_string(), name.clone()), ("reason".to_string(), e.to_string()), ])), @@ -461,7 +461,7 @@ impl Database { errors.push(Error { code: "EDGE_MISSING".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("parent_type".to_string(), parent_type.to_string()), ("child_type".to_string(), child_type.to_string()), ("property_name".to_string(), prop_name.to_string()), @@ -563,7 +563,7 @@ impl Database { errors.push(Error { code: "AMBIGUOUS_TYPE_RELATIONS".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("parent_type".to_string(), parent_type.to_string()), ("child_type".to_string(), child_type.to_string()), ("property_name".to_string(), prop_name.to_string()), diff --git a/src/drop.rs b/src/drop.rs index b9aa676..a6dc0e2 100644 --- a/src/drop.rs +++ b/src/drop.rs @@ -57,13 +57,13 @@ impl Drop { } } -use std::collections::HashMap; +use indexmap::IndexMap; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Error { pub code: String, #[serde(skip_serializing_if = "Option::is_none")] - pub values: Option>, + pub values: Option>, pub details: ErrorDetails, } diff --git a/src/merger/mod.rs b/src/merger/mod.rs index 4898a16..10cac99 100644 --- a/src/merger/mod.rs +++ b/src/merger/mod.rs @@ -7,7 +7,7 @@ use crate::database::Database; use crate::database::r#type::Type; use crate::drop::{Drop, Error, ErrorDetails}; use serde_json::Value; -use std::collections::HashMap; +use indexmap::IndexMap; use std::sync::Arc; pub struct Merger { @@ -31,7 +31,7 @@ impl Merger { None => { return Drop::with_errors(vec![Error { code: "SCHEMA_NOT_FOUND".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("schema".to_string(), schema_id.to_string()), ])), details: ErrorDetails { @@ -78,7 +78,7 @@ impl Merger { return Drop::with_errors(vec![Error { code: final_code, - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), final_message), ])), details: ErrorDetails { @@ -96,7 +96,7 @@ impl Merger { if let Err(e) = self.db.execute(¬ify_sql, None) { return Drop::with_errors(vec![Error { code: "MERGE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), e.to_string()), ])), details: ErrorDetails { diff --git a/src/queryer/compiler.rs b/src/queryer/compiler.rs index 0a93239..6c26986 100644 --- a/src/queryer/compiler.rs +++ b/src/queryer/compiler.rs @@ -240,7 +240,7 @@ impl<'a> Compiler<'a> { }; // 3. Build WHERE clauses - let where_clauses = self.compile_where_clause(r#type, &table_aliases, node)?; + let where_clauses = self.compile_where_clause(r#type, &table_aliases, node.clone())?; let selection = if is_array { format!("COALESCE(jsonb_agg({}), '[]'::jsonb)", jsonb_obj_sql) @@ -248,11 +248,38 @@ impl<'a> Compiler<'a> { jsonb_obj_sql }; + let mut limit_clause = ""; + if !is_array { + let is_reverse = if let Some(prop_ref) = &node.property_name { + let prop = prop_ref.as_str(); + if let Some(parent_schema) = &node.parent_schema { + if let Some(compiled_edges) = parent_schema.obj.compiled_edges.get() { + if let Some(edge) = compiled_edges.get(prop) { + !edge.forward + } else { + false + } + } else { + false + } + } else { + false + } + } else { + false + }; + + if is_reverse { + limit_clause = " LIMIT 1"; + } + } + let full_sql = format!( - "(SELECT {} FROM {} WHERE {})", + "(SELECT {} FROM {} WHERE {}{})", selection, from_clauses.join(" "), - where_clauses.join(" AND ") + where_clauses.join(" AND "), + limit_clause ); Ok(( diff --git a/src/queryer/mod.rs b/src/queryer/mod.rs index f733a53..7610a8e 100644 --- a/src/queryer/mod.rs +++ b/src/queryer/mod.rs @@ -1,6 +1,6 @@ use crate::database::Database; use crate::drop::{Drop, Error, ErrorDetails}; -use std::collections::HashMap; +use indexmap::IndexMap; use std::sync::Arc; pub mod compiler; @@ -33,7 +33,7 @@ impl Queryer { Err(msg) => { return Drop::with_errors(vec![Error { code: "FILTER_PARSE_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), msg.clone()), ])), details: ErrorDetails { @@ -140,7 +140,7 @@ impl Queryer { } Err(e) => Err(Drop::with_errors(vec![Error { code: "QUERY_COMPILATION_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), e.clone()), ])), details: ErrorDetails { @@ -169,7 +169,7 @@ impl Queryer { } Ok(other) => Drop::with_errors(vec![Error { code: "QUERY_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), format!("Expected array from generic query, got: {:?}", other)), ])), details: ErrorDetails { @@ -181,7 +181,7 @@ impl Queryer { }]), Err(e) => Drop::with_errors(vec![Error { code: "QUERY_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("error".to_string(), e.to_string()), ])), details: ErrorDetails { diff --git a/src/tests/formatter.rs b/src/tests/formatter.rs index 5b062a6..80b6f1a 100644 --- a/src/tests/formatter.rs +++ b/src/tests/formatter.rs @@ -180,6 +180,9 @@ impl SqlFormatter { fn format_query(&mut self, query: &Query) { self.format_set_expr(&query.body); + if let Some(limit_clause) = &query.limit_clause { + self.push_line(&format!("{}", limit_clause.to_string().trim())); + } } fn format_set_expr(&mut self, set_expr: &SetExpr) { diff --git a/src/validator/error.rs b/src/validator/error.rs index 459dbec..33f9345 100644 --- a/src/validator/error.rs +++ b/src/validator/error.rs @@ -1,9 +1,9 @@ -use std::collections::HashMap; +use indexmap::IndexMap; #[derive(Debug, Clone, serde::Serialize)] pub struct ValidationError { pub code: String, #[serde(skip_serializing_if = "Option::is_none")] - pub values: Option>, + pub values: Option>, pub path: String, } diff --git a/src/validator/mod.rs b/src/validator/mod.rs index 54e13f6..3e82064 100644 --- a/src/validator/mod.rs +++ b/src/validator/mod.rs @@ -1,4 +1,5 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; +use indexmap::IndexMap; pub mod context; pub mod error; @@ -92,7 +93,7 @@ impl Validator { } else { Drop::with_errors(vec![Error { code: "SCHEMA_NOT_FOUND".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("schema".to_string(), schema_id.to_string()), ])), details: ErrorDetails { diff --git a/src/validator/rules/array.rs b/src/validator/rules/array.rs index e34b105..706297b 100644 --- a/src/validator/rules/array.rs +++ b/src/validator/rules/array.rs @@ -1,4 +1,5 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; +use indexmap::IndexMap; use serde_json::Value; @@ -18,7 +19,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MIN_ITEMS_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), arr.len().to_string()), ("limit".to_string(), min.to_string()), ])), @@ -30,7 +31,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MAX_ITEMS_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), arr.len().to_string()), ("limit".to_string(), max.to_string()), ])), @@ -77,7 +78,7 @@ impl<'a> ValidationContext<'a> { if _match_count < min { result.errors.push(ValidationError { code: "CONTAINS_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), _match_count.to_string()), ("limit".to_string(), min.to_string()), ])), @@ -89,7 +90,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "CONTAINS_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), _match_count.to_string()), ("limit".to_string(), max.to_string()), ])), diff --git a/src/validator/rules/core.rs b/src/validator/rules/core.rs index 6b7d9e6..7ffee36 100644 --- a/src/validator/rules/core.rs +++ b/src/validator/rules/core.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use indexmap::IndexMap; use crate::validator::Validator; use crate::validator::context::ValidationContext; @@ -19,7 +19,7 @@ impl<'a> ValidationContext<'a> { if !Validator::check_type(t, current) { result.errors.push(ValidationError { code: "INVALID_TYPE".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("expected".to_string(), t.to_string()), ])), path: self.path.to_string(), @@ -37,7 +37,7 @@ impl<'a> ValidationContext<'a> { if !valid { result.errors.push(ValidationError { code: "INVALID_TYPE".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("expected".to_string(), format!("{:?}", types)), ])), path: self.path.to_string(), @@ -51,7 +51,7 @@ impl<'a> ValidationContext<'a> { if !equals(current, const_val) { result.errors.push(ValidationError { code: "CONST_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("expected".to_string(), format!("{:?}", const_val)), ])), path: self.path.to_string(), @@ -74,7 +74,7 @@ impl<'a> ValidationContext<'a> { if !found { result.errors.push(ValidationError { code: "ENUM_MISMATCH".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("expected".to_string(), format!("{:?}", enum_vals)), ])), path: self.path.to_string(), diff --git a/src/validator/rules/extensible.rs b/src/validator/rules/extensible.rs index 2a9dc6f..2c13d47 100644 --- a/src/validator/rules/extensible.rs +++ b/src/validator/rules/extensible.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use indexmap::IndexMap; use crate::database::object::{is_primitive_type, SchemaTypeOrArray}; use crate::database::schema::Schema; @@ -75,7 +75,7 @@ impl<'a> ValidationContext<'a> { if !result.evaluated_keys.contains(key) && !self.overrides.contains(key) { result.errors.push(ValidationError { code: "STRICT_PROPERTY_VIOLATION".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("property_name".to_string(), key.to_string()), ])), path: self.join_path(key), diff --git a/src/validator/rules/format.rs b/src/validator/rules/format.rs index f6e3776..2615d77 100644 --- a/src/validator/rules/format.rs +++ b/src/validator/rules/format.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use indexmap::IndexMap; use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; @@ -21,7 +21,7 @@ impl<'a> ValidationContext<'a> { if should && let Err(e) = f(current) { result.errors.push(ValidationError { code: "FORMAT_MISMATCH".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("format".to_string(), self.schema.format.clone().unwrap_or_default()), ("error".to_string(), e.to_string()), ])), @@ -35,7 +35,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "FORMAT_MISMATCH".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("format".to_string(), self.schema.format.clone().unwrap_or_default()), ])), path: self.path.to_string(), diff --git a/src/validator/rules/mod.rs b/src/validator/rules/mod.rs index 81f31ee..b190d60 100644 --- a/src/validator/rules/mod.rs +++ b/src/validator/rules/mod.rs @@ -1,7 +1,7 @@ use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; use crate::validator::result::ValidationResult; -use std::collections::HashMap; +use indexmap::IndexMap; pub mod array; pub mod cases; @@ -64,7 +64,7 @@ impl<'a> ValidationContext<'a> { if self.depth > 100 { Err(ValidationError { code: "RECURSION_LIMIT_EXCEEDED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("limit".to_string(), 100.to_string()), ])), path: self.path.to_string(), diff --git a/src/validator/rules/numeric.rs b/src/validator/rules/numeric.rs index 2210c51..8c78cf3 100644 --- a/src/validator/rules/numeric.rs +++ b/src/validator/rules/numeric.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use indexmap::IndexMap; use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; @@ -16,7 +16,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MINIMUM_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), num.to_string()), ("limit".to_string(), min.to_string()), ])), @@ -28,7 +28,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MAXIMUM_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), num.to_string()), ("limit".to_string(), max.to_string()), ])), @@ -40,7 +40,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "EXCLUSIVE_MINIMUM_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), num.to_string()), ("limit".to_string(), ex_min.to_string()), ])), @@ -52,7 +52,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "EXCLUSIVE_MAXIMUM_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), num.to_string()), ("limit".to_string(), ex_max.to_string()), ])), @@ -64,7 +64,7 @@ impl<'a> ValidationContext<'a> { if (val - val.round()).abs() > f64::EPSILON { result.errors.push(ValidationError { code: "MULTIPLE_OF_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), num.to_string()), ("multiple_of".to_string(), multiple_of.to_string()), ])), diff --git a/src/validator/rules/object.rs b/src/validator/rules/object.rs index 196a142..e7d1675 100644 --- a/src/validator/rules/object.rs +++ b/src/validator/rules/object.rs @@ -1,4 +1,5 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; +use indexmap::IndexMap; use serde_json::Value; @@ -38,7 +39,7 @@ impl<'a> ValidationContext<'a> { } else { result.errors.push(ValidationError { code: "CONST_VIOLATED".to_string(), // Aligning with original const override errors natively - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("value".to_string(), type_str.to_string()), ])), path: self.join_path("type"), @@ -49,7 +50,7 @@ impl<'a> ValidationContext<'a> { // Because it's a global entity target, the payload must structurally provide a discriminator natively result.errors.push(ValidationError { code: "MISSING_TYPE".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("expected".to_string(), expected_type.to_string()), ])), path: self.path.clone(), // Empty boundary @@ -104,7 +105,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MIN_PROPERTIES_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), obj.len().to_string()), ("limit".to_string(), min.to_string()), ])), @@ -117,7 +118,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MAX_PROPERTIES_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), obj.len().to_string()), ("limit".to_string(), max.to_string()), ])), @@ -131,7 +132,7 @@ impl<'a> ValidationContext<'a> { if field == "type" { result.errors.push(ValidationError { code: "MISSING_TYPE".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("field_name".to_string(), "type".to_string()), ])), path: self.join_path(field), @@ -139,7 +140,7 @@ impl<'a> ValidationContext<'a> { } else { result.errors.push(ValidationError { code: "REQUIRED_FIELD_MISSING".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("field_name".to_string(), field.to_string()), ])), path: self.join_path(field), @@ -158,7 +159,7 @@ impl<'a> ValidationContext<'a> { if !obj.contains_key(req_prop) { result.errors.push(ValidationError { code: "DEPENDENCY_MISSING".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("property_name".to_string(), prop.to_string()), ("required_property".to_string(), req_prop.to_string()), ])), diff --git a/src/validator/rules/polymorphism.rs b/src/validator/rules/polymorphism.rs index d1b89c7..fda4e54 100644 --- a/src/validator/rules/polymorphism.rs +++ b/src/validator/rules/polymorphism.rs @@ -1,5 +1,3 @@ -use std::collections::HashMap; - use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; use crate::validator::result::ValidationResult; @@ -55,10 +53,10 @@ impl<'a> ValidationContext<'a> { return self.execute_polymorph(options, result); } else { result.errors.push(ValidationError { - code: "UNCOMPILED_ONEOF".to_string(), - values: None, - path: self.path.to_string(), - }); + code: "UNCOMPILED_ONEOF".to_string(), + values: None, + path: self.path.to_string(), + }); return Ok(false); } } @@ -110,9 +108,10 @@ impl<'a> ValidationContext<'a> { } else { result.errors.push(ValidationError { code: "MISSING_COMPILED_SCHEMA".to_string(), - values: Some(HashMap::from([ - ("target_id".to_string(), target_id.to_string()), - ])), + values: Some(IndexMap::from([( + "target_id".to_string(), + target_id.to_string(), + )])), path: self.path.to_string(), }); return Ok(false); @@ -132,9 +131,7 @@ impl<'a> ValidationContext<'a> { } else { result.errors.push(ValidationError { code: "MISSING_COMPILED_SCHEMA".to_string(), - values: Some(HashMap::from([ - ("index".to_string(), idx.to_string()), - ])), + values: Some(IndexMap::from([("index".to_string(), idx.to_string())])), path: self.path.to_string(), }); return Ok(false); @@ -144,14 +141,12 @@ impl<'a> ValidationContext<'a> { } } else { let values = if let Some(d) = self.schema.compiled_discriminator.get() { - Some(HashMap::from([ + Some(IndexMap::from([ ("discriminator".to_string(), d.to_string()), ("value".to_string(), val.to_string()), ])) } else { - Some(HashMap::from([ - ("primitive".to_string(), val.to_string()), - ])) + Some(IndexMap::from([("primitive".to_string(), val.to_string())])) }; result.errors.push(ValidationError { code: if self.schema.family.is_some() { @@ -168,9 +163,10 @@ impl<'a> ValidationContext<'a> { if let Some(d) = self.schema.compiled_discriminator.get() { result.errors.push(ValidationError { code: "MISSING_TYPE".to_string(), - values: Some(HashMap::from([ - ("discriminator".to_string(), d.to_string()), - ])), + values: Some(IndexMap::from([( + "discriminator".to_string(), + d.to_string(), + )])), path: self.path.to_string(), }); } diff --git a/src/validator/rules/string.rs b/src/validator/rules/string.rs index ee034f7..e045b94 100644 --- a/src/validator/rules/string.rs +++ b/src/validator/rules/string.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use indexmap::IndexMap; use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; @@ -17,7 +17,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MIN_LENGTH_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), s.chars().count().to_string()), ("limit".to_string(), min.to_string()), ])), @@ -29,7 +29,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "MAX_LENGTH_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("count".to_string(), s.chars().count().to_string()), ("limit".to_string(), max.to_string()), ])), @@ -40,7 +40,7 @@ impl<'a> ValidationContext<'a> { if !compiled_re.0.is_match(s) { result.errors.push(ValidationError { code: "PATTERN_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pattern".to_string(), self.schema.pattern.clone().unwrap_or_default()), ("value".to_string(), s.to_string()), ])), @@ -53,7 +53,7 @@ impl<'a> ValidationContext<'a> { { result.errors.push(ValidationError { code: "PATTERN_VIOLATED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pattern".to_string(), pattern.to_string()), ("value".to_string(), s.to_string()), ])), diff --git a/src/validator/rules/type.rs b/src/validator/rules/type.rs index 724cab9..b1e8303 100644 --- a/src/validator/rules/type.rs +++ b/src/validator/rules/type.rs @@ -2,7 +2,7 @@ use crate::database::object::{is_primitive_type, SchemaTypeOrArray}; use crate::validator::context::ValidationContext; use crate::validator::error::ValidationError; use crate::validator::result::ValidationResult; -use std::collections::HashMap; +use indexmap::IndexMap; impl<'a> ValidationContext<'a> { pub(crate) fn validate_type( @@ -76,7 +76,7 @@ impl<'a> ValidationContext<'a> { if !resolved { result.errors.push(ValidationError { code: "DYNAMIC_TYPE_RESOLUTION_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pointer".to_string(), t.clone()), ("discriminator".to_string(), var_name.to_string()), ])), @@ -109,7 +109,7 @@ impl<'a> ValidationContext<'a> { if t.starts_with('$') { result.errors.push(ValidationError { code: "DYNAMIC_TYPE_RESOLUTION_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pointer".to_string(), target_id.to_string()), ])), path: self.path.to_string(), @@ -117,7 +117,7 @@ impl<'a> ValidationContext<'a> { } else if self.schema.is_proxy() { result.errors.push(ValidationError { code: "PROXY_TYPE_RESOLUTION_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pointer".to_string(), target_id.to_string()), ])), path: self.path.to_string(), @@ -125,7 +125,7 @@ impl<'a> ValidationContext<'a> { } else { result.errors.push(ValidationError { code: "INHERITANCE_RESOLUTION_FAILED".to_string(), - values: Some(HashMap::from([ + values: Some(IndexMap::from([ ("pointer".to_string(), target_id.to_string()), ])), path: self.path.to_string(),