-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Find breaking directive changes #1152
Merged
leebyron
merged 18 commits into
graphql:master
from
kenleezle:find-breaking-directive-changes
Dec 15, 2017
Merged
Find breaking directive changes #1152
leebyron
merged 18 commits into
graphql:master
from
kenleezle:find-breaking-directive-changes
Dec 15, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The GraphQL schema definition is continually evolving as server engineers add, modify, and delete GraphQL types and fields. These changes to the schema can be dangerous, particularly breaking changes where the new version of the schema is not backwards compatible with the old schema.
For example, consider a breaking change where a www server diff removes the type
Foo
from the schema. This change could potentially break the client in fbsource if there is any client .graphql files that refer to theFoo
type.In order to prevent these types of issue, we run tests on diffs that affect the schema which compare the old schema to the new schema and detect any breaking changes. The logic that detects the breaking changes lives in our open source graphql-js library: https://github.com/graphql/graphql-js/blob/master/src/utilities/findBreakingChanges.js.
This task:
The findBreakingChanges utility detects most types of breaking changes (see https://github.com/graphql/graphql-js/blob/master/src/utilities/findBreakingChanges.js#L31-L41 for a list of which kinds are currently detected). However, the utility currently does not detect breaking changes related to Directives**.
This task is to add support in findBreakingChanges to detect:
**For more info on GraphQL Directives, you can read http://graphql.org/learn/queries/#directives as well as the official GraphQL spec: http://facebook.github.io/graphql/October2016/#sec-Type-System.Directives.
Basically, directives are annotations that can be supplied in .graphql files that can alter runtime behavior. Directives has a list of supported "locations", where in a graphql file they can appear. (Some annotations are used on fields, some on queries, etc).
-- @sam-swarr