How to use graphql-schema-diff - 1 common examples

To help you get started, we’ve selected a few graphql-schema-diff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dielduarte / schema-diff-bot / index.js View on Github external
(async () => {
  const programVariables = await cosmiconfig(MODULE_NAME).search();

  if (!programVariables) {
    spinner.fail('no config file found.');
    return;
  }

  if (programVariables.isEmpty) {
    spinner.fail('config file is empty.');
  }

  spinner.info('config file found.');
  spinner.info('comparing schemas...');

  const diffs = await await graphqlSchemaDiff.getDiff(
    programVariables.config.leftSchema,
    programVariables.config.rightSchema || programVariables.config.leftSchema,
    programVariables.config.options || {}
  );

  if (!diffs) {
    spinner.succeed('Schemas are identical, no message to send! 0/').stop();
    return;
  }

  spinner.info('creating message with differences...');
  const allChanges = [...diffs.dangerousChanges, ...diffs.breakingChanges];
  const mountedMessage = message.mountMessage(
    allChanges,
    programVariables.config
  );

graphql-schema-diff

Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.

MIT
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis

Popular graphql-schema-diff functions