From c287624e74366d68a944c7b5662357d1aae6ae3d Mon Sep 17 00:00:00 2001 From: Jan Melcher Date: Fri, 14 Jun 2024 17:39:16 +0200 Subject: [PATCH] test: add regression test for I18nString filter The AQL fragment created by this filter generates an internal error in ArangoDB 3.12.0 due to a regression. The bug will be fixed with ArangoDB 3.12.1. --- .vscode/settings.json | 3 + .../logistics/model/country.graphqls | 1 + spec/regression/logistics/test-data.json | 12 + .../logistics/tests/deprecations.result.json | 42 +- .../logistics/tests/descriptions.result.json | 391 ++++++++++-------- ...ilter-stringmap-in-child-entities.graphql} | 0 ...r-stringmap-in-child-entities.result.json} | 0 .../filter-stringmap-in-root-entities.graphql | 17 + ...ter-stringmap-in-root-entities.result.json | 25 ++ 9 files changed, 307 insertions(+), 184 deletions(-) create mode 100644 .vscode/settings.json rename spec/regression/logistics/tests/{filter-stringmap.graphql => filter-stringmap-in-child-entities.graphql} (100%) rename spec/regression/logistics/tests/{filter-stringmap.result.json => filter-stringmap-in-child-entities.result.json} (100%) create mode 100644 spec/regression/logistics/tests/filter-stringmap-in-root-entities.graphql create mode 100644 spec/regression/logistics/tests/filter-stringmap-in-root-entities.result.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..25fa6215 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/spec/regression/logistics/model/country.graphqls b/spec/regression/logistics/model/country.graphqls index 85ca3b24..5d7593c1 100644 --- a/spec/regression/logistics/model/country.graphqls +++ b/spec/regression/logistics/model/country.graphqls @@ -3,6 +3,7 @@ type Country @roles(read: ["allusers"], readWrite: ["admin"]) { isoCode: String @key description: [Translation] + descriptionI18nString: I18nString totalInvestment: String @roles(readWrite: "accounting") someKey: String @flexSearch } diff --git a/spec/regression/logistics/test-data.json b/spec/regression/logistics/test-data.json index 20098df5..d793771c 100644 --- a/spec/regression/logistics/test-data.json +++ b/spec/regression/logistics/test-data.json @@ -15,6 +15,10 @@ "translation": "Germany" } ], + "descriptionI18nString": { + "de": "Deutschland", + "en": "Germany" + }, "totalInvestment": "EUR 50000000", "someKey": "1" }, @@ -31,6 +35,10 @@ "translation": "United Kingdom" } ], + "descriptionI18nString": { + "de": "Vereinigtes Königreich", + "en": "United Kingdom" + }, "totalInvestment": "EUR 3000000", "someKey": "2" }, @@ -47,6 +55,10 @@ "translation": "United States" } ], + "descriptionI18nString": { + "de": "Vereinigte Staaten", + "en": "United States" + }, "someKey": null }, { diff --git a/spec/regression/logistics/tests/deprecations.result.json b/spec/regression/logistics/tests/deprecations.result.json index 8ec76164..dbfc4a11 100644 --- a/spec/regression/logistics/tests/deprecations.result.json +++ b/spec/regression/logistics/tests/deprecations.result.json @@ -521,6 +521,16 @@ "isDeprecated": true, "deprecationReason": "OrderBy values that include relations or references are deprecated" }, + { + "name": "consignee_country_descriptionI18nString_ASC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, + { + "name": "consignee_country_descriptionI18nString_DESC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, { "name": "consignee_country_totalInvestment_ASC", "isDeprecated": true, @@ -621,6 +631,16 @@ "isDeprecated": true, "deprecationReason": "OrderBy values that include relations or references are deprecated" }, + { + "name": "destinationCountry_descriptionI18nString_ASC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, + { + "name": "destinationCountry_descriptionI18nString_DESC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, { "name": "destinationCountry_totalInvestment_ASC", "isDeprecated": true, @@ -701,6 +721,16 @@ "isDeprecated": true, "deprecationReason": "OrderBy values that include relations or references are deprecated" }, + { + "name": "originCountry_descriptionI18nString_ASC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, + { + "name": "originCountry_descriptionI18nString_DESC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, { "name": "originCountry_totalInvestment_ASC", "isDeprecated": true, @@ -851,6 +881,16 @@ "isDeprecated": true, "deprecationReason": "OrderBy values that include relations or references are deprecated" }, + { + "name": "destination_country_descriptionI18nString_ASC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, + { + "name": "destination_country_descriptionI18nString_DESC", + "isDeprecated": true, + "deprecationReason": "OrderBy values that include relations or references are deprecated" + }, { "name": "destination_country_totalInvestment_ASC", "isDeprecated": true, @@ -1104,4 +1144,4 @@ ] } } -} +} \ No newline at end of file diff --git a/spec/regression/logistics/tests/descriptions.result.json b/spec/regression/logistics/tests/descriptions.result.json index 93dce69b..7c82df3f 100644 --- a/spec/regression/logistics/tests/descriptions.result.json +++ b/spec/regression/logistics/tests/descriptions.result.json @@ -543,6 +543,11 @@ "description": null, "deprecationReason": null }, + { + "name": "descriptionI18nString", + "description": null, + "deprecationReason": null + }, { "name": "totalInvestment", "description": null, @@ -771,6 +776,12 @@ "fields": null, "inputFields": null }, + { + "name": "I18nString", + "description": "The \"I18nString\" scalar type represents an internationalized string.\n\n Structurally, the \"I18nString`\" type is equivalent to the \"StringMap\" type. Keys are ISO 639-1 language codes, and values are the localized strings. In the future, more specific features may be added to this type, so it is preferred over the \"StringMap\" type to represent internationalized strings.\n\n Values are *not* additionally JSON-encoded or JSON-parsed, so e.g. pass a raw JSON object here instead of a JSON-representation of that object.", + "fields": null, + "inputFields": null + }, { "name": "CountryFilter", "description": "Filter type for Country.\n\nAll fields in this type are *and*-combined; see the `or` field for *or*-combination.", @@ -996,6 +1007,11 @@ "description": "Checks if `description` is an empty list (true) or a non-empty list or null (false).", "deprecationReason": null }, + { + "name": "descriptionI18nString_some", + "description": "Makes sure at least one of the entries in \"descriptionI18nString\" has a value that matches a certain filter.\n\nNote that you can specify the empty object for this filter to make sure `descriptionI18nString` has at least one item.", + "deprecationReason": null + }, { "name": "totalInvestment", "description": "Checks if `totalInvestment` equals a specified string, case-sensitively.\n\nIf an index exists on `totalInvestment`, it can be used.\n\nSee also `like` for a case-insensitive filter.", @@ -1168,6 +1184,183 @@ } ] }, + { + "name": "I18nStringEntryFilter", + "description": "Filter type for entries in a I18nString.\n\nAll fields in this type are *and*-combined; see the `or` field for *or*-combination.", + "fields": null, + "inputFields": [ + { + "name": "language", + "description": "Checks if `language` equals a specified string, case-sensitively.\n\nIf an index exists on `language`, it can be used.\n\nSee also `like` for a case-insensitive filter.", + "deprecationReason": null + }, + { + "name": "language_not", + "description": "Checks if `language` does not equal a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "language_in", + "description": "Checks if `language` is equal to one of the specified values.", + "deprecationReason": null + }, + { + "name": "language_not_in", + "description": "Checks if `language` is not equal to one of the specified values.", + "deprecationReason": null + }, + { + "name": "language_lt", + "description": "Checks if `language` is less than a specified value.", + "deprecationReason": null + }, + { + "name": "language_lte", + "description": "Checks if `language` is less or equal a specified value.", + "deprecationReason": null + }, + { + "name": "language_gt", + "description": "Checks if `language` is greater than a specified value.", + "deprecationReason": null + }, + { + "name": "language_gte", + "description": "Checks if `language` is greater or equal a specified value.", + "deprecationReason": null + }, + { + "name": "language_contains", + "description": "Checks if `language` contains a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "language_not_contains", + "description": "Checks if `language` does not contain a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "language_starts_with", + "description": "Checks if `language` starts with a specified string, case-sensitively.\n\nNever uses an index. Consider using `like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", + "deprecationReason": null + }, + { + "name": "language_not_starts_with", + "description": "Checks if `language` does not start with a specified string, case-sensitively.\n\nNever uses an index. Consider using `not_like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", + "deprecationReason": null + }, + { + "name": "language_ends_with", + "description": "Checks if `language` ends with a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "language_not_ends_with", + "description": "Checks if `language` does not end with a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "language_like", + "description": "Matches `language` against a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)\n\nIf an index exists on `language`, it can be used for the literal prefix (the part until the first placeholder).", + "deprecationReason": null + }, + { + "name": "language_not_like", + "description": "Checks if `language` does *not* match a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)", + "deprecationReason": null + }, + { + "name": "value", + "description": "Checks if `value` equals a specified string, case-sensitively.\n\nIf an index exists on `value`, it can be used.\n\nSee also `like` for a case-insensitive filter.", + "deprecationReason": null + }, + { + "name": "value_not", + "description": "Checks if `value` does not equal a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "value_in", + "description": "Checks if `value` is equal to one of the specified values.", + "deprecationReason": null + }, + { + "name": "value_not_in", + "description": "Checks if `value` is not equal to one of the specified values.", + "deprecationReason": null + }, + { + "name": "value_lt", + "description": "Checks if `value` is less than a specified value.", + "deprecationReason": null + }, + { + "name": "value_lte", + "description": "Checks if `value` is less or equal a specified value.", + "deprecationReason": null + }, + { + "name": "value_gt", + "description": "Checks if `value` is greater than a specified value.", + "deprecationReason": null + }, + { + "name": "value_gte", + "description": "Checks if `value` is greater or equal a specified value.", + "deprecationReason": null + }, + { + "name": "value_contains", + "description": "Checks if `value` contains a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "value_not_contains", + "description": "Checks if `value` does not contain a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "value_starts_with", + "description": "Checks if `value` starts with a specified string, case-sensitively.\n\nNever uses an index. Consider using `like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", + "deprecationReason": null + }, + { + "name": "value_not_starts_with", + "description": "Checks if `value` does not start with a specified string, case-sensitively.\n\nNever uses an index. Consider using `not_like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", + "deprecationReason": null + }, + { + "name": "value_ends_with", + "description": "Checks if `value` ends with a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "value_not_ends_with", + "description": "Checks if `value` does not end with a specified string, case-sensitively.", + "deprecationReason": null + }, + { + "name": "value_like", + "description": "Matches `value` against a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)\n\nIf an index exists on `value`, it can be used for the literal prefix (the part until the first placeholder).", + "deprecationReason": null + }, + { + "name": "value_not_like", + "description": "Checks if `value` does *not* match a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)", + "deprecationReason": null + }, + { + "name": "AND", + "description": "A field that checks if all filters in the list apply\n\nIf the list is empty, this filter applies to all objects.", + "deprecationReason": null + }, + { + "name": "OR", + "description": "A field that checks if any of the filters in the list apply.\n\nIf the list is empty, this filter applies to no objects.\n\nNote that only the items in the list *or*-combined; this complete `OR` field is *and*-combined with outer fields in the parent filter type.", + "deprecationReason": null + } + ] + }, { "name": "CountryOrderBy", "description": null, @@ -1810,12 +2003,6 @@ ], "inputFields": null }, - { - "name": "I18nString", - "description": "The \"I18nString\" scalar type represents an internationalized string.\n\n Structurally, the \"I18nString`\" type is equivalent to the \"StringMap\" type. Keys are ISO 639-1 language codes, and values are the localized strings. In the future, more specific features may be added to this type, so it is preferred over the \"StringMap\" type to represent internationalized strings.\n\n Values are *not* additionally JSON-encoded or JSON-parsed, so e.g. pass a raw JSON object here instead of a JSON-representation of that object.", - "fields": null, - "inputFields": null - }, { "name": "DeliveryItemFilter", "description": "Filter type for DeliveryItem.\n\nAll fields in this type are *and*-combined; see the `or` field for *or*-combination.", @@ -5005,183 +5192,6 @@ "fields": null, "inputFields": null }, - { - "name": "I18nStringEntryFilter", - "description": "Filter type for entries in a I18nString.\n\nAll fields in this type are *and*-combined; see the `or` field for *or*-combination.", - "fields": null, - "inputFields": [ - { - "name": "language", - "description": "Checks if `language` equals a specified string, case-sensitively.\n\nIf an index exists on `language`, it can be used.\n\nSee also `like` for a case-insensitive filter.", - "deprecationReason": null - }, - { - "name": "language_not", - "description": "Checks if `language` does not equal a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "language_in", - "description": "Checks if `language` is equal to one of the specified values.", - "deprecationReason": null - }, - { - "name": "language_not_in", - "description": "Checks if `language` is not equal to one of the specified values.", - "deprecationReason": null - }, - { - "name": "language_lt", - "description": "Checks if `language` is less than a specified value.", - "deprecationReason": null - }, - { - "name": "language_lte", - "description": "Checks if `language` is less or equal a specified value.", - "deprecationReason": null - }, - { - "name": "language_gt", - "description": "Checks if `language` is greater than a specified value.", - "deprecationReason": null - }, - { - "name": "language_gte", - "description": "Checks if `language` is greater or equal a specified value.", - "deprecationReason": null - }, - { - "name": "language_contains", - "description": "Checks if `language` contains a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "language_not_contains", - "description": "Checks if `language` does not contain a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "language_starts_with", - "description": "Checks if `language` starts with a specified string, case-sensitively.\n\nNever uses an index. Consider using `like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", - "deprecationReason": null - }, - { - "name": "language_not_starts_with", - "description": "Checks if `language` does not start with a specified string, case-sensitively.\n\nNever uses an index. Consider using `not_like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", - "deprecationReason": null - }, - { - "name": "language_ends_with", - "description": "Checks if `language` ends with a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "language_not_ends_with", - "description": "Checks if `language` does not end with a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "language_like", - "description": "Matches `language` against a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)\n\nIf an index exists on `language`, it can be used for the literal prefix (the part until the first placeholder).", - "deprecationReason": null - }, - { - "name": "language_not_like", - "description": "Checks if `language` does *not* match a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)", - "deprecationReason": null - }, - { - "name": "value", - "description": "Checks if `value` equals a specified string, case-sensitively.\n\nIf an index exists on `value`, it can be used.\n\nSee also `like` for a case-insensitive filter.", - "deprecationReason": null - }, - { - "name": "value_not", - "description": "Checks if `value` does not equal a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "value_in", - "description": "Checks if `value` is equal to one of the specified values.", - "deprecationReason": null - }, - { - "name": "value_not_in", - "description": "Checks if `value` is not equal to one of the specified values.", - "deprecationReason": null - }, - { - "name": "value_lt", - "description": "Checks if `value` is less than a specified value.", - "deprecationReason": null - }, - { - "name": "value_lte", - "description": "Checks if `value` is less or equal a specified value.", - "deprecationReason": null - }, - { - "name": "value_gt", - "description": "Checks if `value` is greater than a specified value.", - "deprecationReason": null - }, - { - "name": "value_gte", - "description": "Checks if `value` is greater or equal a specified value.", - "deprecationReason": null - }, - { - "name": "value_contains", - "description": "Checks if `value` contains a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "value_not_contains", - "description": "Checks if `value` does not contain a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "value_starts_with", - "description": "Checks if `value` starts with a specified string, case-sensitively.\n\nNever uses an index. Consider using `like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", - "deprecationReason": null - }, - { - "name": "value_not_starts_with", - "description": "Checks if `value` does not start with a specified string, case-sensitively.\n\nNever uses an index. Consider using `not_like` (with the `%` placeholder) for a case-insensitive filter that can use an index.", - "deprecationReason": null - }, - { - "name": "value_ends_with", - "description": "Checks if `value` ends with a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "value_not_ends_with", - "description": "Checks if `value` does not end with a specified string, case-sensitively.", - "deprecationReason": null - }, - { - "name": "value_like", - "description": "Matches `value` against a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)\n\nIf an index exists on `value`, it can be used for the literal prefix (the part until the first placeholder).", - "deprecationReason": null - }, - { - "name": "value_not_like", - "description": "Checks if `value` does *not* match a pattern case-insensitively with the following placeholders:\n\n- `%` matches any sequence of characters, including the empty string\n- `_` matches exactly one character\n- `\\` can be used to escape the placeholders (use `\\\\` for a literal backslash)", - "deprecationReason": null - }, - { - "name": "AND", - "description": "A field that checks if all filters in the list apply\n\nIf the list is empty, this filter applies to all objects.", - "deprecationReason": null - }, - { - "name": "OR", - "description": "A field that checks if any of the filters in the list apply.\n\nIf the list is empty, this filter applies to no objects.\n\nNote that only the items in the list *or*-combined; this complete `OR` field is *and*-combined with outer fields in the parent filter type.", - "deprecationReason": null - } - ] - }, { "name": "DeliveryItemOrderBy", "description": null, @@ -7627,6 +7637,11 @@ "description": null, "deprecationReason": null }, + { + "name": "descriptionI18nString", + "description": null, + "deprecationReason": null + }, { "name": "totalInvestment", "description": null, @@ -7676,6 +7691,11 @@ "description": null, "deprecationReason": null }, + { + "name": "descriptionI18nString", + "description": null, + "deprecationReason": null + }, { "name": "totalInvestment", "description": null, @@ -7708,6 +7728,11 @@ "description": null, "deprecationReason": null }, + { + "name": "descriptionI18nString", + "description": null, + "deprecationReason": null + }, { "name": "totalInvestment", "description": null, diff --git a/spec/regression/logistics/tests/filter-stringmap.graphql b/spec/regression/logistics/tests/filter-stringmap-in-child-entities.graphql similarity index 100% rename from spec/regression/logistics/tests/filter-stringmap.graphql rename to spec/regression/logistics/tests/filter-stringmap-in-child-entities.graphql diff --git a/spec/regression/logistics/tests/filter-stringmap.result.json b/spec/regression/logistics/tests/filter-stringmap-in-child-entities.result.json similarity index 100% rename from spec/regression/logistics/tests/filter-stringmap.result.json rename to spec/regression/logistics/tests/filter-stringmap-in-child-entities.result.json diff --git a/spec/regression/logistics/tests/filter-stringmap-in-root-entities.graphql b/spec/regression/logistics/tests/filter-stringmap-in-root-entities.graphql new file mode 100644 index 00000000..f63dcb65 --- /dev/null +++ b/spec/regression/logistics/tests/filter-stringmap-in-root-entities.graphql @@ -0,0 +1,17 @@ +query filterI18nString { + allCountries(filter: { descriptionI18nString_some: { value: "Germany" } }) { + isoCode + } +} + +query filterI18nStringWithCorrectLanguage { + allCountries(filter: { descriptionI18nString_some: { language: "en", value: "Germany" } }) { + isoCode + } +} + +query filterI18nStringWithIncorrectLanguage { + allCountries(filter: { descriptionI18nString_some: { language: "de", value: "Germany" } }) { + isoCode + } +} diff --git a/spec/regression/logistics/tests/filter-stringmap-in-root-entities.result.json b/spec/regression/logistics/tests/filter-stringmap-in-root-entities.result.json new file mode 100644 index 00000000..c391e780 --- /dev/null +++ b/spec/regression/logistics/tests/filter-stringmap-in-root-entities.result.json @@ -0,0 +1,25 @@ +{ + "filterI18nString": { + "data": { + "allCountries": [ + { + "isoCode": "DE" + } + ] + } + }, + "filterI18nStringWithCorrectLanguage": { + "data": { + "allCountries": [ + { + "isoCode": "DE" + } + ] + } + }, + "filterI18nStringWithIncorrectLanguage": { + "data": { + "allCountries": [] + } + } +} \ No newline at end of file