Skip to content

Commit 2fc1c3c

Browse files
committed
cleanup require invalid fields
1 parent 68681f6 commit 2fc1c3c

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

spec/Section 4 -- Composition.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5856,26 +5856,15 @@ ERROR
58565856
- Let {fieldArg} be the string value of the `field` argument of the
58575857
`@require` directive on {argument}.
58585858
- Let {parsedFieldArg} be the parsed selection map from {fieldArg}.
5859-
- {ValidateSelectionMap(parsedFieldArg, declaringType, otherSchemas)} must
5860-
be true.
5861-
5862-
ValidateSelectionMap(selectionMap, declaringType, schemas):
5863-
5864-
- For each {selection} in {selectionMap}:
5865-
- Let {possibleTypes} be the set of all possible types for {declaringType} in
5866-
{schemas}.
5867-
- Let {field} be the first field selected by {selection} on any
5868-
{possibleTypes}.
5869-
- If no {field} is found
5870-
- return false
5871-
- Let {fieldType} be the type of {field}.
5872-
- If {fieldType} is not a scalar type
5873-
- Let {subSelectionSet} be the selection set of {selection}
5874-
- If {subSelectionSet} is empty
5875-
- return false
5876-
- If {ValidateSelectionMap(subSelectionSet, fieldType, schemas)} is false
5877-
- return false
5878-
- return true
5859+
- The parsed selection map {parsedFieldArg} must satisfy the validation
5860+
rules defined in Appendix A, Section 6.3, using:
5861+
- {declaringType} as the initial root type.
5862+
- The combined schema context formed by the union of {otherSchemas} as the
5863+
schema context except all fields marked as `@internal`
5864+
- Validation succeeds if each required field selection path can be
5865+
resolved across this combined schema context. Individual fields in the
5866+
selection may exist in different schemas; it is not required that all
5867+
fields referenced by {parsedFieldArg} reside within a single schema.
58795868

58805869
**Explanatory Text**
58815870

@@ -5934,8 +5923,9 @@ type Book {
59345923
}
59355924
```
59365925

5937-
In the following counter-example, the `@require` directive references a field from itself
5938-
(`Book.size`) which is not allowed. This results in a `REQUIRE_INVALID_FIELDS` error.
5926+
In the following counter-example, the `@require` directive references a field
5927+
from itself (`Book.size`) which is not allowed. This results in a
5928+
`REQUIRE_INVALID_FIELDS` error.
59395929

59405930
```graphql counter-example
59415931
type Book {

0 commit comments

Comments
 (0)