Federation Source
A source capable of loading a Supergraph schema based on the Apollo Federation specification.
The loaded supergraph will be used to orchestrate the execution of the queries across the federated sources.
The input for this source can be a local file, an environment variable, or a remote endpoint.
The content of the Supergraph input needs to be a valid GraphQL SDL schema, with the Apollo Federation execution directives, usually produced by a schema registry.
Configuration
Examples
This example is loading a Supergraph schema from a remote endpoint, using the Hive CDN.
YAML
type: "federation"
id: "my-source"
config:
supergraph:
remote:
url: |
https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph
headers:
X-Hive-CDN-Key: "CDN_TOKEN"
fetch_every: "10s"
expose_query_plan: false
JSON
{
"type": "federation",
"id": "my-source",
"config": {
"supergraph": {
"remote": {
"url": "https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph",
"headers": {
"X-Hive-CDN-Key": "CDN_TOKEN"
},
"fetch_every": "10s"
}
},
"expose_query_plan": false
}
}
Reference
expose_query_plan
false
Exposes the query plan as JSON under "extensions"
supergraph
The endpoint URL for the GraphQL source.
file
The file path for the Supergraph schema.
This provider is not supported on WASM runtime.
file
env
The environment variable that contains the Supergraph schema.
env
remote
The remote endpoint where the Supergraph schema can be fetched.
remote
fetch_every
"1m"
Polling interval for fetching the Supergraph schema from the remote.
nanos
secs
headers
Optional headers to include in the request (ex: for authentication)
url
The URL endpoint from where to fetch the Supergraph schema.