w3resource

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:

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

  1. Graph Manager generates a diff between your local schema and the schema that you most recently registered.
  2. 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).
  3. Graph Manager returns the diff and a list of any breaking changes found.
  4. 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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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://www.w3resource.com/apollo-graphql/schema-validation.php