From 75e8e7cd3b14ffc70c5d8d1a8559aae21dbc3b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 26 Sep 2024 14:45:03 +0200 Subject: [PATCH] Add failing test for #916 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also reports this, which doesn't make sense: ``` Error: interface, union and object types must have a subselection set ╭─[0119_nested_subselection_issue_916.graphql:8:17] │ 8 │ query Invalid { me { name { reviews { body } } } } │ ────────────────┬─────────────── │ ╰───────────────── `Query.me` is an object type `User` and must select fields ───╯ ``` --- .../0119_nested_subselection_issue_916.graphql | 8 ++++++++ .../0119_nested_subselection_issue_916.txt | 10 ++++++++++ .../0119_nested_subselection_issue_916.graphql | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.graphql create mode 100644 crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.txt create mode 100644 crates/apollo-compiler/test_data/serializer/diagnostics/0119_nested_subselection_issue_916.graphql diff --git a/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.graphql b/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.graphql new file mode 100644 index 000000000..115bb48f4 --- /dev/null +++ b/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.graphql @@ -0,0 +1,8 @@ +type Query { + me: User +} +type User { + name: String +} + +query Invalid { me { name { reviews { body } } } } diff --git a/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.txt b/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.txt new file mode 100644 index 000000000..efac43664 --- /dev/null +++ b/crates/apollo-compiler/test_data/diagnostics/0119_nested_subselection_issue_916.txt @@ -0,0 +1,10 @@ +Error: field selection of scalar type `String` must not have subselections + ╭─[0119_nested_subselection_issue_916.graphql:8:22] + │ + 8 │ query Invalid { me { name { reviews { body } } } } + │ ────────────┬──────────── + │ ╰────────────── remove subselections here + │ + │ Note: path to the field: `query Invalid → me → name` +───╯ + diff --git a/crates/apollo-compiler/test_data/serializer/diagnostics/0119_nested_subselection_issue_916.graphql b/crates/apollo-compiler/test_data/serializer/diagnostics/0119_nested_subselection_issue_916.graphql new file mode 100644 index 000000000..bf8b1d441 --- /dev/null +++ b/crates/apollo-compiler/test_data/serializer/diagnostics/0119_nested_subselection_issue_916.graphql @@ -0,0 +1,17 @@ +type Query { + me: User +} + +type User { + name: String +} + +query Invalid { + me { + name { + reviews { + body + } + } + } +}