Getting Started with Tailcall Directives
Tailcall DSL builds on your existing GraphQL knowledge by allowing the addition of some custom directives. These directives provide powerful compile time guarantees to ensure your API composition is tight and robust. Behind the scenes, Tailcall automatically generates highly optimized resolver logic for your types using the information in the directives.
Here is a list of all the custom directives supported by Tailcall:
Operator | Description |
---|---|
@addField | Simplifies data structures and queries by adding, inlining, or flattening fields or nodes within the schema. |
@cache | Enables caching for the query, field or type applied to. |
@call | Invokes a query or mutation from another query or mutation field. |
@discriminate | Allows to customize the discriminator while working with union types. |
@expr | Allows embedding of a constant response within the schema. |
@graphQL | Resolves a field or node by a GraphQL API. |
@grpc | Resolves a field or node by a gRPC API. |
@http | Resolves a field or node by a REST API. |
@link | Imports external resources such as config files, certs, protobufs, etc in the schema. |
@modify | Enables changes to attributes of fields or nodes in the schema. |
@omit | Excludes fields or nodes from the generated schema, making them inaccessible through the GraphQL API. |
@protected | Adds authentication and authorization controls to fields or nodes in the schema. |
@rest | Allows exposing REST endpoints on top of GraphQL. |
@server | Provides server configurations for behavior tuning and tailcall optimization in specific use-cases. |
@telemetry | Integrates with open-telemetry to provide observability of the running tailcall service. |
@upstream | Controls aspects of the upstream server connection, including timeouts and keep-alive settings. |