Schema validation
Certain changes to your GraphQL schema (such as removing a field or type) can potentially break one of your application's clients. Apollo Graph Manager provides schema validation to help you identify breaking changes before you make them, and to help you identify when a change won't break anything.
Schema validation is a paid feature that is available as part of Graph Manager Team and Enterprise plans.
Prerequisites
To enable schema validation for your data graph, first do the following:
- Set up trace reporting to Apollo Graph Manager from your GraphQL server.
- Set up schema registration in your continuous delivery pipeline.
- Install the Apollo CLI in your development environment if you haven't yet.
After you complete the above, you can perform a test validation by running the following command from your project's root directory:
# Omit 'npx' if you installed the Apollo CLI globally
$ npx apollo service:check
The validation process
When you validate your schema with the apollo service:check command
- Graph Manager generates a diff between your local schema and the schema that you most recently registered.
- It uses this diff to determine whether the changes affect any operations that have been executed against your graph recently (you can customize this time window).
- Graph Manager returns the diff and a list of any breaking changes found.
- The Apollo CLI prints the result of the validation and returns a non-zero exit code if at least one breaking change is found.
The validation response
Running apollo service:check outputs the diff of all detected schema changes and highlights breaking changes:
$ npx apollo service:check
Previous:
The schema registry
Next:
Pushing trace data to Graph Manager
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/apollo-graphql/schema-validation.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics