@@ -178,8 +178,8 @@ contain an operation. However documents which do not contain operations may
178
178
still be parsed and validated to allow client to represent a single request
179
179
across many documents.
180
180
181
- If a query document contains only one query operation, that operation may be
182
- represented in the shorthand form, which omits the query keyword and
181
+ If a document contains only one operation, that operation may be unnamed or
182
+ represented in the shorthand form, which omits both the query keyword and
183
183
operation name. Otherwise, if a GraphQL query document contains multiple
184
184
operations, each operation must be named. When submitting a query document with
185
185
multiple operations to a GraphQL service, the name of the desired operation to
@@ -189,7 +189,7 @@ be executed must also be provided.
189
189
### Operations
190
190
191
191
OperationDefinition :
192
- - OperationType Name VariableDefinitions? Directives? SelectionSet
192
+ - OperationType Name? VariableDefinitions? Directives? SelectionSet
193
193
- SelectionSet
194
194
195
195
OperationType : one of ` query ` ` mutation `
@@ -199,7 +199,20 @@ There are two types of operations that GraphQL models:
199
199
* query - a read-only fetch.
200
200
* mutation - a write followed by a fetch.
201
201
202
- Each operation is represented by an operation name and a selection set.
202
+ Each operation is represented by an optional operation name and a selection set.
203
+
204
+ For example, this mutation operation might "like" a story and then retrieve the
205
+ new number of likes:
206
+
207
+ ```
208
+ mutation {
209
+ likeStory(storyID: 12345) {
210
+ story {
211
+ likeCount
212
+ }
213
+ }
214
+ }
215
+ ```
203
216
204
217
** Query shorthand**
205
218
0 commit comments