Directives

You are currently viewing the legacy GraphQL Transformer documentation. View latest documentation

The Amplify CLI provides GraphQL directives to enhance your schema with additional capabilities such as custom indexes, authorization rules, function triggers, and more.

Amplify-provided directives

Limitation with DataStore: Custom primary keys are not supported by the GraphQL Transformer v1. Upgrade to the GraphQL Transformer v2 to leverage custom primary keys in DataStore.

AWS AppSync-provided directives

The following directives are supported by the AppSync service and can be used within the Amplify GraphQL schemas. These will not be processed by Amplify CLI but passed through to the service as is and will be present in the output schema. For example, Amplify's @auth directive will add these directives under the hood to the output schema.

  • @aws_api_key
  • @aws_iam
  • @aws_oidc
  • @aws_cognito_user_pools
  • @aws_auth
  • @aws_subscribe

Learn more about these directives in the AWS AppSync Developer Guide.

3rd party directives

Looking to build your own transformers & directives? Check out the guide on how to author your own transformer & directives.