Skip to content

Commit 37cbfc9

Browse files
committed
Document Directives - grammar plus description
1 parent 893e77d commit 37cbfc9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ lines and uniform indentation with {BlockStringValue()}.
9494
Document : Definition+
9595

9696
Definition :
97+
- DocumentDirective
9798
- ExecutableDefinition
9899
- TypeSystemDefinition
99100
- TypeSystemExtension
100101

102+
DocumentDirective :
103+
- Directive[Const]
104+
101105
ExecutableDefinition :
102106
- OperationDefinition
103107
- FragmentDefinition

spec/Section 2 -- Language.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ characters to support interoperation with as many other systems as possible.
172172
Document : Definition+
173173

174174
Definition :
175+
- DocumentDirective
175176
- ExecutableDefinition
176177
- TypeSystemDefinition
177178
- TypeSystemExtension
@@ -202,7 +203,6 @@ GraphQL services which only seek to provide GraphQL query execution may choose
202203
to only include {ExecutableDefinition} and omit the {TypeSystemDefinition} and
203204
{TypeSystemExtension} rules from {Definition}.
204205

205-
206206
## Operations
207207

208208
OperationDefinition :
@@ -1094,3 +1094,23 @@ and operations.
10941094

10951095
As future versions of GraphQL adopt new configurable execution capabilities,
10961096
they may be exposed via directives.
1097+
1098+
## Document Directives
1099+
1100+
DocumentDirective :
1101+
- Directive[Const]
1102+
1103+
{DocumentDirective} is special kind of {Definition} and should be handled
1104+
on AST level by implementation in similar way like {TypeSystemDefinition}
1105+
or {ExecutableDefinition}.
1106+
1107+
Documents of any kind may contain zero or more {DocumentDirective}s.
1108+
Same directive may be repeated multiple times at document level:
1109+
1110+
```graphql example
1111+
@import(from: "./common")
1112+
@import(from: "./user")
1113+
```
1114+
1115+
Unknown directives may be ignored, but it is recommended for services to fail
1116+
if directive is not recognized.

0 commit comments

Comments
 (0)