Socket
Book a DemoInstallSign in
Socket

graphql-schema-version

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-schema-version

derive a semver version number from a graphql schema

latest
Source
npmnpm
Version
1.1.5
Version published
Weekly downloads
16
-60.98%
Maintainers
1
Weekly downloads
 
Created
Source

graphql-schema-version

derive a semver version number from a graphql schema

Build Status js-standard-style

usage

const graphqlSchemaVersion = require('graphql-schema-version')

const newSchema = require('./newClientSchema.json')
const oldSchema = require('./oldClientSchema.json')
const oldVersion = '2.3.0'
console.log(graphqlSchemaVersion(newSchema, oldSchema, oldVersion))

prints a semver for the relation, e.g. 2.4.0 for a minor version increment or 3.0.0 for major.

the schema documents it takes as arguments are the JSON documents generated from the client introspection query - see http://graphql.org/graphql-js/utilities/#printintrospectionschema

Spec

graphql-schema-version
✓ returns oldVersion if no old schema is supplied
✓ defaults to `1.0.0` if oldVersion is not supplied
✓ increments patch version if field is deprecated
✓ increments minor version if enum type is added
✓ increments minor version if enum value is added
✓ increments minor version if type is added
✓ increments major version if type is deleted
✓ increments minor version if field is added
✓ increments major version if field is deleted
✓ increments major version if field type changed
✓ increments minor version if field argument added
✓ increments major version if field argument deleted
✓ increments major version if field argument type changed
✓ increments patch version if directive is added
✓ increments major version if directive is deleted
✓ increments major version if enum type is deleted
✓ increments major version if enum value is deleted
✓ increments minor version if field type changes from non-nullable to nullable of the same inner type

installation

$ npm install graphql-schema-version

running the tests

From package root:

$ npm install
$ npm test

contributors

  • jason@denizac.org

todo

  • rewrite with proper visitor pattern for maintainability

license

ISC. (c) MMXVI jason@denizac.org. See LICENSE.md

Keywords

graphql

FAQs

Package last updated on 12 Jan 2017

Did you know?

Socket

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.

Install

Related posts