Skip to content
Latchkey

rover graph check: Check GraphQL Schema Changes

rover graph check compares a proposed schema against the published one in Apollo GraphOS and reports breaking changes and operations that would fail.

Apollo Rover is the CLI for Apollo GraphOS. graph check is the PR gate for a monolithic (non-federated) graph: it runs schema and operation checks against real recorded traffic.

What it does

rover graph check takes a graph ref (<GRAPH_ID>@<VARIANT>) and a proposed schema on stdin or via --schema, submits it to GraphOS, and reports schema diffs plus which real client operations would break. It exits non-zero when the check fails.

Common usage

Terminal
export APOLLO_KEY=service:my-graph:xxxxxxxx
rover graph check my-graph@current --schema ./schema.graphql
# pipe an introspected schema in
rover graph introspect http://localhost:4000 | \
  rover graph check my-graph@current --schema -

Options

Flag / EnvWhat it does
<GRAPH_REF>Graph and variant, e.g. my-graph@current
--schema <path|->Proposed schema file or - for stdin
--name <name>Subgraph name (for subgraph check)
--backgroundStart the check asynchronously
APOLLO_KEYAPI key used to authenticate to GraphOS
APOLLO_VCS_COMMITAssociate the check with a commit

In CI

Set APOLLO_KEY from a CI secret, run rover graph check <graph>@<variant> on every PR, and let the non-zero exit block merges that break clients. Rover prints a GraphOS URL for the full report, which is handy to link in a PR comment.

Common errors in CI

A failed check ends with error[E030]: This operation check has encountered ... check failed (or simply Compositon/Operation check failed) and a non-zero exit. "Could not find an API key" or error: No credentials found. Rover requires ... APOLLO_KEY means the secret is unset. "Invalid graph ref" means a bad <id>@<variant>. "HTTP status 401 Unauthorized" means the key lacks access to that graph.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →