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:
    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
object
required

The endpoint URL for the GraphQL source.

source
required

The source of the schema awareness. Can be either a local file, an inline string (hardcoded or from environment variables), or a remote endpoint.

The following options are valid for this field:
file

Loads schema awareness from a local file.

type
literal: file
required

To use this variation, please specify the type: file in your configuration.

path
string
required
inline

Loads schema awareness from an inline string. You can also use environment variable intropolation in this field.

type
literal: inline
required

To use this variation, please specify the type: inline in your configuration.

content
string
required
remote

Loads schema awareness from a remote endpoint.

type
literal: remote
required

To use this variation, please specify the type: remote in your configuration.

url
string
required

Endpoint to load the schema awareness from.

headers
object
default: {}

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

Polling interval for reloading the schema awareness.

This field is ignored on WASM runtime.

expose_query_plan
boolean
default: false

Exposes the query plan as JSON under “extensions”