Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to return with non-zero exit code if diff finds breaking/dangerous changes #304

Closed
fabsrc opened this issue May 19, 2018 · 5 comments

Comments

@fabsrc
Copy link

fabsrc commented May 19, 2018

Right now the diff command only prints out the schema diff and points out breaking/dangerous changes. It would be cool if there was an option like --fail-on-breaking-changes/--fail-on-dangerous-changes to make the tool return with a non-zero exit code. This would be particularly useful in a CI job that compares the schema with the prod environment and should fail if there are any breaking changes.

I'm currently using a bash script to achieve this:

#!/usr/bin/env bash

npm i -g graphql-cli
DIFF=$(graphql diff -e $1 -t $2)
echo "$DIFF"

if [[ $DIFF = *"BREAKING CHANGES"* ]]
then
  exit 1
fi

However I think it makes sense to implement this feature into the tool.

@redreceipt
Copy link

Yep! The major upside here is including a breaking change check in a CI. I'll be using a script to do the same but would be nice to be built into the diff command.

@fabsrc
Copy link
Author

fabsrc commented May 31, 2019

@redreceipt I ended up creating a dedicated tool for this. You can check it out here: https://github.com/fabsrc/graphql-schema-diff

@redreceipt
Copy link

@fabsrc excellent! Thank you!

@ardatan ardatan closed this as completed Oct 28, 2019
Repository owner deleted a comment from ardatan Oct 29, 2019
@Urigo
Copy link
Owner

Urigo commented Oct 29, 2019

We've just released new alpha versions channel for GraphQL CLI - 4.0.0-alpha.XXX!

We use GraphQL Inspector as the default package for the diff command to track changes between schemas which is highly configurable for specifying what is considered a breaking change.

@fabsrc your tool looks great! would you like to collaborate with us on GraphQL Inspector?

Checkout new instructions and the migration guide and we will be happy to hear your feedback during that alpha period!

Feel free to contact us by opening an issue or using our Discord channel;
https://discord.gg/xud7bH

@Urigo
Copy link
Owner

Urigo commented Oct 29, 2019

I've posted the wrong Discord link, this is the correct one: https://discord.gg/xud7bH9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants