DEV Community

Cover image for Validate GraphQL Schema - Continuous Integration & Delivery Pipeline
TheGuildBot for The Guild

Posted on • Edited on • Originally published at the-guild.dev

Validate GraphQL Schema - Continuous Integration & Delivery Pipeline

This article was published on Sunday, May 3, 2020 by Kamil Kisiela @ The Guild Blog

GraphQL Inspector since day one supported any kind of Continuous Integration and Delivery Pipeline.
Nothing new here, except now it's more flexible and super lightweight.

The new version of GraphQL Inspector comes with a CLI crafter specifically for CI/CD.

We recently released a lot more interesting features. You can read about them in
"New GraphQL Inspector and upcoming features" article.

CLI for CI?

The regular CLI comes with everything built-in. Loads Schema, Operations and Fragments from any
source. It can extract GraphQL pieces from GraphQL files, code files (Vue, React, Angular and even
Gatsby). The CLI supports GraphQL Endpoints, Git repositories and also files on GitHub.

It's heavy!

Usually, in the CI/CD pipeline you want to compare a current schema with the one in production and
detect breaking changes. Which means, you don't need all the other commands and features of
Inspector CLI.

CLI Designed for CI/CD

That's why in new GraphQL Inspector, everything is a plugin.

You want to compare schemas and detect breaking changes?

yarn global add @graphql-inspector/diff-command
Enter fullscreen mode Exit fullscreen mode

Your production schema is accessible through an endpoint but newly proposed schema is defined
in .graphql files?

yarn global add @graphql-inspector/url-loader
yarn global add @graphql-inspector/graphql-loader
Enter fullscreen mode Exit fullscreen mode

Ok, everything is ready!

How to Compare Schemas?

You can use the command below in your CI/CD pipeline:

graphql-inspector diff "https://api.com/graphql" "schema.graphql"
Enter fullscreen mode Exit fullscreen mode

Here's how the result looks like. It shows a list of all changes and groups them by criticality
level (Breaking, Dangerous or Safe).

To learn more about CLI for CI, please read
"Continuous Integration" chapter in our
documentation.


Future Plans

We're working on Azure and Bitbucket integrations plus a monitoring feature. Talk to us to
try it out.

We want to make Azure and Bitbucket a first-class citizens in GraphQL Inspector and give you
the same experience as you get right now with GitHub.

Monitoring will enable you to analyze the traffic of your GraphQL APIs and provide details
needed to improve performance. Collecting informations about the usage will let you safely remove
deprecated pieces of GraphQL Schema.

If you're interested, please reach out to us!


Enjoy GraphQL Inspector!

We have big plans for Inspector, and you're very welcome to join us in that journey.

GraphQL Inspector is a tool created by developers, for developers and that's why we'd love to get
your feedback and shape GraphQL Inspector together!

Oh... and it's Open Sourced!

Top comments (0)