Skip to content

Commit

Permalink
RFC: __typename is not valid at subscription root (#776)
Browse files Browse the repository at this point in the history
* __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>
  • Loading branch information
benjie and leebyron authored Apr 15, 2021
1 parent 3958da9 commit 413b689
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions spec/Section 4 -- Introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ identify which actual Object type of the possible types has been returned.
As a meta-field, `__typename` is implicit and does not appear in the fields list
in any defined type.

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

## Schema Introspection

Expand Down
10 changes: 4 additions & 6 deletions spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ query getName {
* Let {variableValues} be the empty set.
* Let {groupedFieldSet} be the result of
{CollectFields(subscriptionType, selectionSet, variableValues)}.
* {groupedFieldSet} must have exactly one entry.
* {groupedFieldSet} must have exactly one entry, which must not be an
introspection field.

**Explanatory Text**

Expand Down Expand Up @@ -311,14 +312,11 @@ fragment multipleSubscriptions on Subscription {
}
```

Introspection fields are counted. The following example is also invalid:
The root field of a subscription operation must not be an introspection field.
The following example is also invalid:

```graphql counter-example
subscription sub {
newMessage {
body
sender
}
__typename
}
```
Expand Down

0 comments on commit 413b689

Please sign in to comment.