Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Docs
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

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
boolean
default: false

Exposes the query plan as JSON under "extensions"

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
fetch_every
optional
default: "1m"

Polling interval for fetching the Supergraph schema from the remote.

nanos
integer
required
secs
integer
required
headers
object
optional

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

url
string
required

The URL endpoint from where to fetch the Supergraph schema.