8. Making changes to the supergraph
2m

Part 2: Safe API delivery

📋 Process of making changes to the supergraph

  1. Run schema checks.

  2. Deploy code changes.

  3. Publish the new to .

The steps above in diagram form

📋 Step 1: Schema checks

Schema checks are a set of predefined tests that help identify potential failures caused by schema updates. They check for issues like incompatibilities between or breaking existing client . With , we can ensure that our schema changes won't cause issues when we deploy to production.

Types of :

  • Build checks validate that a 's schema changes can still compose successfully with other in the .
  • Operation checks validate that a schema's changes won't break any that existing clients send to the .
  • Linter checks analyze your proposed schema changes for violations of formatting rules and other best practices. You can see the full list of default rules in the Apollo documentation.

rover subgraph check

Using the , we can run locally in our terminal or we can integrate schema checks into our CI pipelines to run automatically against new pull requests.

rover subgraph check <GRAPH_REF> \
--schema <SCHEMA_FILE_PATH> \
--name <SUBGRAPH_NAME>

Note: The GRAPH_REF refers to the graph reference, which identifies our in . A starts with the graph's ID, followed by an @ symbol, followed by the .

This command first runs a build check, then an check, then a linter check, and finally outputs the results in the command line. It also reports the results to Studio, so we can view them from our 's Checks page.

📋 Step 2: Deploy code changes

This step looks different for all projects. In this workshop, we've set up automatic deploys to Railway (or your hosting platform of choice) when new commits are pushed to the main branch on GitHub.

📋 Step 3: Publishing the subgraph schema

The schema registry needs to know about our schema updates! To do so, we need to publish our to the registry.

rover subgraph publish

Similar to , there are two main ways to publish a using the : locally, or in CI pipelines.

rover subgraph publish <GRAPH_REF> \
--schema <SCHEMA_FILE_PATH> \
--name <SUBGRAPH_NAME>

GraphOS launch

A launch represents the complete process of applying a set of updates to a . A is triggered when a new or updated version of a is published, when a new subgraph is added, or when the configuration is changed.

Expand section below to see full image description

Previous

Share your questions and comments about this lesson

Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.