Skip to main content

diff

Schema comparison module for GraphQL Markdown. Provides utilities to compare GraphQL schemas and detect changes.

CompareMethod

Defined in: index.ts:32

Comparison methods used to determine if a schema has changed.

Enumeration Members

DIFF

DIFF: "SCHEMA-DIFF";

Defined in: index.ts:34

Compare schemas by diffing the content

FORCE

FORCE: "FORCE";

Defined in: index.ts:38

Force regeneration regardless of changes

HASH

HASH: "SCHEMA-HASH";

Defined in: index.ts:36

Compare schemas by comparing hash values

NONE

NONE: "NONE";

Defined in: index.ts:40

Skip comparison and assume no changes


checkSchemaChanges

const checkSchemaChanges: FunctionCheckSchemaChanges;

Defined in: index.ts:80

Checks if a schema has changed compared to a previous version. Uses either diff or hash-based comparison methods based on the method parameter.

Param

The current GraphQL schema

Param

Directory where schema or hash files will be saved

Param

Comparison method to use (defaults to DIFF)

Returns

A promise resolving to a boolean indicating whether the schema has changed


SCHEMA_HASH_FILE

const SCHEMA_HASH_FILE: ".schema";

Defined in: index.ts:25

File name for storing schema hash


SCHEMA_REF

const SCHEMA_REF: "schema.graphql";

Defined in: index.ts:27

File name for storing schema reference


getDiff()

function getDiff(schemaNew, schemaOldLocation): Promise<Change<any>[]>;

Defined in: index.ts:61

Compares a new schema against an existing schema file and returns the differences.

Parameters

schemaNew

GraphQLSchema

The new GraphQL schema to compare

schemaOldLocation

string

File path to the old schema

Returns

Promise<Change<any>[]>

A promise resolving to an array of schema changes


getSchemaHash()

function getSchemaHash(schema): string;

Defined in: index.ts:49

Generates a SHA-256 hash for a GraphQL schema.

Parameters

schema

GraphQLSchema

The GraphQL schema to generate a hash for

Returns

string

A SHA-256 hash string representing the schema