Managing your schema
The Apollo schema registry is a central hub for managing your data graph. After you register your schema, you can use Apollo Studio to explore the schema's types and fields, track its change history, and even build and run operations against it.
The Explorer tab in Apollo Studio enables you to navigate the entirety of your schema and execute operations against it directly from your browser.
Complete the Explorer's Getting Started steps to set it up and begin running queries.
The History view in Apollo Studio lets you view the timeline of changes made to your schema:
Only schema changes that you push to Studio are included in this timeline, which is one of the most important reasons to include schema registration in your continuous delivery pipeline.
Commonly, your application's development and staging environments use schemas that differ slightly from your production schema (especially if you're actively working on updates to your schema).
Because these schemas represent different environments for the same application, it makes sense to associate them with each other. To achieve this, you define variants of your graph.
Each variant of a graph functions as a standalone graph. Each has its own change history, metrics, and operation registry.
You can configure Apollo Server to associate the metrics it sends to Apollo Studio with a particular variant. To do so, set the
APOLLO_GRAPH_VARIANT environment variable (
apollo-server pre-2.13.0) to the appropriate variant before initializing Apollo Server.
Make sure you associate metrics with the correct variant! Otherwise, metrics from your staging and test environments will be included in reports for your production graph.
Keeping your registered schema up to date ensures that you get the best possible experience from Apollo tools that connect to the registry:
- The Apollo VS Code extension provides built-in linting on queries by validating against your registered schema. It also annotates fields with their descriptions and with performance indicators collected in Apollo's trace warehouse.
- The schema validation workflow protects your team from accidentally making breaking schema changes. It creates a diff between your local schema and the last schema pushed to the registry, and validates this diff against live traffic seen on your endpoint to warn you about problematic changes.