Directives

A directive describes additional options to the GraphQL executor. It allows GraphQL to change the result of the query or mutation based on the additional information provided by the directive.

In this section

  • accessRestricted — Marks an element of a GraphQL schema as having restricted access.

  • deprecated — Marks an element of a GraphQL schema as no longer supported.

  • inContext — Contextualizes data based on the additional information provided by the directive. For example, you can use the @inContext(country: CA) directive to query the price of a product in a storefront within the context of Canada.

  • include — Directs the executor to include this field or fragment only when the if argument is true.

  • skip — Directs the executor to skip this field or fragment when the if argument is true.

On this page