From 21d0aab9da76ac05e2a84503db82b0a38cf96754 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Sun, 5 Jun 2022 11:18:03 +0100 Subject: [PATCH 1/8] Clarify selectionType --- spec/Section 5 -- Validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 1938922bf..d25fa22e7 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -575,7 +575,7 @@ fragment conflictingDifferingResponses on Pet { **Formal Specification** - For each {selection} in the document: - - Let {selectionType} be the result type of {selection}. + - Let {selectionType} be the unwrapped result type of {selection}. - If {selectionType} is a scalar or enum: - The subselection set of that selection must be empty. - If {selectionType} is an interface, union, or object: From be4bc3ae9be2f6d66cc5e674f2c7028eedb36952 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Sun, 5 Jun 2022 11:28:25 +0100 Subject: [PATCH 2/8] Clarify explanatory text --- spec/Section 5 -- Validation.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index d25fa22e7..7d5cef31f 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -583,8 +583,8 @@ fragment conflictingDifferingResponses on Pet { **Explanatory Text** -Field selections on scalars or enums are never allowed, because they are the -leaf nodes of any GraphQL operation. +Scalars and enums are the underlying type of leaf nodes of any GraphQL +operation. Field selections are never allowed on leaf nodes. The following is valid. @@ -604,9 +604,9 @@ fragment scalarSelectionsNotAllowedOnInt on Dog { } ``` -Conversely the leaf field selections of GraphQL operations must be of type -scalar or enum. Leaf selections on objects, interfaces, and unions without -subfields are disallowed. +Conversely the underlying type of leaf field selections of GraphQL operations +must be scalar or enum. Leaf selections on fields whose underlying type is +object, interface, or union are disallowed. Let's assume the following additions to the query root operation type of the schema: From 370697f9a9317947bfbb8ea02b5c795b78de05e8 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Sun, 5 Jun 2022 12:47:00 +0100 Subject: [PATCH 3/8] Add "without subfields" --- spec/Section 5 -- Validation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 7d5cef31f..b220cccec 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -605,8 +605,8 @@ fragment scalarSelectionsNotAllowedOnInt on Dog { ``` Conversely the underlying type of leaf field selections of GraphQL operations -must be scalar or enum. Leaf selections on fields whose underlying type is -object, interface, or union are disallowed. +must be scalar or enum. Leaf selections without subfields on fields whose +underlying type is object, interface, or union are disallowed. Let's assume the following additions to the query root operation type of the schema: From eb3f4369ec15a770c00160ffca0af1058766a221 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 16 Jun 2022 10:36:27 -0700 Subject: [PATCH 4/8] Updates to description + example --- spec/Section 5 -- Validation.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index b220cccec..d47512f9c 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -583,8 +583,8 @@ fragment conflictingDifferingResponses on Pet { **Explanatory Text** -Scalars and enums are the underlying type of leaf nodes of any GraphQL -operation. Field selections are never allowed on leaf nodes. +Field subselections are never allowed on leaf fields. A leaf field is any +field with a scalar or enum result type. The following is valid. @@ -604,9 +604,9 @@ fragment scalarSelectionsNotAllowedOnInt on Dog { } ``` -Conversely the underlying type of leaf field selections of GraphQL operations -must be scalar or enum. Leaf selections without subfields on fields whose -underlying type is object, interface, or union are disallowed. +Conversely, any field without subselections must be a leaf field. That is, +fields with an object, interface, or union result type must have a field +subselection. Let's assume the following additions to the query root operation type of the schema: @@ -619,7 +619,8 @@ extend type Query { } ``` -The following examples are invalid +The following examples are invalid because they include non-leaf fields without +field subselections. ```graphql counter-example query directQueryOnObjectWithoutSubFields { @@ -635,6 +636,17 @@ query directQueryOnUnionWithoutSubFields { } ``` +However the following example is valid since it includes a field subselection. + + +```graphql example +query directQueryOnObjectWithSubFields { + human { + name + } +} +``` + ## Arguments Arguments are provided to both fields and directives. The following validation From a9f09167b89ea2276c1f1ea7b520f27dd501fac0 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 16 Jun 2022 10:38:47 -0700 Subject: [PATCH 5/8] Format --- spec/Section 5 -- Validation.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index d47512f9c..2b2a62c75 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -583,8 +583,8 @@ fragment conflictingDifferingResponses on Pet { **Explanatory Text** -Field subselections are never allowed on leaf fields. A leaf field is any -field with a scalar or enum result type. +Field subselections are never allowed on leaf fields. A leaf field is any field +with a scalar or enum result type. The following is valid. @@ -638,7 +638,6 @@ query directQueryOnUnionWithoutSubFields { However the following example is valid since it includes a field subselection. - ```graphql example query directQueryOnObjectWithSubFields { human { From 8f8043476db9b99f7ab97ef0717b45baf80eec3b Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 16 Jun 2022 10:43:02 -0700 Subject: [PATCH 6/8] Update Section 5 -- Validation.md --- spec/Section 5 -- Validation.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 2b2a62c75..15ea2340f 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -604,9 +604,8 @@ fragment scalarSelectionsNotAllowedOnInt on Dog { } ``` -Conversely, any field without subselections must be a leaf field. That is, -fields with an object, interface, or union result type must have a field -subselection. +Conversely, non-leaf fields must have a field subselection. A non-leaf field is +any field with an object, interface, or union result type. Let's assume the following additions to the query root operation type of the schema: From cc26d6fdc4262d259e5012dc91dd5f8a63f5fb3a Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 16 Jun 2022 10:45:13 -0700 Subject: [PATCH 7/8] Format --- spec/Section 5 -- Validation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 15ea2340f..2043a57c2 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -583,7 +583,7 @@ fragment conflictingDifferingResponses on Pet { **Explanatory Text** -Field subselections are never allowed on leaf fields. A leaf field is any field +A field subselection is not allowed on leaf fields. A leaf field is any field with a scalar or enum result type. The following is valid. @@ -619,7 +619,7 @@ extend type Query { ``` The following examples are invalid because they include non-leaf fields without -field subselections. +a field subselection. ```graphql counter-example query directQueryOnObjectWithoutSubFields { From f2699c5d3d00d4d2894c2b106c625119e16c2583 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Fri, 17 Jun 2022 14:13:58 -0700 Subject: [PATCH 8/8] r/result/unwrapped --- spec/Section 5 -- Validation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 2043a57c2..5f737b9a9 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -584,7 +584,7 @@ fragment conflictingDifferingResponses on Pet { **Explanatory Text** A field subselection is not allowed on leaf fields. A leaf field is any field -with a scalar or enum result type. +with a scalar or enum unwrapped type. The following is valid. @@ -605,7 +605,7 @@ fragment scalarSelectionsNotAllowedOnInt on Dog { ``` Conversely, non-leaf fields must have a field subselection. A non-leaf field is -any field with an object, interface, or union result type. +any field with an object, interface, or union unwrapped type. Let's assume the following additions to the query root operation type of the schema: