Documentation Index
Fetch the complete documentation index at: https://cosmo-docs.wundergraph.com/llms.txt
Use this file to discover all available pages before exploring further.
Definition
Arguments
| Argument | Type | Description |
|---|---|---|
import | [link__Import] | The name of the directive to import with leading @ or a valid object (see import validation). |
url | String! | The feature URL for the import (see URL validation. |
Overview
The@link directive allows the importing of other directives.
This is necessary to propagate a (custom) directive into the router schema through the
@composeDirective directive.
Usage
When using WunderGraph Cosmo, explicitly importing federation directives is not necessary. These directives are inferred and injected into the schema automatically. If importing a custom directive, the directive definition must still be provided in the schema if the directive is used within the subgraph schema. For example:For brevity, “composing a directive” will henceforth serve as a substitute for providing the name of an imported an
defined directive to the
name argument of a @composeDirective.Validation
Import validation
Directives are imported through a list. List values can provided in one of two ways:- A string of the directive name (with leading
@) - An object of the following form:
@.
An example valid import might be:
URL validation
A URL must contain a path component, a feature component, and end with a version component. The version component must strictly match the formatvMajor.Minor where Major and Minor represent integers, e.g., v1.2.
An example valid URL might be:
Errors
@link will produce composition error(s) if:
- A feature URL is invalid.
- The same base feature URL is used across subgraphs but the major versions do not match.
- An import value is not a valid string (
@{string}) or object ({ name: String! as: String }) form. - A directive name (or its renamed value) do not both start with leading
@.