Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-inspector/diff-command

Package Overview
Dependencies
Maintainers
0
Versions
507
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-inspector/diff-command

Compare GraphQL Schemas

  • 5.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @graphql-inspector/diff-command?

@graphql-inspector/diff-command is a tool that helps you detect changes in your GraphQL schema. It allows you to compare two GraphQL schemas and identify breaking changes, dangerous changes, and safe changes. This is particularly useful for maintaining backward compatibility and ensuring that updates to your GraphQL API do not inadvertently break existing clients.

What are @graphql-inspector/diff-command's main functionalities?

Detect Breaking Changes

This feature allows you to detect breaking changes between two GraphQL schemas. In the example, the type of the 'hello' field changes from String to Int, which is a breaking change.

const { diff } = require('@graphql-inspector/diff-command');
const oldSchema = `type Query { hello: String }`;
const newSchema = `type Query { hello: Int }`;
const changes = diff(oldSchema, newSchema);
console.log(changes);

Detect Dangerous Changes

This feature allows you to detect dangerous changes between two GraphQL schemas. In the example, a new field 'world' is added to the Query type, which could be considered a dangerous change if clients are not expecting it.

const { diff } = require('@graphql-inspector/diff-command');
const oldSchema = `type Query { hello: String }`;
const newSchema = `type Query { hello: String, world: String }`;
const changes = diff(oldSchema, newSchema);
console.log(changes);

Detect Safe Changes

This feature allows you to detect safe changes between two GraphQL schemas. In the example, a new field 'world' is added to the Query type, which is a safe change as it does not affect existing clients.

const { diff } = require('@graphql-inspector/diff-command');
const oldSchema = `type Query { hello: String }`;
const newSchema = `type Query { hello: String, world: String }`;
const changes = diff(oldSchema, newSchema);
console.log(changes);

Other packages similar to @graphql-inspector/diff-command

Keywords

FAQs

Package last updated on 09 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc