Skip to content

Commit 0c07c03

Browse files
committed
Write directives.md content
1 parent 8d1917b commit 0c07c03

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/directives.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Directives
2+
3+
Directives in GraphQL are extensible annotations which alter the runtime
4+
evaluation of a query or which add information to the `schema` definition.
5+
They always begin with an `@`. There are three built-in directives which this
6+
library automatically handles:
7+
8+
1. `@include(if: Boolean!)`: Only resolve this field and include it in the
9+
results if the `if` argument evaluates to `true`.
10+
2. `@skip(if: Boolean!)`: Only resolve this field and include it in the
11+
results if the `if` argument evaluates to `false`.
12+
3. `@deprecated(reason: String)`: Mark the field or enum value as deprecated
13+
through introspection with the specified `reason` string.
14+
15+
The `schema` can also define custom `directives` which are valid on different
16+
elements of the `query`. The library does not handle them automatically, but it
17+
will pass them to the `getField` implementations through the
18+
`graphql::service::FieldParams` struct (see [fieldparams.md](fieldparams.md)
19+
for more information).

0 commit comments

Comments
 (0)