@graphql-markdown/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