All Projects β†’ xuorig β†’ Graphql Schema_comparator

xuorig / Graphql Schema_comparator

Licence: mit
Get changes between two GraphQL schemas πŸ€–

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Graphql Schema comparator

Graphback
Graphback - Out of the box GraphQL server and client
Stars: ✭ 323 (+64.8%)
Mutual labels:  graphql, cli
Graphql Zeus
GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚑⚑⚑ for browser,nodejs and react native
Stars: ✭ 1,043 (+432.14%)
Mutual labels:  graphql, cli
Create Graphql
Command-line utility to build production-ready servers withΒ GraphQL.
Stars: ✭ 441 (+125%)
Mutual labels:  graphql, cli
Graphqlviz
GraphQL Server schema visualizer
Stars: ✭ 591 (+201.53%)
Mutual labels:  graphql, cli
Gest
πŸ‘¨β€πŸ’» A sensible GraphQL testing tool - test your GraphQL schema locally and in the cloud
Stars: ✭ 109 (-44.39%)
Mutual labels:  graphql, cli
Circleci Cli
Use CircleCI from the command line
Stars: ✭ 297 (+51.53%)
Mutual labels:  graphql, cli
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (+291.84%)
Mutual labels:  graphql, cli
Graphqurl
curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.
Stars: ✭ 3,012 (+1436.73%)
Mutual labels:  graphql, cli
Src Cli
Sourcegraph CLI
Stars: ✭ 108 (-44.9%)
Mutual labels:  graphql, cli
Gql
Very simple CLI for many GraphQL schemas in the cloud. Provides autocompletion for GraphQL queries
Stars: ✭ 101 (-48.47%)
Mutual labels:  graphql, cli
App
Reusable framework for micro services & command line tools
Stars: ✭ 66 (-66.33%)
Mutual labels:  graphql, cli
Webtau
Webtau (short for web test automation) is a testing API, command line tool and a framework to write unit, integration and end-to-end tests. Test across REST-API, Graph QL, Browser, Database, CLI and Business Logic with consistent set of matchers and concepts. REPL mode speeds-up tests development. Rich reporting cuts down investigation time.
Stars: ✭ 156 (-20.41%)
Mutual labels:  graphql, cli
Graphql Cli
πŸ“Ÿ Command line tool for common GraphQL development workflows
Stars: ✭ 1,814 (+825.51%)
Mutual labels:  graphql, cli
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-4.08%)
Mutual labels:  graphql, cli
Npmvet
A simple CLI tool for vetting npm package versions
Stars: ✭ 193 (-1.53%)
Mutual labels:  cli
Twf
Standalone tree view file explorer, inspired by fzf.
Stars: ✭ 196 (+0%)
Mutual labels:  cli
Snapstub
Copy API endpoints to your fs and run a local server using them
Stars: ✭ 193 (-1.53%)
Mutual labels:  cli
Botany
command line virtual plant buddy
Stars: ✭ 192 (-2.04%)
Mutual labels:  cli
Fileicon
macOS CLI for managing custom icons for files and folders
Stars: ✭ 196 (+0%)
Mutual labels:  cli
Firecamp
The world's first Multi-protocol API Platform. Run, Test, Collaborate to build Any Kind Of APIs.
Stars: ✭ 195 (-0.51%)
Mutual labels:  graphql

GraphQL::SchemaComparator

Build Status

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:

  • Breaking Change detection
  • Applying custom rules to schema changes
  • Building automated tools like linters

Installation

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

CLI

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.

Example

$ ./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`

Usage

GraphQL::SchemaComparator, provides a simple api for Ruby applications to use.

Docs

http://www.rubydoc.info/github/xuorig/graphql-schema_comparator/master/GraphQL/SchemaComparator

GraphQL::SchemaComparator.compare

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 schemas
  • result.identical? returns true if the two schemas were identical
  • result.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.

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.

Change Criticality

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].