graphql/utilities/schema-changes

Functions

findBreakingChanges()

Given two schemas, returns an Array containing descriptions of all the types of breaking changes covered by the other functions down below.

Signature:

findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]

Arguments

NameTypeDescription
oldSchemaGraphQLSchemaThe older schema to compare.
newSchemaGraphQLSchemaThe newer schema to compare.

Returns

TypeDescription
BreakingChange[]The breaking changes detected between the old and new schemas.

Example

import { findBreakingChanges } from 'graphql/utilities';
 
const result = findBreakingChanges(oldSchema, newSchema);
 
// result contains the findBreakingChanges return value

findDangerousChanges()

Given two schemas, returns an Array containing descriptions of all the types of potentially dangerous changes covered by the other functions down below.

Signature:

findDangerousChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): DangerousChange[]

Arguments

NameTypeDescription
oldSchemaGraphQLSchemaThe older schema to compare.
newSchemaGraphQLSchemaThe newer schema to compare.

Returns

TypeDescription
DangerousChange[]The dangerous changes detected between the old and new schemas.

Example

import { findDangerousChanges } from 'graphql/utilities';
 
const result = findDangerousChanges(oldSchema, newSchema);
 
// result contains the findDangerousChanges return value

Enumerations

BreakingChangeType

The kind of breaking schema change detected between two schemas.

Members

NameValueDescription
TYPE_REMOVED"TYPE_REMOVED"Breaking change code for type removed.
TYPE_CHANGED_KIND"TYPE_CHANGED_KIND"Breaking change code for type changed kind.
TYPE_REMOVED_FROM_UNION"TYPE_REMOVED_FROM_UNION"Breaking change code for type removed from union.
VALUE_REMOVED_FROM_ENUM"VALUE_REMOVED_FROM_ENUM"Breaking change code for value removed from enum.
REQUIRED_INPUT_FIELD_ADDED"REQUIRED_INPUT_FIELD_ADDED"Breaking change code for required input field added.
IMPLEMENTED_INTERFACE_REMOVED"IMPLEMENTED_INTERFACE_REMOVED"Breaking change code for implemented interface removed.
FIELD_REMOVED"FIELD_REMOVED"Breaking change code for field removed.
FIELD_CHANGED_KIND"FIELD_CHANGED_KIND"Breaking change code for field changed kind.
REQUIRED_ARG_ADDED"REQUIRED_ARG_ADDED"Breaking change code for required arg added.
ARG_REMOVED"ARG_REMOVED"Breaking change code for arg removed.
ARG_CHANGED_KIND"ARG_CHANGED_KIND"Breaking change code for arg changed kind.
DIRECTIVE_REMOVED"DIRECTIVE_REMOVED"Breaking change code for directive removed.
DIRECTIVE_ARG_REMOVED"DIRECTIVE_ARG_REMOVED"Breaking change code for directive arg removed.
REQUIRED_DIRECTIVE_ARG_ADDED"REQUIRED_DIRECTIVE_ARG_ADDED"Breaking change code for required directive arg added.
DIRECTIVE_REPEATABLE_REMOVED"DIRECTIVE_REPEATABLE_REMOVED"Breaking change code for directive repeatable removed.
DIRECTIVE_LOCATION_REMOVED"DIRECTIVE_LOCATION_REMOVED"Breaking change code for directive location removed.

DangerousChangeType

The kind of dangerous schema change detected between two schemas.

Members

NameValueDescription
VALUE_ADDED_TO_ENUM"VALUE_ADDED_TO_ENUM"Dangerous change code for value added to enum.
TYPE_ADDED_TO_UNION"TYPE_ADDED_TO_UNION"Dangerous change code for type added to union.
OPTIONAL_INPUT_FIELD_ADDED"OPTIONAL_INPUT_FIELD_ADDED"Dangerous change code for optional input field added.
OPTIONAL_ARG_ADDED"OPTIONAL_ARG_ADDED"Dangerous change code for optional arg added.
IMPLEMENTED_INTERFACE_ADDED"IMPLEMENTED_INTERFACE_ADDED"Dangerous change code for implemented interface added.
ARG_DEFAULT_VALUE_CHANGE"ARG_DEFAULT_VALUE_CHANGE"Dangerous change code for arg default value change.

Types

BreakingChange

Interface. Describes one breaking change detected between two schemas.

Members

NameTypeDescription
typeBreakingChangeTypeThe GraphQL type reference or runtime type for this element.
descriptionstringHuman-readable description for this schema element, if provided.

DangerousChange

Interface. Describes one dangerous change detected between two schemas.

Members

NameTypeDescription
typeDangerousChangeTypeThe GraphQL type reference or runtime type for this element.
descriptionstringHuman-readable description for this schema element, if provided.