Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/spectral-core

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/spectral-core - npm Package Compare versions

Comparing version 1.8.1 to 1.9.0

dist/ruleset/rule.d.ts

3

dist/documentInventory.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentInventory = void 0;
const tslib_1 = require("tslib");
const json_1 = require("@stoplight/json");

@@ -9,3 +10,3 @@ const path_1 = require("@stoplight/path");

const errorMessages_1 = require("./errorMessages");
const Parsers = require("@stoplight/spectral-parsers");
const Parsers = (0, tslib_1.__importStar)(require("@stoplight/spectral-parsers"));
const spectral_runtime_1 = require("@stoplight/spectral-runtime");

@@ -12,0 +13,0 @@ class DocumentInventory {

@@ -41,13 +41,3 @@ {

"given": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
"$ref": "shared#given"
},

@@ -54,0 +44,0 @@ "resolved": {

@@ -175,42 +175,40 @@ {

"additionalProperties": {
"oneOf": [
{
"$id": "alias-value",
"type": "string",
"pattern": "^[$#]",
"errorMessage": {
"_": "the value of an alias must be a valid JSON Path expression, a reference to the existing Alias optionally paired with a JSON Path expression subset, or contain a valid set of targets",
"pattern": "the value of an alias must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
}
},
{
"type": "object",
"properties": {
"description": {
"type": "string"
},
"targets": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"formats": {
"$ref": "shared#formats"
},
"given": {
"$ref": "alias-value"
}
"if": {
"type": "object"
},
"then": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"targets": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"formats": {
"$ref": "shared#formats"
},
"required": ["formats", "given"],
"errorMessage": "a valid target must contain given and non-empty formats"
"given": {
"$ref": "shared#given"
}
},
"errorMessage": {
"minItems": "targets must have at least a single alias definition"
}
"required": ["formats", "given"],
"errorMessage": "a valid target must contain given and non-empty formats"
},
"errorMessage": {
"minItems": "targets must have at least a single alias definition"
}
},
"required": ["targets"]
}
},
"required": ["targets"],
"errorMessage": {
"required": "targets must be present and have at least a single alias definition"
}
]
},
"else": {
"$ref": "shared#given"
}
}

@@ -217,0 +215,0 @@ }

@@ -35,4 +35,29 @@ {

"errorMessage": "the value has to be one of: 0, 1, 2, 3 or \"error\", \"warn\", \"info\", \"hint\", \"off\""
},
"Given": {
"$anchor": "given",
"if": {
"type": "array"
},
"then": {
"type": "array",
"items": {
"$ref": "path-expression"
},
"minItems": 1,
"errorMessage": {
"minItems": "must be a non-empty array of expressions"
}
},
"else": {
"$ref": "path-expression"
}
},
"PathExpression": {
"$id": "path-expression",
"type": "string",
"pattern": "^[$#]",
"errorMessage": "must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
}
}
}
import { Optional } from '@stoplight/types';
import { Rule } from '../rule/rule';
import { Rule } from '../rule';
import type { Ruleset } from '../ruleset';
import { FileRuleDefinition } from '../types';
export declare function mergeRule(existingRule: Optional<Rule>, name: string, rule: FileRuleDefinition, ruleset: Ruleset): Rule;

@@ -5,3 +5,3 @@ "use strict";

