export const meta = { title: `Directives reference`, description: `A reference document of all Amplify-provided GraphQL directives that enhance your Amplify app's GraphQL API + database`, }; The Amplify CLI provides GraphQL directives to enhance your schema with additional capabilities such as custom indexes, authorization rules, function triggers, and more. |Directive|Description| |---------|-----------| |[`@model`](/cli/graphql/data-modeling)|Defines top level object types in your API that are backed by Amazon DynamoDB| |[`@primaryKey`](/cli/graphql/data-modeling/#configure-a-primary-key)| Configures custom primary key for @model types| |[`@index`](/cli/graphql/data-modeling/#configure-a-secondary-index)| Configures custom secondary index structures for @model types| |[`@auth`](/cli/graphql/authorization-rules/)| Defines authorization rules for your @model types and fields| |[`@hasOne`](/cli/graphql/data-modeling/#has-one-relationship)| Create a one-directional one-to-one relationship between two models. For example, a Project "has one" Team. This allows you to query the team from the project record| |[`@hasMany`](/cli/graphql/data-modeling/#has-many-relationship)| Create a one-directional one-to-many relationship between two models. For example, a Post has many comments. This allows you to query all the comments from the post record| |[`@belongsTo`](/cli/graphql/data-modeling/#belongs-to-relationship)| Use a "belongs to" relationship to make a "has one" or "has many" relationship bi-directional. For example, a Project has one Team and a Team belongs to a Project. This allows you to query the team from the project record and vice versa| |[`@manyToMany`](/cli/graphql/data-modeling/#many-to-many-relationship)| Configures a "join table" between two models to facilitate a many-to-many relationship. For example, a Blog has many Tags and a Tag has many Blogs| |[`@function`](/cli/graphql/custom-business-logic/#lambda-function-resolver)| Configures a Lambda function resolvers for a field| |[`@http`](/cli/graphql/custom-business-logic/#http-resolver)| Configures an HTTP resolver for a field| |[`@predictions`](/cli/graphql/connect-to-machine-learning-services/)| Queries an orchestration of AI/ML services such as Amazon Rekognition, Amazon Translate, and/or Amazon Polly| |[`@searchable`](/cli/graphql/search-and-result-aggregations/)| Makes your data searchable by streaming it to Amazon OpenSearch| |[`@mapsTo`](/cli/graphql/schema-evolution/)|Once a table contains production data that cannot be deleted, `@mapsTo` can be used to specify the original name||