Directives in GraphQL are extensible annotations which alter the runtime
evaluation of a query or which add information to the schema
definition.
They always begin with an @
. There are four built-in directives which this
library automatically handles:
@include(if: Boolean!)
: Only resolve this field and include it in the results if theif
argument evaluates totrue
.@skip(if: Boolean!)
: Only resolve this field and include it in the results if theif
argument evaluates tofalse
.@deprecated(reason: String)
: Mark the field or enum value as deprecated through introspection with the specifiedreason
string.@specifiedBy(url: String!)
: Mark the custom scalar type through introspection as specified by a human readable page at the specified URL.
The schema
can also define custom directives
which are valid on different
elements of the query
. The library does not handle them automatically, but it
will pass them to the getField
implementations through the optional
graphql::service::FieldParams
struct (see fieldparams.md
for more information).