Skip to content

Developers · GraphQL

Common GraphQL Directives

Last updated 2 November 2026

A directive allows a user to decorate part of a GraphQL schema or operation with additional configurations. They can be useful to get out of situations where a user otherwise would need to do string manipulation to add and remove fields in a query. Server implementations may also add experimental features by defining completely new directives. The GraphQL specification defines a small set of built-in directives. These two are used in queries:

  • Only include this field in the result if the argument is .
  • Skip this field if the argument is .

Use this document to guide you in using commonly-used GraphQL directives in Insites.

doc

Code example:

directive @doc(
  category: String!
)

Arguments

include

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

directive @include(
  if: Boolean!
)

Arguments

Included when true.

skip

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

directive @skip(
  if: Boolean!
)

Arguments

Skipped when true.

deprecated

Marks an element of a GraphQL schema as deprecated.

directive @deprecated(
  reason: String = "No longer supported"
)

Arguments

Explains why this element is deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by CommonMark.

specifiedBy

Exposes a URL that specifies the behaviour of this scalar.

directive @specifiedBy(
  url: String!
)

Arguments

The URL that specifies the behaviour of this scalar.

Note

This topic is a compilation of knowledge found at Apollo GraphQL and GraphQL.org.

Reference

You may visit the following resources for more information: