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
supergraphThe endpoint URL for the GraphQL source.
sourceThe 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.
typefileTo use this variation, please specify the type: file in your configuration.
pathinline
Loads schema awareness from an inline string. You can also use environment variable intropolation in this field.
typeinlineTo use this variation, please specify the type: inline in your configuration.
contentremote
Loads schema awareness from a remote endpoint.
typeremoteTo use this variation, please specify the type: remote in your configuration.
urlEndpoint 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_planfalseExposes the query plan as JSON under “extensions”