Skip to content

Commit 07be572

Browse files
committed
Editorial: move descriptions definition above document
1 parent b54fe84 commit 07be572

File tree

3 files changed

+59
-56
lines changed

3 files changed

+59
-56
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ lines and uniform indentation with {BlockStringValue()}.
133133

134134
## Document Syntax
135135

136+
Description : StringValue
137+
136138
Document : Definition+
137139

138140
Definition :
@@ -147,8 +149,6 @@ ExecutableDefinition :
147149
- OperationDefinition
148150
- FragmentDefinition
149151

150-
Description : StringValue
151-
152152
OperationDefinition :
153153

154154
- Description? OperationType Name? VariablesDefinition? Directives? SelectionSet

spec/Section 1 -- Overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ GraphQL has a number of design principles:
6363
endpoints. A GraphQL response, on the other hand, contains exactly what a
6464
client asks for and no more.
6565

66-
- **Introspective**: GraphQL is introspective. A GraphQL service's type system
67-
can be queryable by the GraphQL language itself, as will be described in this
68-
specification. GraphQL introspection serves as a powerful platform for
69-
building common tools and client software libraries.
66+
- **Introspective**: GraphQL is introspective and self-describing. A GraphQL
67+
service's type system can be queryable by the GraphQL language itself, which
68+
includes readable documentation. GraphQL introspection serves as a powerful
69+
platform for building common developer tools and client software libraries.
7070

7171
Because of these principles, GraphQL is a powerful and productive environment
7272
for building client applications. Product developers and designers building

spec/Section 2 -- Language.md

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -233,56 +233,20 @@ Any {Name} within a GraphQL type system must not start with two underscores
233233
{"\_\_"} unless it is part of the [introspection system](#sec-Introspection) as
234234
defined by this specification.
235235

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-
278236
## Descriptions
279237

280238
Description : StringValue
281239

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
284244
[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.
286250

287251
Descriptions may appear before:
288252

@@ -396,12 +360,51 @@ Descriptions are not permitted on the shorthand form of operations:
396360

397361
Note: Descriptions and comments in executable GraphQL documents are purely for
398362
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.
401366

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.
405408

406409
## Operations
407410

0 commit comments

Comments
 (0)