Directives Are In Valid Locations
Formal Specification
- For every directive in a document.
- Let directiveName be the name of directive .
- Let directiveDefinition be the directive named directiveName .
- Let locations be the valid locations for directiveDefinition .
- Let adjacent be the AST node the directive affects.
- adjacent must be represented by an item within locations .
Explanatory Text
GraphQL servers define what directives they support and where they support them. For each usage of a directive, the directive must be used in a location that the server has declared support for.
For example the following query will not pass validation because@skip
does not provideQUERY
as a valid location.
query @skip(if: $foo) {
field
}