Skip to content

Commit 1f4104e

Browse files
robrichardyaacovCR
authored andcommitted
add Defer And Stream Directives Are Used On Valid Root Field rule
1 parent 9e7733c commit 1f4104e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

spec/Section 5 -- Validation.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,34 @@ query ($foo: Boolean = true, $bar: Boolean = false) {
15281528
}
15291529
```
15301530

1531+
### Defer And Stream Directives Are Used On Valid Root Field
1532+
1533+
** Formal Specification **
1534+
1535+
- For every {directive} in a document.
1536+
- Let {directiveName} be the name of {directive}.
1537+
- Let {mutationType} be the root Mutation type in {schema}.
1538+
- Let {subscriptionType} be the root Subscription type in {schema}.
1539+
- If {directiveName} is "defer" or "stream":
1540+
- The parent type of {directive} must not be {mutationType} or
1541+
{subscriptionType}.
1542+
1543+
**Explanatory Text**
1544+
1545+
The defer and stream directives are not allowed to be used on root fields of the
1546+
mutation or subscription type.
1547+
1548+
For example, the following document will not pass validation because `@defer`
1549+
has been used on a root mutation field:
1550+
1551+
```raw graphql counter-example
1552+
mutation {
1553+
... @defer {
1554+
mutationField
1555+
}
1556+
}
1557+
```
1558+
15311559
### Stream Directives Are Used On List Fields
15321560

15331561
**Formal Specification**

0 commit comments

Comments
 (0)