Skip to content

Commit e546c74

Browse files
committed
- Moves OperationTypeDefinition grammar rule within the subsection that defines it.
- Rephrase root fields as "collected from the root selection set" to be clear that the special bit is the result of CollectFields and remove ambiguity around the subscriptions single field constraint. - Fixed an inconsistency where ResolveFieldEventStream used `rootValue` instead of `initialValue` like the rest of the document. - Some minor copy tweaks and issues caught
1 parent 4f792d2 commit e546c74

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

spec/Section 3 -- Type System.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ enum Language {
118118
SchemaDefinition : Description? schema Directives[Const]? {
119119
OperationTypeDefinition\* }
120120

121-
OperationTypeDefinition : OperationKind : NamedType
122-
123121
:: A GraphQL service's collective type system capabilities are referred to as
124122
that service's _schema_. A schema is defined in terms of the types and
125123
directives it supports as well as the _operation type_ for each kind of
@@ -140,6 +138,8 @@ introspection system.
140138

141139
### Operation Types
142140

141+
OperationTypeDefinition : OperationKind : NamedType
142+
143143
:: A schema defines an _operation type_ for each kind of operation it supports:
144144
query, mutation, and subscription. This describes the type of the _root
145145
selection set_ for that kind of operation and by doing so determines the place
@@ -154,8 +154,8 @@ Similarly, the subscription _operation type_ is also optional; if it is not
154154
provided, the service does not support subscriptions. If it is provided, it must
155155
be an Object type.
156156

157-
The query, mutation, and subscription _operation type_ must each be different
158-
types, if provided.
157+
Each provided query, mutation, and subscription _operation type_ must be
158+
different types.
159159

160160
The fields on the query _operation type_ indicate what fields are available at
161161
the top level of a GraphQL query operation.
@@ -220,8 +220,8 @@ its respective _default operation type name_ and no other type uses any _default
220220
operation type name_.
221221

222222
This example describes a valid complete GraphQL schema, despite not explicitly
223-
including a {`schema`} definition. The {"Query"} type is presumed to be the
224-
query _operation type_ of the schema.
223+
including a schema definition. The {"Query"} type is presumed to be the query
224+
_operation type_ of the schema.
225225

226226
```graphql example
227227
type Query {

spec/Section 4 -- Introspection.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ underscores {"\_\_"}.
6969
## Type Name Introspection
7070

7171
GraphQL supports type name introspection within any selection set in an
72-
operation, with the single exception of a subscription _root selection set_.
73-
Type name introspection is accomplished via the meta-field `__typename: String!`
74-
on any Object, Interface, or Union. It returns the name of the concrete Object
75-
type at that point during execution.
72+
operation, with the exception of those collected from a subscription _root
73+
selection set_. Type name introspection is accomplished via the meta-field
74+
`__typename: String!` on any Object, Interface, or Union. It returns the name of
75+
the concrete Object type at that point during execution.
7676

7777
This is most often used when querying against Interface or Union types to
7878
identify which actual Object type of the possible types has been returned.
7979

8080
As a meta-field, `__typename` is implicit and does not appear in the fields list
8181
in any defined type.
8282

83-
Note: `__typename` may not be included as a field in a subscription _root
84-
selection set_.
83+
Note: `__typename` may not be included as a collected field from a subscription
84+
_root selection set_.
8585

8686
## Schema Introspection
8787

@@ -94,7 +94,7 @@ __type(name: String!): __Type
9494
```
9595

9696
Like all meta-fields, these are implicit and do not appear in the fields list in
97-
the _root type_ of the query operation.
97+
the query _operation type_.
9898

9999
**First Class Documentation**
100100

spec/Section 5 -- Validation.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ query getName {
251251

252252
### Subscription Operation Definitions
253253

254-
#### Single field in the root selection set
254+
#### Single collected root field
255255

256256
**Formal Specification**
257257

@@ -266,7 +266,8 @@ query getName {
266266

267267
**Explanatory Text**
268268

269-
Subscription operations must have exactly one field in the _root selection set_.
269+
Subscription operations must have exactly one field collected from its _root
270+
selection set_.
270271

271272
Valid examples:
272273

@@ -318,20 +319,20 @@ fragment multipleSubscriptions on Subscription {
318319
}
319320
```
320321

321-
The single field from the _root selection set_ of a subscription must not be an
322-
introspection field. The following example is invalid:
322+
The single field collected from the _root selection set_ of a subscription must
323+
not be an introspection field. The following example is invalid:
323324

324325
```graphql counter-example
325326
subscription sub {
326327
__typename
327328
}
328329
```
329330

330-
Note: While each subscription must have exactly one field in the _root selection
331-
set_, a document may contain any number of subscription operations, each of
332-
which may contain different fields. When executed, a document containing
333-
multiple subscription operations must provide the operation name as described in
334-
{GetOperation()}.
331+
Note: While each subscription must have exactly one field collected from the
332+
_root selection set_, a document may contain any number of subscription
333+
operations, each of which may contain different fields. When executed, a
334+
document containing multiple subscription operations must provide the operation
335+
name as described in {GetOperation()}.
335336

336337
## Fields
337338

spec/Section 6 -- Execution.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,13 @@ CreateSourceEventStream(subscription, schema, variableValues, initialValue):
269269
argumentValues)}.
270270
- Return {fieldStream}.
271271

272-
ResolveFieldEventStream(subscriptionType, rootValue, fieldName, argumentValues):
272+
ResolveFieldEventStream(subscriptionType, initialValue, fieldName,
273+
argumentValues):
273274

274275
- Let {resolver} be the internal function provided by {subscriptionType} for
275276
determining the resolved event stream of a subscription field named
276277
{fieldName}.
277-
- Return the result of calling {resolver}, providing {rootValue} and
278+
- Return the result of calling {resolver}, providing {initialValue} and
278279
{argumentValues}.
279280

280281
Note: This {ResolveFieldEventStream()} algorithm is intentionally similar to

0 commit comments

Comments
 (0)