
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
graphql-schema_comparator
Advanced tools
GraphQL::SchemaComparator
is a GraphQL Schema comparator. What does that mean? GraphQL::SchemaComparator
takes
two GraphQL schemas and outputs a list of changes between versions. This is useful for many things:
Add this line to your application's Gemfile:
gem 'graphql-schema_comparator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install graphql-schema_comparator
GraphQL::SchemaComparator
comes with a handy CLI to help compare two schemas using
the command line.
After a gem install graphql-schema_comparator
, use the CLI this way:
Commands:
schema_comparator compare OLD_SCHEMA NEW_SCHEMA # Compares OLD_SCHEMA with NEW_SCHEMA and returns a list of changes
schema_comparator help [COMMAND] # Describe available commands or one specific command
Where OLD_SCHEMA and NEW_SCHEMA can be a string containing a schema IDL or a filename where that IDL is located.
$ ./bin/schema_comparator compare "type Query { a: A } type A { a: String } enum B { A_VALUE }" "type Query { a: A } type A { b: String } enum B { A_VALUE ANOTHER_VALUE }"
⏳ Checking for changes...
🎉 Done! Result:
Detected the following changes between schemas:
🛑 Field `a` was removed from object type `A`
⚠️ Enum value `ANOTHER_VALUE` was added to enum `B`
✅ Field `b` was added to object type `A`
GraphQL::SchemaComparator
, provides a simple api for Ruby applications to use.
http://www.rubydoc.info/github/xuorig/graphql-schema_comparator/master/GraphQL/SchemaComparator
The compare method takes two arguments, old_schema
and new_schema
, the two schemas to compare.
You may provide schema IDL as strings, or provide instances of GraphQL::Schema
.
The result of compare
returns a SchemaComparator::Result
object, from which you can
access information on the changes between the two schemas.
result.breaking?
returns true if any breaking changes were found between the two schemasresult.identical?
returns true if the two schemas were identicalresult.breaking_changes
returns the list of breaking changes found between schemas.result.non_breaking_changes
returns the list of non-breaking changes found between schemas.result.dangerous_changes
returns the list of dangerous changes found between schemas.result.changes
returns the full list of change objects.GraphQL::SchemaComparator
returns a list of change objects. These change objects
all inherit from Changes::AbstractChange
Possible changes are all found in changes.rb.
Each change object has a #criticality
method which returns a Changes::Criticality
object.
This objects defines how dangerous a change is to a schema.
The different levels of criticality (non_breaking, dangerous, breaking) are explained here: https://github.com/xuorig/graphql-schema_comparator/blob/master/lib/graphql/schema_comparator/changes/criticality.rb#L6-L19
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that graphql-schema_comparator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.