- Docs
- API reference
- Endpoints and schemas
- GraphQL
- Directives
@include
Directs the executor to include this field or fragment only when the `if` argument is true.
Directives. This directive runs after the query has its answer. It changes what you see, not what the query reads.
Directs the executor to include this field or fragment only when the if argument is true.
Arguments
Section titled “Arguments”| Argument | Type | Description |
|---|---|---|
if |
Boolean! |
Included when true. |
Where it goes
Section titled “Where it goes”FIELD, FRAGMENT_SPREAD, INLINE_FRAGMENT.
Example
Section titled “Example”query { search(searchInput: { entityType: BRAND name: "Safeway" conditions: { limit: 1 } }) { ... on Brand { id names(first: 1) @include(if: true) { edges { node { name } } } } }}Response, as returned:
{ "data": { "search": [ { "id": "0f26fbef-3436-4f85-8bcd-31fe12a4f99a", "names": { "edges": [ { "node": { "name": "SAFEWAY" } } ] } } ] }}