How to use the @graphql-inspector/core.CriticalityLevel.NonBreaking 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 non-breaking', () => {
  const change: Change = {
    criticality: {
      level: CriticalityLevel.NonBreaking,
    },
    type: ChangeType.TypeRemoved,
    message: 'Chill, non breaking',
    path: 'Type.field',
  };

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

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

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

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

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

  expect(msg).toBeDefined();
  expect(msg).toEqual(change.message);
});
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,
    )
  ) {
    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 {
  const level = change.criticality.level;
  const schema = change.type.endsWith('_REMOVED') ? schemas.old : schemas.new;
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];
}