August 24, 2023

Enforce schema consistency across federated graphs with GraphOS

Vivek Ravishankar
Product Marketing at Apollo

When you’re building a federated GraphQL API that spans multiple backend teams and services, it can be difficult to ensure that the schema for your graph stays consistent from subgraph to subgraph. For example, how do you ensure that a type defined as an entity in one subgraph is also defined as an entity in all other subgraphs?

Today, we’re making it easier for API platform teams to enforce schema consistency across multiple subgraphs by adding composition rules to the Apollo GraphOS linter. Now, you can configure the GraphOS checks workflow to flag inconsistent elements across subgraphs, overridden or unused elements, and issues with Federation directives.

Configure composition rule severity

Like other linter rules in GraphOS, you can enable or disable each composition rule independently and set its severity to Warn or Error. Violations of rules set to Error will cause the checks workflow to fail outright (useful for changes pushed to production graphs) while Warn violations will allow the checks workflow to pass but output a warning.

Integrate with development workflows

Composition rules are enforced by GraphOS linter checks, which you can integrate into your existing delivery processes:

  1. CI/CD pipelines — Centrally enforce composition rules in your existing CI/CD pipelines by installing Rover in your CI/CD environment
  2. The GraphOS registry — Enforce composition rules for all schema changes pushed to the GraphOS registry — the final checkpoint before your schema is used in production.

Get started

Composition rules for the GraphOS schema linter are available starting today for all GraphOS users. To get started, head to the Checks Configuration page for your graph in GraphOS Studio or read the docs for a step-by-step setup guide.

Written by

Vivek Ravishankar

Stay in our orbit!

Become an Apollo insider and get first access to new features, best practices, and community events. Oh, and no junk mail. Ever.

Make this article better!

Was this post helpful? Have suggestions? Consider so we can improve it for future readers ✨.

Similar posts

September 5, 2023

Build centralized GraphQL authorization with Apollo GraphOS

by Vivek Ravishankar