How to use the @graphql-inspector/core.CriticalityLevel.Breaking function in @graphql-inspector/core

To help you get started, we’ve selected a few @graphql-inspector/core 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 kamilkisiela / graphql-inspector / packages / cli / __tests__ / render.ts View on Github external
test('render breaking', () => {
  const change: Change = {
    criticality: {
      level: CriticalityLevel.Breaking,
    },
    type: ChangeType.TypeRemoved,
    message: 'Boom, breaking',
    path: 'Type.field',
  };

  const [symbol, msg] = renderChange(change);

  expect(symbol).toBeDefined();
  expect(symbol).toEqual(getSymbol(CriticalityLevel.Breaking));

  expect(msg).toBeDefined();
  expect(msg).toEqual(change.message);
});
github kamilkisiela / graphql-inspector / packages / cli / __tests__ / render.ts View on Github external
test('render breaking', () => {
  const change: Change = {
    criticality: {
      level: CriticalityLevel.Breaking,
    },
    type: ChangeType.TypeRemoved,
    message: 'Boom, breaking',
    path: 'Type.field',
  };

  const [symbol, msg] = renderChange(change);

  expect(symbol).toBeDefined();
  expect(symbol).toEqual(getSymbol(CriticalityLevel.Breaking));

  expect(msg).toBeDefined();
  expect(msg).toEqual(change.message);
});
github kamilkisiela / graphql-inspector / packages / cli / src / commands / diff.ts View on Github external
  return changes.some(c => c.criticality.level === CriticalityLevel.Breaking);
}
github kamilkisiela / graphql-inspector / packages / cli / src / render.ts View on Github external
export function getSymbol(level: CriticalityLevel): string {
  const symbols = {
    [CriticalityLevel.Dangerous]: logSymbols.warning,
    [CriticalityLevel.Breaking]: logSymbols.error,
    [CriticalityLevel.NonBreaking]: logSymbols.success,
  };

  return symbols[level];
}
github kamilkisiela / graphql-inspector / packages / cli / src / commands / diff.ts View on Github external
          c => c.criticality.level === CriticalityLevel.Breaking,
        ).length;
github Urigo / graphql-cli / packages / commands / diff / src / index.ts View on Github external
function getSymbol(level: CriticalityLevel): string {
  const symbols = {
    [CriticalityLevel.Dangerous]: logSymbols.warning,
    [CriticalityLevel.Breaking]: logSymbols.error,
    [CriticalityLevel.NonBreaking]: logSymbols.success
  };

  return symbols[level];
}
github kamilkisiela / graphql-inspector / packages / github / src / diff.ts View on Github external
      change => change.criticality.level === CriticalityLevel.Breaking,
    )
github kamilkisiela / graphql-inspector / packages / github / src / diff.ts View on Github external
if (
    changes.some(
      change => change.criticality.level === CriticalityLevel.Breaking,
    )
  ) {
    conclusion = CheckConclusion.Failure;
  }

  return {
    conclusion,
    annotations,
  };
}

const levelMap = {
  [CriticalityLevel.Breaking]: AnnotationLevel.Failure,
  [CriticalityLevel.Dangerous]: AnnotationLevel.Warning,
  [CriticalityLevel.NonBreaking]: AnnotationLevel.Notice,
};

function annotate({
  path,
  change,
  schemas,
}: {
  path: string;
  change: Change;
  schemas: {
    old: GraphQLSchema;
    new: GraphQLSchema;
  };
}): Annotation {
github Urigo / graphql-cli / packages / commands / diff / src / index.ts View on Github external
              const breakingCount = changes.filter(c => c.criticality.level === CriticalityLevel.Breaking).length;
              throw `Detected ${breakingCount} breaking change${breakingCount > 1 ? 's' : ''}\n`;