const validation_1 = require("../validation");
const rule_1 = require("../rule/rule");
const rule_1 = require("../rule");
function assertExistingRule(maybeRule, name) {

@@ -8,0 +8,0 @@ if (maybeRule === void 0) {

@@ -1,2 +0,2 @@

import { Rule, StringifiedRule } from './rule/rule';
import { Rule, StringifiedRule } from './rule';
import { FileRulesetSeverityDefinition, ParserOptions, RulesetAliasesDefinition, RulesetDefinition, RulesetOverridesDefinition } from './types';

@@ -3,0 +3,0 @@ import { FormatsSet } from './utils/formatsSet';

@@ -14,2 +14,3 @@ "use strict";

const formatsSet_1 = require("./utils/formatsSet");
const guards_1 = require("./utils/guards");
const STACK_SYMBOL = Symbol('@stoplight/spectral/ruleset/#stack');

@@ -47,3 +48,3 @@ const DEFAULT_RULESET_FILE = /^\.?spectral\.(ya?ml|json|m?js)$/;

const [name, value] = alias;
if (typeof value === 'string') {
if ((0, guards_1.isSimpleAliasDefinition)(value)) {
return alias;

@@ -50,0 +51,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRulesetFunction = exports.RulesetFunctionValidationError = void 0;
const ajv_1 = require("ajv");
const ajv_formats_1 = require("ajv-formats");
const ajv_errors_1 = require("ajv-errors");
const tslib_1 = require("tslib");
const ajv_1 = (0, tslib_1.__importDefault)(require("ajv"));
const ajv_formats_1 = (0, tslib_1.__importDefault)(require("ajv-formats"));
const ajv_errors_1 = (0, tslib_1.__importDefault)(require("ajv-errors"));
const spectral_runtime_1 = require("@stoplight/spectral-runtime");

@@ -8,0 +9,0 @@ const validation_1 = require("./validation");

@@ -21,3 +21,3 @@ import { DiagnosticSeverity } from '@stoplight/types';

recommended?: boolean;
given: string | string[];
given: GivenDefinition;
resolved?: boolean;

@@ -31,2 +31,3 @@ then: IRuleThen | IRuleThen[];

}
export declare type GivenDefinition = string | string[];
export declare type RulesetExtendsDefinition = RulesetDefinition | (RulesetDefinition | [RulesetDefinition, FileRulesetSeverityDefinition])[];

@@ -47,11 +48,11 @@ export declare type RulesetOverrideDefinition = Pick<RulesetDefinition, 'formats' | 'parserOptions' | 'aliases'> & ({

targets: {
formats: FormatsSet;
given: string;
formats: FormatsSet | Format[];
given: GivenDefinition;
}[];
};
export declare type RulesetAliasesDefinition = Record<string, string | RulesetScopedAliasDefinition>;
export declare type RulesetAliasesDefinition = Record<string, GivenDefinition | RulesetScopedAliasDefinition>;
export declare type RulesetDefinition = Readonly<{
documentationUrl?: string;
description?: string;
formats?: Format<any>[];
formats?: FormatsSet | Format[];
parserOptions?: Partial<ParserOptions>;

@@ -58,0 +59,0 @@ overrides?: RulesetOverridesDefinition;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.minimatch = void 0;
const mm = require("minimatch");
const tslib_1 = require("tslib");
const minimatch_1 = (0, tslib_1.__importDefault)(require("minimatch"));
const DEFAULT_OPTS = { matchBase: true };
function minimatch(source, pattern) {
return mm(source, pattern, DEFAULT_OPTS);
return (0, minimatch_1.default)(source, pattern, DEFAULT_OPTS);
}
exports.minimatch = minimatch;
//# sourceMappingURL=minimatch.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertValidRule = exports.isValidRule = exports.assertValidRuleset = exports.RulesetValidationError = void 0;
const ajv_1 = require("ajv");
const ajv_formats_1 = require("ajv-formats");
const ajv_errors_1 = require("ajv-errors");
const tslib_1 = require("tslib");
const ajv_1 = (0, tslib_1.__importStar)(require("ajv"));
const ajv_formats_1 = (0, tslib_1.__importDefault)(require("ajv-formats"));
const ajv_errors_1 = (0, tslib_1.__importDefault)(require("ajv-errors"));
const json_1 = require("@stoplight/json");
const spectral_runtime_1 = require("@stoplight/spectral-runtime");
const ruleSchema = require("../meta/rule.schema.json");
const rulesetSchema = require("../meta/ruleset.schema.json");
const shared = require("../meta/shared.json");
const ruleSchema = (0, tslib_1.__importStar)(require("../meta/rule.schema.json"));
const rulesetSchema = (0, tslib_1.__importStar)(require("../meta/ruleset.schema.json"));
const shared = (0, tslib_1.__importStar)(require("../meta/shared.json"));
const message = (0, ajv_1._) `'spectral-message'`;

@@ -13,0 +14,0 @@ const ajv = new ajv_1.default({ allErrors: true, strict: true, strictRequired: false, keywords: ['$anchor', 'x-internal'] });

import { IGivenNode } from '../types';
import { IRunnerInternalContext } from './types';
import { Rule } from '../ruleset/rule/rule';
import { Rule } from '../ruleset/rule';
export declare const lintNode: (context: IRunnerInternalContext, node: IGivenNode, rule: Rule) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Runner = void 0;
const tslib_1 = require("tslib");
const utils_1 = require("../utils");
const lintNode_1 = require("./lintNode");
const legacy_1 = require("nimma/legacy");
const legacy_1 = (0, tslib_1.__importDefault)(require("nimma/legacy"));
const fallbacks_1 = require("nimma/fallbacks");

@@ -8,0 +9,0 @@ const json_1 = require("@stoplight/json");

@@ -7,3 +7,3 @@ "use strict";

const types_1 = require("@stoplight/types");
const Parsers = require("@stoplight/spectral-parsers");
const Parsers = (0, tslib_1.__importStar)(require("@stoplight/spectral-parsers"));
const spectral_ref_resolver_1 = require("@stoplight/spectral-ref-resolver");

@@ -10,0 +10,0 @@ const lodash_1 = require("lodash");

import type { JsonPath } from '@stoplight/types';
import type { IDocumentInventory } from '../documentInventory';
import type { IRule } from '../ruleset/rule/rule';
import type { IRule } from '../ruleset/rule';
import type { IDocument } from '../document';

@@ -5,0 +5,0 @@ import type { JSONSchema7 } from 'json-schema';

import { IDiagnostic, JsonPath } from '@stoplight/types';
import { JSONSchema7 } from 'json-schema';
import type { JSONSchema7 } from 'json-schema';
import type { Resolver } from '@stoplight/spectral-ref-resolver';

@@ -4,0 +4,0 @@ export interface IConstructorOpts {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Replacer = void 0;
const simple_eval_1 = require("simple-eval");
const tslib_1 = require("tslib");
const simple_eval_1 = (0, tslib_1.__importDefault)(require("simple-eval"));
class Replacer {

@@ -6,0 +7,0 @@ constructor(count) {

{
"name": "@stoplight/spectral-core",
"version": "1.8.1",
"version": "1.9.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc