Coder Social home page Coder Social logo

gdw2 / graphql-schema-diff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabsrc/graphql-schema-diff

0.0 2.0 0.0 389 KB

:page_facing_up::arrows_counterclockwise::page_facing_up: Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.

License: MIT License

TypeScript 75.81% JavaScript 24.19%

graphql-schema-diff's Introduction

GraphQL Schema Diff

Build Status npm Dependencies Development Dependencies

Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.

Install

$ npm install -g graphql-schema-diff

Usage

$ graphql-schema-diff --help

  Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.

  Usage
    $ graphql-schema-diff <leftSchemaLocation> <rightSchemaLocation>

  Options
    --fail-on-dangerous-changes  Exit with error on dangerous changes
    --ignore-breaking-changes  Do not exit with error on breaking changes
    --create-html-output  Creates an HTML file containing the diff
    --html-output-directory  Directory where the HTML file should be stored (Default: './schemaDiff')
    --header, -H  Header to send to all remote schema sources
    --left-schema-header  Header to send to left remote schema source
    --right-schema-header Header to send to right remote schema source

  Examples
    $ graphql-schema-diff https://example.com/graphql schema.graphql
    $ graphql-schema-diff https://example.com/graphql schema.graphql -H 'Authorization: Bearer 123'

Schema locations can be:

  • An URL to a GraphQL endpoint (e.g. https://swapi.graph.cool/)
  • A path to a single file (e.g. schemas/schema.graphql)
  • A glob pattern to merge multiple files (e.g. 'schemas/**/*.graphql')

API

Example

import { getDiff } from 'graphql-schema-diff';

const currentSchemaLocation = 'https://swapi.graph.cool/';
const newSchemaLocation = './schema.graphql';

getDiff(currentSchemaLocation, newSchemaLocation)
  .then((result) => {
    if (!result) {
      console.log('Schemas are identical!');
      return;
    }

    console.log(result.diff);
    console.log(result.diffNoColor);
    console.log(result.dangerousChanges);
    console.log(result.breakingChanges);
  });

graphql-schema-diff's People

Contributors

fabsrc avatar dielduarte avatar gdw2 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.