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
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:
- CI/CD pipelines — Centrally enforce composition rules in your existing CI/CD pipelines by installing Rover in your CI/CD environment.
- 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.
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.
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 ✨.