@@ -233,56 +233,20 @@ Any {Name} within a GraphQL type system must not start with two underscores
233
233
{"\_\_ "} unless it is part of the [ introspection system] ( #sec-Introspection ) as
234
234
defined by this specification.
235
235
236
- ## Document
237
-
238
- Document : Definition+
239
-
240
- Definition :
241
-
242
- - ExecutableDefinition
243
- - TypeSystemDefinitionOrExtension
244
-
245
- ExecutableDocument : ExecutableDefinition+
246
-
247
- ExecutableDefinition :
248
-
249
- - OperationDefinition
250
- - FragmentDefinition
251
-
252
- A GraphQL Document describes a complete file or request string operated on by a
253
- GraphQL service or client. A document contains multiple definitions, either
254
- executable or representative of a GraphQL type system.
255
-
256
- Documents are only executable by a GraphQL service if they are
257
- {ExecutableDocument} and contain at least one {OperationDefinition}. A Document
258
- which contains {TypeSystemDefinitionOrExtension} must not be executed; GraphQL
259
- execution services which receive a Document containing these should return a
260
- descriptive error.
261
-
262
- GraphQL services which only seek to execute GraphQL requests and not construct a
263
- new GraphQL schema may choose to only permit {ExecutableDocument}.
264
-
265
- Documents which do not contain {OperationDefinition} or do contain
266
- {TypeSystemDefinitionOrExtension} may still be parsed and validated to allow
267
- client tools to represent many GraphQL uses which may appear across many
268
- individual files.
269
-
270
- If a Document contains only one operation, that operation may be unnamed. If
271
- that operation is a query without variables or directives then it may also be
272
- represented in the shorthand form, omitting both the {` query ` } keyword as well
273
- as the operation name. Otherwise, if a GraphQL Document contains multiple
274
- operations, each operation must be named. When submitting a Document with
275
- multiple operations to a GraphQL service, the name of the desired operation to
276
- be executed must also be provided.
277
-
278
236
## Descriptions
279
237
280
238
Description : StringValue
281
239
282
- Documentation is a first-class feature of GraphQL. GraphQL descriptions are
283
- defined using the Markdown syntax (as specified by
240
+ Documentation is a first-class feature of GraphQL by encouraging written
241
+ descriptions on all named definitions in both a GraphQL schema
242
+ {TypeSystemDocument} and an executable {Document}. GraphQL descriptions are
243
+ expected to provided as Markdown (as specified by
284
244
[ CommonMark] ( https://commonmark.org/ ) ). Description strings (often
285
- {BlockString}) occur immediately before the definition they describe.
245
+ {BlockString}) occur immediately before the named definition they describe.
246
+
247
+ Descriptions in type system definitions are made available via introspection,
248
+ ensuring the documentation of a GraphQL service remains consistent with its
249
+ capabilities.
286
250
287
251
Descriptions may appear before:
288
252
@@ -396,12 +360,51 @@ Descriptions are not permitted on the shorthand form of operations:
396
360
397
361
Note: Descriptions and comments in executable GraphQL documents are purely for
398
362
documentation purposes. They MUST NOT affect the execution, validation, or
399
- response of a GraphQL document. It is safe to remove all descriptions and
400
- comments from executable documents without changing their behavior or results.
363
+ response of a GraphQL document except for type and schema introspection. It is
364
+ otherwise safe to remove all descriptions and comments from executable documents
365
+ without changing their behavior or results.
401
366
402
- Descriptions in type system definitions are made available via introspection,
403
- ensuring the documentation of a GraphQL service remains consistent with its
404
- capabilities.
367
+ ## Document
368
+
369
+ Document : Definition+
370
+
371
+ Definition :
372
+
373
+ - ExecutableDefinition
374
+ - TypeSystemDefinitionOrExtension
375
+
376
+ ExecutableDocument : ExecutableDefinition+
377
+
378
+ ExecutableDefinition :
379
+
380
+ - OperationDefinition
381
+ - FragmentDefinition
382
+
383
+ A GraphQL Document describes a complete file or request string operated on by a
384
+ GraphQL service or client. A document contains multiple definitions, either
385
+ executable or representative of a GraphQL type system.
386
+
387
+ Documents are only executable by a GraphQL service if they are
388
+ {ExecutableDocument} and contain at least one {OperationDefinition}. A Document
389
+ which contains {TypeSystemDefinitionOrExtension} must not be executed; GraphQL
390
+ execution services which receive a Document containing these should return a
391
+ descriptive error.
392
+
393
+ GraphQL services which only seek to execute GraphQL requests and not construct a
394
+ new GraphQL schema may choose to only permit {ExecutableDocument}.
395
+
396
+ Documents which do not contain {OperationDefinition} or do contain
397
+ {TypeSystemDefinitionOrExtension} may still be parsed and validated to allow
398
+ client tools to represent many GraphQL uses which may appear across many
399
+ individual files.
400
+
401
+ If a Document contains only one operation, that operation may be unnamed. If
402
+ that operation is a query without variables or directives then it may also be
403
+ represented in the shorthand form, omitting both the {` query ` } keyword as well
404
+ as the operation name. Otherwise, if a GraphQL Document contains multiple
405
+ operations, each operation must be named. When submitting a Document with
406
+ multiple operations to a GraphQL service, the name of the desired operation to
407
+ be executed must also be provided.
405
408
406
409
## Operations
407
410
0 commit comments