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
config:
expose_query_plan: false
supergraph:
polling_interval: "1m"
source:
headers:
x-hive-cdn-key: "CDN_TOKEN"
method: "GET"
type: "remote"
url: |
https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph
id: "my-source"
type: "federation"
JSON
{
"config": {
"expose_query_plan": false,
"supergraph": {
"polling_interval": "1m",
"source": {
"headers": {
"x-hive-cdn-key": "CDN_TOKEN"
},
"method": "GET",
"type": "remote",
"url": "https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph"
}
}
},
"id": "my-source",
"type": "federation"
}
Reference
supergraph
The endpoint URL for the GraphQL source.
source
The source of the schema awareness. Can be either a local file, an inline string (hardcoded or from environment variables), or a remote endpoint.
file
Loads schema awareness from a local file.
type
file
To use this variation, please specify the type: file
in your configuration.
path
inline
Loads schema awareness from an inline string. You can also use environment variable intropolation in this field.
type
inline
To use this variation, please specify the type: inline
in your configuration.
content
remote
Loads schema awareness from a remote endpoint.
type
remote
To use this variation, please specify the type: remote
in your configuration.
url
Endpoint to load the schema awareness from.
headers
{}
Optional headers to include in the request (for example: authentication).
By default, when format: introspection
is used, the gateway will add Content-Type: application/json
and Accept: application/json
to the request headers.
method
"GET"
HTTP method to use when fetching the schema awareness from the remote endpoint.
By default, this field is set to GET
. If you are using format: introspection
, you should change this property to be POST
.
polling_interval
"1m"
Polling interval for reloading the schema awareness.
This field is ignored on WASM runtime.
expose_query_plan
false
Exposes the query plan as JSON under “extensions”