Skip to content

Commit 3a86550

Browse files
committed
Document Directives - grammar plus description
1 parent 893e77d commit 3a86550

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
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: 22 additions & 0 deletions
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
@@ -1094,3 +1095,24 @@ and operations.
10941095

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

0 commit comments

Comments
 (0)