@include
The@include
directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument.
In this exampleexperimentalField
will be queried only if the$someTest
is provided atrue
value.
query myQuery($someTest: Boolean) {
experimentalField @include(if: $someTest)
}
Neither
@skip
nor
@include
has precedence over the other. In the case that both the
@skip
and
@include
directives are provided in on the same the field or fragment, it
must
be queried only if the
@skip
condition is false
and
the
@include
condition is true. Stated conversely, the field or fragment must
not
be queried if either the
@skip
condition is true
or
the
@include
condition is false.