Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Documentation
Configuration
Sources
Federation Source

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:
    remote:
      fetch_every: "10s"
      headers:
        X-Hive-CDN-Key: "CDN_TOKEN"
      url: |
        https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph
id: "my-source"
type: "federation"

JSON

{
  "config": {
    "expose_query_plan": false,
    "supergraph": {
      "remote": {
        "fetch_every": "10s",
        "headers": {
          "X-Hive-CDN-Key": "CDN_TOKEN"
        },
        "url": "https://cdn.graphql-hive.com/artifacts/v1/TARGET_ID/supergraph"
      }
    }
  },
  "id": "my-source",
  "type": "federation"
}

Reference

supergraph
required

The endpoint URL for the GraphQL source.

The following options are valid for this field:
file

The file path for the Supergraph schema.

This provider is not supported on WASM runtime.

file
string
required
env

The environment variable that contains the Supergraph schema.

env
string
required
remote

The remote endpoint where the Supergraph schema can be fetched.

remote
object
required
url
string
required

The URL endpoint from where to fetch the Supergraph schema.

headers
object
optional

Optional headers to include in the request (ex: for authentication)

fetch_every
optional
default: "1m"

Polling interval for fetching the Supergraph schema from the remote.

secs
integer
required
nanos
integer
required
expose_query_plan
boolean
default: false

Exposes the query plan as JSON under “extensions”