Skip to content

Commit 413b689

Browse files
benjieleebyron
andauthored
RFC: __typename is not valid at subscription root (#776)
* __typename is not valid at subscription root * Update spec edits based on Lee's comments * Simplify * Clarify * Typo * Update Section 5 -- Validation.md Co-authored-by: Lee Byron <lee@leebyron.com>
1 parent 3958da9 commit 413b689

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spec/Section 4 -- Introspection.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ identify which actual Object type of the possible types has been returned.
101101
As a meta-field, `__typename` is implicit and does not appear in the fields list
102102
in any defined type.
103103

104+
Note: `__typename` may not be included as a root field in a subscription
105+
operation.
104106

105107
## Schema Introspection
106108

spec/Section 5 -- Validation.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ query getName {
255255
* Let {variableValues} be the empty set.
256256
* Let {groupedFieldSet} be the result of
257257
{CollectFields(subscriptionType, selectionSet, variableValues)}.
258-
* {groupedFieldSet} must have exactly one entry.
258+
* {groupedFieldSet} must have exactly one entry, which must not be an
259+
introspection field.
259260

260261
**Explanatory Text**
261262

@@ -311,14 +312,11 @@ fragment multipleSubscriptions on Subscription {
311312
}
312313
```
313314

314-
Introspection fields are counted. The following example is also invalid:
315+
The root field of a subscription operation must not be an introspection field.
316+
The following example is also invalid:
315317

316318
```graphql counter-example
317319
subscription sub {
318-
newMessage {
319-
body
320-
sender
321-
}
322320
__typename
323321
}
324322
```

0 commit comments

Comments
 (0)