@@ -238,80 +238,16 @@ defined by this specification.
238
238
Description : StringValue
239
239
240
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
244
- [ CommonMark] ( https://commonmark.org/ ) ). Description strings (often
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.
250
-
251
- Descriptions may appear before:
252
-
253
- ** In type system definitions:**
254
-
255
- - Schema definitions.
256
- - Type definitions (scalars, objects, interfaces, unions, enums, input objects).
257
- - Field definitions.
258
- - Argument definitions.
259
- - Enum value definitions.
260
- - Input field definitions.
261
- - Directive definitions.
262
-
263
- ** In executable documents:**
264
-
265
- - Operation definitions (queries, mutations, subscriptions) in their full form
266
- (not the shorthand form).
267
- - Fragment definitions.
268
- - Variable definitions within operation definitions.
269
-
270
- As an example, this simple GraphQL schema is well described:
271
-
272
- ``` raw graphql example
273
- """
274
- A simple GraphQL schema which is well described.
275
- """
276
- schema {
277
- query: Query
278
- }
279
-
280
- """
281
- Root type for all your query operations
282
- """
283
- type Query {
284
- """
285
- Translates a string from a given language into a different language.
286
- """
287
- translate(
288
- "The original language that `text` is provided in."
289
- fromLanguage: Language
290
-
291
- "The translated language to be returned."
292
- toLanguage: Language
293
-
294
- "The text to be translated."
295
- text: String
296
- ): String
297
- }
241
+ descriptions on all named definitions in executable {Document} and GraphQL type
242
+ systems, which is also made available via introspection ensuring the
243
+ documentation of a GraphQL service remains consistent with its capabilities (see
244
+ [ Type System Descriptions] ( #sec-Type-System-Descriptions ) ).
298
245
299
- """
300
- The set of languages supported by `translate`.
301
- """
302
- enum Language {
303
- "English"
304
- EN
305
-
306
- "French"
307
- FR
308
-
309
- "Chinese"
310
- CH
311
- }
312
- ```
246
+ GraphQL descriptions are expected to provided as Markdown (as specified by
247
+ [ CommonMark] ( https://commonmark.org/ ) ). Description strings (often
248
+ {BlockString}) occur immediately before the definition they describe.
313
249
314
- This is an example of a well-described executable document :
250
+ This is an example of a well-described operation :
315
251
316
252
``` graphql example
317
253
"""
@@ -343,26 +279,11 @@ fragment TimeMachineDetails on TimeMachine {
343
279
}
344
280
```
345
281
346
- Descriptions are not permitted on the shorthand form of operations:
347
-
348
- ``` graphql counter-example
349
- "This description is invalid, because this is a shorthand operation definition"
350
- {
351
- timeMachine (id : " TM-1985" ) {
352
- status
353
- destination {
354
- year
355
- location
356
- }
357
- }
358
- }
359
- ```
360
-
361
- Note: Descriptions and comments in executable GraphQL documents are purely for
282
+ Descriptions and comments in executable GraphQL documents are purely for
362
283
documentation purposes. They MUST NOT affect the execution, validation, or
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.
284
+ response of a GraphQL document except for type introspection. It is otherwise
285
+ safe to remove all descriptions and comments from executable documents without
286
+ changing their behavior or results.
366
287
367
288
## Document
368
289
@@ -457,6 +378,8 @@ For example, this unnamed query operation is written via query shorthand.
457
378
}
458
379
```
459
380
381
+ Descriptions are not permitted on query shorthand.
382
+
460
383
Note: many examples below will use the query short-hand syntax.
461
384
462
385
## Selection Sets
0 commit comments