How to use the @stoplight/types.ValidationSeverity.Info function in @stoplight/types

To help you get started, we’ve selected a few @stoplight/types 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 stoplightio / spectral / src / __tests__ / linter.ts View on Github external
test('should support rule overriding severity', () => {
    spectral.addFunctions({
      func1: () => {
        return [
          {
            message: 'foo',
          },
        ];
      },
    });

    spectral.addRules({
      rule1: {
        given: '$.x',
        severity: ValidationSeverity.Info,
        severityLabel: ValidationSeverityLabel.Info,
        then: {
          function: 'func1',
        },
      },
    });

    const result = spectral.run({
      x: true,
    });

    expect(result.results[0].severity).toEqual(ValidationSeverity.Info);
    expect(result.results[0].severityLabel).toEqual(ValidationSeverityLabel.Info);
  });
github stoplightio / spectral / src / __tests__ / linter.ts View on Github external
test('should default severityLabel based on rule severity', () => {
    spectral.addFunctions({
      func1: () => {
        return [
          {
            message: 'foo',
          },
        ];
      },
    });

    spectral.addRules({
      rule1: {
        given: '$.x',
        severity: ValidationSeverity.Info,
        then: {
          function: 'func1',
        },
      },
    });

    const result = spectral.run({
      x: true,
    });

    expect(result.results[0].severity).toEqual(ValidationSeverity.Info);
    expect(result.results[0].severityLabel).toEqual(ValidationSeverityLabel.Info);
  });
github stoplightio / spectral / src / __tests__ / linter.ts View on Github external
spectral.addRules({
      rule1: {
        given: '$.x',
        severity: ValidationSeverity.Info,
        then: {
          function: 'func1',
        },
      },
    });

    const result = spectral.run({
      x: true,
    });

    expect(result.results[0].severity).toEqual(ValidationSeverity.Info);
    expect(result.results[0].severityLabel).toEqual(ValidationSeverityLabel.Info);
  });
github stoplightio / spectral / src / __tests__ / linter.ts View on Github external
spectral.addRules({
      rule1: {
        given: '$.x',
        severity: ValidationSeverity.Info,
        severityLabel: ValidationSeverityLabel.Info,
        then: {
          function: 'func1',
        },
      },
    });

    const result = spectral.run({
      x: true,
    });

    expect(result.results[0].severity).toEqual(ValidationSeverity.Info);
    expect(result.results[0].severityLabel).toEqual(ValidationSeverityLabel.Info);
  });