Skip to content

RFC: __typename is not valid at subscription root #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spec/Section 4 -- Introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ identify which actual type of the possible types has been returned.

This field 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 @@ -249,7 +249,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 @@ -305,14 +306,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