|
| 1 | +export const meta = { |
| 2 | + title: `Directives reference`, |
| 3 | + description: `A reference document of all Amplify-provided GraphQL directives that enhance your Amplify app's GraphQL API + database`, |
| 4 | +}; |
| 5 | + |
| 6 | +The Amplify CLI provides GraphQL directives to enhance your schema with additional capabilities such as custom indexes, authorization rules, function triggers, and more. |
| 7 | + |
| 8 | +|Directive|Description| |
| 9 | +|---------|-----------| |
| 10 | +|[`@model`](/cli/graphql/data-modeling)|Defines top level object types in your API that are backed by Amazon DynamoDB| |
| 11 | +|[`@primaryKey`](/cli/graphql/data-modeling/#configure-a-primary-key)| Configures custom primary key for @model types| |
| 12 | +|[`@index`](/cli/graphql/data-modeling/#configure-a-secondary-index)| Configures custom secondary index structures for @model types| |
| 13 | +|[`@auth`](/cli/graphql/authorization-rules/)| Defines authorization rules for your @model types and fields| |
| 14 | +|[`@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| |
| 15 | +|[`@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| |
| 16 | +|[`@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| |
| 17 | +|[`@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| |
| 18 | +|[`@function`](/cli/graphql/custom-business-logic/#lambda-function-resolver)| Configures a Lambda function resolvers for a field| |
| 19 | +|[`@http`](/cli/graphql/custom-business-logic/#http-resolver)| Configures an HTTP resolver for a field| |
| 20 | +|[`@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| |
| 21 | +|[`@searchable`](/cli/graphql/search-and-result-aggregations/)| Makes your data searchable by streaming it to Amazon OpenSearch| |
| 22 | +|[`@mapsTo`](/cli/graphql/schema-evolution/)|Once a table contains production data that cannot be deleted, `@mapsTo` can be used to specify the original name|| |
0 commit comments