@stoplight/spectral-core 1.13.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ruleset/alias.d.ts +3 -0
- package/dist/ruleset/alias.js +61 -0
- package/dist/ruleset/alias.js.map +1 -0
- package/dist/ruleset/function.d.ts +1 -1
- package/dist/ruleset/meta/rule.schema.json +63 -57
- package/dist/ruleset/meta/shared.json +20 -3
- package/dist/ruleset/rule.js +9 -55
- package/dist/ruleset/rule.js.map +1 -1
- package/dist/ruleset/utils/guards.d.ts +4 -2
- package/dist/ruleset/utils/guards.js +16 -2
- package/dist/ruleset/utils/guards.js.map +1 -1
- package/dist/ruleset/validation/ajv.js +26 -7
- package/dist/ruleset/validation/ajv.js.map +1 -1
- package/dist/ruleset/validation/errors.js +11 -2
- package/dist/ruleset/validation/errors.js.map +1 -1
- package/dist/ruleset/validation/validators/alias.d.ts +4 -0
- package/dist/ruleset/validation/validators/alias.js +37 -0
- package/dist/ruleset/validation/validators/alias.js.map +1 -0
- package/dist/ruleset/validation/validators/common/error.d.ts +1 -0
- package/dist/ruleset/validation/validators/common/error.js +24 -0
- package/dist/ruleset/validation/validators/common/error.js.map +1 -0
- package/dist/ruleset/validation/validators/function.d.ts +2 -0
- package/dist/ruleset/validation/validators/function.js +23 -0
- package/dist/ruleset/validation/validators/function.js.map +1 -0
- package/dist/types/function.d.ts +2 -2
- package/dist/utils/replacer.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RulesetScopedAliasDefinition } from './types';
|
|
2
|
+
export declare function resolveAliasForFormats({ targets }: RulesetScopedAliasDefinition, formats: Set<unknown> | null): string[] | null;
|
|
3
|
+
export declare function resolveAlias(aliases: Record<string, unknown> | null, expression: string, formats: Set<unknown> | null): string[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAlias = exports.resolveAliasForFormats = void 0;
|
|
4
|
+
const guards_1 = require("./utils/guards");
|
|
5
|
+
const ALIAS = /^#([A-Za-z0-9_-]+)/;
|
|
6
|
+
function resolveAliasForFormats({ targets }, formats) {
|
|
7
|
+
if (formats === null || formats.size === 0) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
for (let i = targets.length - 1; i >= 0; i--) {
|
|
11
|
+
const target = targets[i];
|
|
12
|
+
for (const format of target.formats) {
|
|
13
|
+
if (formats.has(format)) {
|
|
14
|
+
return target.given;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
exports.resolveAliasForFormats = resolveAliasForFormats;
|
|
21
|
+
function resolveAlias(aliases, expression, formats) {
|
|
22
|
+
return _resolveAlias(aliases, expression, formats, new Set());
|
|
23
|
+
}
|
|
24
|
+
exports.resolveAlias = resolveAlias;
|
|
25
|
+
function _resolveAlias(aliases, expression, formats, stack) {
|
|
26
|
+
var _a;
|
|
27
|
+
const resolvedExpressions = [];
|
|
28
|
+
if (expression.startsWith('#')) {
|
|
29
|
+
const alias = (_a = ALIAS.exec(expression)) === null || _a === void 0 ? void 0 : _a[1];
|
|
30
|
+
if (alias === void 0 || alias === null) {
|
|
31
|
+
throw new ReferenceError(`Alias must match /^#([A-Za-z0-9_-]+)/`);
|
|
32
|
+
}
|
|
33
|
+
if (stack.has(alias)) {
|
|
34
|
+
const _stack = [...stack, alias];
|
|
35
|
+
throw new ReferenceError(`Alias "${_stack[0]}" is circular. Resolution stack: ${_stack.join(' -> ')}`);
|
|
36
|
+
}
|
|
37
|
+
stack.add(alias);
|
|
38
|
+
if (aliases === null || !(alias in aliases)) {
|
|
39
|
+
throw new ReferenceError(`Alias "${alias}" does not exist`);
|
|
40
|
+
}
|
|
41
|
+
const aliasValue = aliases[alias];
|
|
42
|
+
let actualAliasValue;
|
|
43
|
+
if ((0, guards_1.isSimpleAliasDefinition)(aliasValue)) {
|
|
44
|
+
actualAliasValue = aliasValue;
|
|
45
|
+
}
|
|
46
|
+
else if ((0, guards_1.isScopedAliasDefinition)(aliasValue)) {
|
|
47
|
+
actualAliasValue = resolveAliasForFormats(aliasValue, formats);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
actualAliasValue = null;
|
|
51
|
+
}
|
|
52
|
+
if (actualAliasValue !== null) {
|
|
53
|
+
resolvedExpressions.push(...actualAliasValue.flatMap(item => _resolveAlias(aliases, item + expression.slice(alias.length + 1), formats, new Set([...stack]))));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
resolvedExpressions.push(expression);
|
|
58
|
+
}
|
|
59
|
+
return resolvedExpressions;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["../../src/ruleset/alias.ts"],"names":[],"mappings":";;;AAAA,2CAAkF;AAGlF,MAAM,KAAK,GAAG,oBAAoB,CAAC;AAEnC,SAAgB,sBAAsB,CACpC,EAAE,OAAO,EAAgC,EACzC,OAA4B;IAE5B,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC;KACb;IAGD,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;YACnC,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBACvB,OAAO,MAAM,CAAC,KAAK,CAAC;aACrB;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAnBD,wDAmBC;AAED,S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GAAG,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;SAChE;aAAM;YACL,gBAAgB,GAAG,IAAI,CAAC;SACzB;QAED,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC7B,mBAAmB,CAAC,IAAI,CACtB,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CACjC,aAAa,CAAC,OAAO,EAAE,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAChG,CACF,CAAC;SACH;KACF;SAAM;QACL,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACtC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -28,7 +28,7 @@ declare type Schema = ((Omit<JSONSchema, SchemaKeyedFragmentKeyword | SchemaFrag
|
|
|
28
28
|
dependencies?: SchemaDefinition | string[];
|
|
29
29
|
};
|
|
30
30
|
export declare type SchemaDefinition = Schema | boolean;
|
|
31
|
-
export declare function createRulesetFunction<I
|
|
31
|
+
export declare function createRulesetFunction<I, O>({ input, errorOnInvalidInput, options, }: {
|
|
32
32
|
input: Schema | null;
|
|
33
33
|
errorOnInvalidInput?: boolean;
|
|
34
34
|
options: Schema | null;
|
|
@@ -21,72 +21,78 @@
|
|
|
21
21
|
"$ref": "shared#severity"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
"if": {
|
|
25
|
+
"type": "object"
|
|
26
|
+
},
|
|
27
|
+
"then": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"description": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"documentationUrl": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"format": "url",
|
|
36
|
+
"errorMessage": "must be a valid URL"
|
|
37
|
+
},
|
|
38
|
+
"recommended": {
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
},
|
|
41
|
+
"given": {
|
|
42
|
+
"$ref": "shared#given"
|
|
43
|
+
},
|
|
44
|
+
"resolved": {
|
|
45
|
+
"type": "boolean"
|
|
46
|
+
},
|
|
47
|
+
"severity": {
|
|
48
|
+
"$ref": "#/$defs/Severity"
|
|
49
|
+
},
|
|
50
|
+
"message": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"tags": {
|
|
54
|
+
"items": {
|
|
48
55
|
"type": "string"
|
|
49
56
|
},
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
"type": "array"
|
|
58
|
+
},
|
|
59
|
+
"formats": {
|
|
60
|
+
"$ref": "shared#formats"
|
|
61
|
+
},
|
|
62
|
+
"then": {
|
|
63
|
+
"if": {
|
|
54
64
|
"type": "array"
|
|
55
65
|
},
|
|
56
|
-
"formats": {
|
|
57
|
-
"$ref": "shared#formats"
|
|
58
|
-
},
|
|
59
66
|
"then": {
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
"items": {
|
|
66
|
-
"$ref": "#/$defs/Then"
|
|
67
|
-
},
|
|
68
|
-
"type": "array"
|
|
69
|
-
}
|
|
70
|
-
]
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": {
|
|
69
|
+
"$ref": "#/$defs/Then"
|
|
70
|
+
}
|
|
71
71
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"type": "string",
|
|
75
|
-
"errorMessage": "allowed types are \"style\" and \"validation\""
|
|
72
|
+
"else": {
|
|
73
|
+
"$ref": "#/$defs/Then"
|
|
76
74
|
}
|
|
77
75
|
},
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"required": "the rule must have at least \"given\" and \"then\" properties"
|
|
76
|
+
"type": {
|
|
77
|
+
"enum": ["style", "validation"],
|
|
78
|
+
"type": "string",
|
|
79
|
+
"errorMessage": "allowed types are \"style\" and \"validation\""
|
|
83
80
|
}
|
|
84
81
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"type": "boolean"
|
|
82
|
+
"required": ["given", "then"],
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"errorMessage": {
|
|
85
|
+
"required": "the rule must have at least \"given\" and \"then\" properties"
|
|
90
86
|
}
|
|
91
|
-
|
|
87
|
+
},
|
|
88
|
+
"else": {
|
|
89
|
+
"oneOf": [
|
|
90
|
+
{
|
|
91
|
+
"$ref": "shared#/$defs/HumanReadableSeverity"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"type": "boolean"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
92
98
|
}
|
|
@@ -50,9 +50,26 @@
|
|
|
50
50
|
},
|
|
51
51
|
"PathExpression": {
|
|
52
52
|
"$id": "path-expression",
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
"if": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"then": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"if": {
|
|
59
|
+
"pattern": "^#"
|
|
60
|
+
},
|
|
61
|
+
"then": {
|
|
62
|
+
"x-spectral-runtime": "alias"
|
|
63
|
+
},
|
|
64
|
+
"else": {
|
|
65
|
+
"pattern": "^\\$",
|
|
66
|
+
"errorMessage": "must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"else": {
|
|
70
|
+
"not": {},
|
|
71
|
+
"errorMessage": "must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
|
|
72
|
+
}
|
|
56
73
|
}
|
|
57
74
|
}
|
|
58
75
|
}
|
package/dist/ruleset/rule.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var _Rule_severity, _Rule_enabled, _Rule_then, _Rule_given;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Rule = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -10,11 +10,10 @@ const spectral_runtime_1 = require("@stoplight/spectral-runtime");
|
|
|
10
10
|
const severity_1 = require("./utils/severity");
|
|
11
11
|
const minimatch_1 = require("./utils/minimatch");
|
|
12
12
|
const formats_1 = require("./formats");
|
|
13
|
-
const
|
|
14
|
-
const ALIAS = /^#([A-Za-z0-9_-]+)/;
|
|
13
|
+
const alias_1 = require("./alias");
|
|
15
14
|
class Rule {
|
|
16
15
|
constructor(name, definition, owner) {
|
|
17
|
-
var _b, _c
|
|
16
|
+
var _a, _b, _c;
|
|
18
17
|
this.name = name;
|
|
19
18
|
this.definition = definition;
|
|
20
19
|
this.owner = owner;
|
|
@@ -24,9 +23,9 @@ class Rule {
|
|
|
24
23
|
_Rule_given.set(this, void 0);
|
|
25
24
|
this.recommended = definition.recommended !== false;
|
|
26
25
|
(0, tslib_1.__classPrivateFieldSet)(this, _Rule_enabled, this.recommended, "f");
|
|
27
|
-
this.description = (
|
|
28
|
-
this.message = (
|
|
29
|
-
this.documentationUrl = (
|
|
26
|
+
this.description = (_a = definition.description) !== null && _a !== void 0 ? _a : null;
|
|
27
|
+
this.message = (_b = definition.message) !== null && _b !== void 0 ? _b : null;
|
|
28
|
+
this.documentationUrl = (_c = definition.documentationUrl) !== null && _c !== void 0 ? _c : null;
|
|
30
29
|
this.severity = definition.severity;
|
|
31
30
|
this.resolved = definition.resolved !== false;
|
|
32
31
|
this.formats = 'formats' in definition ? new formats_1.Formats(definition.formats) : null;
|
|
@@ -90,11 +89,11 @@ class Rule {
|
|
|
90
89
|
const actualGiven = Array.isArray(given) ? given : [given];
|
|
91
90
|
(0, tslib_1.__classPrivateFieldSet)(this, _Rule_given, this.owner.hasComplexAliases
|
|
92
91
|
? actualGiven
|
|
93
|
-
: actualGiven.flatMap(expr => (0,
|
|
92
|
+
: actualGiven.flatMap(expr => (0, alias_1.resolveAlias)(this.owner.aliases, expr, null)).filter(lodash_1.isString), "f");
|
|
94
93
|
}
|
|
95
94
|
getGivenForFormats(formats) {
|
|
96
95
|
return this.owner.hasComplexAliases
|
|
97
|
-
? (0, tslib_1.__classPrivateFieldGet)(this, _Rule_given, "f").flatMap(expr => (0,
|
|
96
|
+
? (0, tslib_1.__classPrivateFieldGet)(this, _Rule_given, "f").flatMap(expr => (0, alias_1.resolveAlias)(this.owner.aliases, expr, formats))
|
|
98
97
|
: (0, tslib_1.__classPrivateFieldGet)(this, _Rule_given, "f");
|
|
99
98
|
}
|
|
100
99
|
matchesFormat(formats) {
|
|
@@ -136,50 +135,5 @@ class Rule {
|
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
exports.Rule = Rule;
|
|
139
|
-
|
|
140
|
-
var _b;
|
|
141
|
-
const resolvedExpressions = [];
|
|
142
|
-
if (expr.startsWith('#')) {
|
|
143
|
-
const alias = (_b = ALIAS.exec(expr)) === null || _b === void 0 ? void 0 : _b[1];
|
|
144
|
-
if (alias === void 0 || alias === null) {
|
|
145
|
-
throw new ReferenceError(`"${this.name}" rule references an invalid alias`);
|
|
146
|
-
}
|
|
147
|
-
if (stack.has(alias)) {
|
|
148
|
-
const _stack = [...stack, alias];
|
|
149
|
-
throw new ReferenceError(`Alias "${_stack[0]}" is circular. Resolution stack: ${_stack.join(' -> ')}`);
|
|
150
|
-
}
|
|
151
|
-
stack.add(alias);
|
|
152
|
-
if (aliases === null || !(alias in aliases)) {
|
|
153
|
-
throw new ReferenceError(`Alias "${alias}" does not exist`);
|
|
154
|
-
}
|
|
155
|
-
const aliasValue = aliases[alias];
|
|
156
|
-
let actualAliasValue;
|
|
157
|
-
if ((0, guards_1.isSimpleAliasDefinition)(aliasValue)) {
|
|
158
|
-
actualAliasValue = aliasValue;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
actualAliasValue = (0, tslib_1.__classPrivateFieldGet)(Rule, _a, "m", _Rule_resolveAliasForFormats).call(Rule, aliasValue, formats);
|
|
162
|
-
}
|
|
163
|
-
if (actualAliasValue !== null) {
|
|
164
|
-
resolvedExpressions.push(...actualAliasValue.flatMap(item => (0, tslib_1.__classPrivateFieldGet)(Rule, _a, "m", _Rule_resolveAlias).call(Rule, aliases, item + expr.slice(alias.length + 1), formats, new Set([...stack]))));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
resolvedExpressions.push(expr);
|
|
169
|
-
}
|
|
170
|
-
return resolvedExpressions;
|
|
171
|
-
}, _Rule_resolveAliasForFormats = function _Rule_resolveAliasForFormats({ targets }, formats) {
|
|
172
|
-
if (formats === null || formats.size === 0) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
for (let i = targets.length - 1; i >= 0; i--) {
|
|
176
|
-
const target = targets[i];
|
|
177
|
-
for (const format of target.formats) {
|
|
178
|
-
if (formats.has(format)) {
|
|
179
|
-
return target.given;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return null;
|
|
184
|
-
};
|
|
138
|
+
_Rule_severity = new WeakMap(), _Rule_enabled = new WeakMap(), _Rule_then = new WeakMap(), _Rule_given = new WeakMap();
|
|
185
139
|
//# sourceMappingURL=rule.js.map
|
package/dist/ruleset/rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/ruleset/rule.ts"],"names":[],"mappings":";;;;;AAAA,mCAAkC;AAElC,0CAAoD;AACpD,0CAAgD;AAChD,kEAAyD;AAEzD,+CAAiF;
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/ruleset/rule.ts"],"names":[],"mappings":";;;;;AAAA,mCAAkC;AAElC,0CAAoD;AACpD,0CAAgD;AAChD,kEAAyD;AAEzD,+CAAiF;AAIjF,iDAA8C;AAC9C,uCAAoC;AACpC,mCAAuC;AAsBvC,MAAa,IAAI;IAYf,YACkB,IAAY,EACZ,UAA0B,EAC1B,KAAc;;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAgB;QAC1B,UAAK,GAAL,KAAK,CAAS;QAZhC,iCAA+B;QAG/B,gCAAkB;QAGlB,6BAAoB;QACpB,8BAAkB;QAOhB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,KAAK,KAAK,CAAC;QACpD,oCAAA,IAAI,iBAAY,IAAI,CAAC,WAAW,MAAA,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,MAAA,UAAU,CAAC,WAAW,mCAAI,IAAI,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,MAAA,UAAU,CAAC,OAAO,mCAAI,IAAI,CAAC;QAC1C,IAAI,CAAC,gBAAgB,GAAG,MAAA,UAAU,CAAC,gBAAgB,mCAAI,IAAI,CAAC;QAC5D,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,KAAK,KAAK,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChF,IAAI,CAAC,IAAI,GAAG,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I,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC3B,GAAG,IAAI,CAAC,QAAQ;gBAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;gBAC5B,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAA,6BAAU,EAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAC9F,CAAC,CAAC;YACH,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAC7F,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;SACrB,CAAC;IACJ,CAAC;CACF;AAxJD,oBAwJC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { RulesetScopedAliasDefinition } from '../types';
|
|
2
|
-
export declare function isSimpleAliasDefinition(alias:
|
|
1
|
+
import type { RulesetScopedAliasDefinition } from '../types';
|
|
2
|
+
export declare function isSimpleAliasDefinition(alias: unknown): alias is string[];
|
|
3
|
+
export declare function isValidAliasTarget(target: Record<string, unknown>): target is RulesetScopedAliasDefinition['targets'][number];
|
|
4
|
+
export declare function isScopedAliasDefinition(alias: unknown): alias is RulesetScopedAliasDefinition;
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSimpleAliasDefinition = void 0;
|
|
3
|
+
exports.isScopedAliasDefinition = exports.isValidAliasTarget = exports.isSimpleAliasDefinition = void 0;
|
|
4
|
+
const json_1 = require("@stoplight/json");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
4
6
|
function isSimpleAliasDefinition(alias) {
|
|
5
|
-
return
|
|
7
|
+
return Array.isArray(alias);
|
|
6
8
|
}
|
|
7
9
|
exports.isSimpleAliasDefinition = isSimpleAliasDefinition;
|
|
10
|
+
function isValidAliasTarget(target) {
|
|
11
|
+
const formats = target.formats;
|
|
12
|
+
if (!Array.isArray(formats) && !(formats instanceof Set)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return Array.isArray(target.given) && target.given.every(lodash_1.isString);
|
|
16
|
+
}
|
|
17
|
+
exports.isValidAliasTarget = isValidAliasTarget;
|
|
18
|
+
function isScopedAliasDefinition(alias) {
|
|
19
|
+
return (0, json_1.isPlainObject)(alias) && Array.isArray(alias.targets) && alias.targets.every(isValidAliasTarget);
|
|
20
|
+
}
|
|
21
|
+
exports.isScopedAliasDefinition = isScopedAliasDefinition;
|
|
8
22
|
//# sourceMappingURL=guards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../src/ruleset/utils/guards.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../src/ruleset/utils/guards.ts"],"names":[],"mappings":";;;AAAA,0CAAgD;AAChD,mCAAkC;AAGlC,SAAgB,uBAAuB,CAAC,KAAc;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAFD,0DAEC;AAED,SAAgB,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,GAAG,CAAC,EAAE;QACxD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAQ,CAAC,CAAC;AACrE,CAAC;AATD,gDASC;AAED,SAAgB,uBAAuB,CAAC,KAAc;IACpD,OAAO,IAAA,oBAAa,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;AACzG,CAAC;AAFD,0DAEC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createValidator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ajv_1 = (0, tslib_1.__importStar)(require("ajv"));
|
|
6
|
+
const names_1 = (0, tslib_1.__importDefault)(require("ajv/dist/compile/names"));
|
|
6
7
|
const ajv_formats_1 = (0, tslib_1.__importDefault)(require("ajv-formats"));
|
|
7
8
|
const ajv_errors_1 = (0, tslib_1.__importDefault)(require("ajv-errors"));
|
|
8
9
|
const ruleSchema = (0, tslib_1.__importStar)(require("../meta/rule.schema.json"));
|
|
@@ -10,7 +11,8 @@ const shared = (0, tslib_1.__importStar)(require("../meta/shared.json"));
|
|
|
10
11
|
const rulesetSchema = (0, tslib_1.__importStar)(require("../meta/ruleset.schema.json"));
|
|
11
12
|
const jsExtensions = (0, tslib_1.__importStar)(require("../meta/js-extensions.json"));
|
|
12
13
|
const jsonExtensions = (0, tslib_1.__importStar)(require("../meta/json-extensions.json"));
|
|
13
|
-
const
|
|
14
|
+
const alias_1 = require("./validators/alias");
|
|
15
|
+
const function_1 = require("./validators/function");
|
|
14
16
|
const validators = {
|
|
15
17
|
js: null,
|
|
16
18
|
json: null,
|
|
@@ -26,6 +28,7 @@ function createValidator(format) {
|
|
|
26
28
|
strictRequired: false,
|
|
27
29
|
keywords: ['$anchor'],
|
|
28
30
|
schemas: [ruleSchema, shared],
|
|
31
|
+
passContext: true,
|
|
29
32
|
});
|
|
30
33
|
(0, ajv_formats_1.default)(ajv);
|
|
31
34
|
(0, ajv_errors_1.default)(ajv);
|
|
@@ -34,10 +37,12 @@ function createValidator(format) {
|
|
|
34
37
|
schemaType: 'string',
|
|
35
38
|
error: {
|
|
36
39
|
message(cxt) {
|
|
37
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
return (0, ajv_1._) `${((_a = cxt.params) === null || _a === void 0 ? void 0 : _a.message) !== void 0 ? cxt.params.message : ''}`;
|
|
38
42
|
},
|
|
39
43
|
params(cxt) {
|
|
40
|
-
|
|
44
|
+
var _a;
|
|
45
|
+
return (0, ajv_1._) `{ errors: ${((_a = cxt.params) === null || _a === void 0 ? void 0 : _a.errors) !== void 0 && cxt.params.errors} || [] }`;
|
|
41
46
|
},
|
|
42
47
|
},
|
|
43
48
|
code(cxt) {
|
|
@@ -46,10 +51,20 @@ function createValidator(format) {
|
|
|
46
51
|
case 'format':
|
|
47
52
|
cxt.fail((0, ajv_1._) `typeof ${data} !== "function"`);
|
|
48
53
|
break;
|
|
49
|
-
case 'ruleset-function':
|
|
50
|
-
cxt.
|
|
51
|
-
cxt.
|
|
54
|
+
case 'ruleset-function': {
|
|
55
|
+
const fn = cxt.gen.const('spectralFunction', (0, ajv_1._) `this.validateFunction(${data}.function, ${data}.functionOptions === void 0 ? null : ${data}.functionOptions, ${names_1.default.instancePath})`);
|
|
56
|
+
cxt.gen.if((0, ajv_1._) `${fn} !== void 0`);
|
|
57
|
+
cxt.error(false, { errors: fn });
|
|
58
|
+
cxt.gen.endIf();
|
|
52
59
|
break;
|
|
60
|
+
}
|
|
61
|
+
case 'alias': {
|
|
62
|
+
const alias = cxt.gen.const('spectralAlias', (0, ajv_1._) `this.validateAlias(${names_1.default.rootData}, ${data}, ${names_1.default.instancePath})`);
|
|
63
|
+
cxt.gen.if((0, ajv_1._) `${alias} !== void 0`);
|
|
64
|
+
cxt.error(false, { errors: alias });
|
|
65
|
+
cxt.gen.endIf();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
53
68
|
}
|
|
54
69
|
},
|
|
55
70
|
});
|
|
@@ -59,7 +74,11 @@ function createValidator(format) {
|
|
|
59
74
|
else {
|
|
60
75
|
ajv.addSchema(jsonExtensions);
|
|
61
76
|
}
|
|
62
|
-
const validator = ajv.compile(rulesetSchema)
|
|
77
|
+
const validator = new Proxy(ajv.compile(rulesetSchema), {
|
|
78
|
+
apply(target, thisArg, args) {
|
|
79
|
+
return Reflect.apply(target, { validateAlias: alias_1.validateAlias, validateFunction: function_1.validateFunction }, args);
|
|
80
|
+
},
|
|
81
|
+
});
|
|
63
82
|
validators[format] = validator;
|
|
64
83
|
return validator;
|
|
65
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../../src/ruleset/validation/ajv.ts"],"names":[],"mappings":";;;;AAAA,wDAA+C;AAC/C,2EAAqC;AACrC,yEAAmC;AACnC,kFAAuD;AACvD,yEAA8C;AAC9C,wFAA6D;AAC7D,sFAA2D;AAC3D,0FAA+D;
|
|
1
|
+
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../../src/ruleset/validation/ajv.ts"],"names":[],"mappings":";;;;AAAA,wDAA+C;AAC/C,gFAA2C;AAC3C,2EAAqC;AACrC,yEAAmC;AACnC,kFAAuD;AACvD,yEAA8C;AAC9C,wFAA6D;AAC7D,sFAA2D;AAC3D,0FAA+D;AAC/D,8CAAmD;AACnD,oDAAyD;AAEzD,MAAM,UAAU,GAAwD;IACtE,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,SAAgB,eAAe,CAAC,MAAqB;IACnD,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,iBAAiB,KAAK,IAAI,EAAE;QAC9B,OAAO,iBAAiB,CAAC;KAC1B;IAED,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC;QAClB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,KAAK;QACrB,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,OAAO,EAAE,CA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|
exports.convertAjvErrors = exports.RulesetValidationError = void 0;
|
|
4
|
+
const isAggregateError_1 = require("../../guards/isAggregateError");
|
|
4
5
|
class RulesetValidationError extends Error {
|
|
5
6
|
constructor(message, path) {
|
|
6
7
|
super(message);
|
|
@@ -21,7 +22,9 @@ function convertAjvErrors(errors) {
|
|
|
21
22
|
const filteredErrors = [];
|
|
22
23
|
l: for (let i = 0; i < sortedErrors.length; i++) {
|
|
23
24
|
const error = sortedErrors[i];
|
|
24
|
-
const prevError =
|
|
25
|
+
const prevError = filteredErrors.length === 0 ? null : filteredErrors[filteredErrors.length - 1];
|
|
26
|
+
if (error.keyword === 'if')
|
|
27
|
+
continue;
|
|
25
28
|
if (GENERIC_INSTANCE_PATH.test(error.instancePath)) {
|
|
26
29
|
let x = 1;
|
|
27
30
|
while (i + x < sortedErrors.length) {
|
|
@@ -47,9 +50,15 @@ function convertAjvErrors(errors) {
|
|
|
47
50
|
return filteredErrors.flatMap(error => {
|
|
48
51
|
var _a;
|
|
49
52
|
return error.keyword === 'x-spectral-runtime'
|
|
50
|
-
? error.params.errors
|
|
53
|
+
? flatErrors(error.params.errors)
|
|
51
54
|
: new RulesetValidationError((_a = error.message) !== null && _a !== void 0 ? _a : 'unknown error', error.instancePath.slice(1).split('/'));
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
57
|
exports.convertAjvErrors = convertAjvErrors;
|
|
58
|
+
function flatErrors(error) {
|
|
59
|
+
if ((0, isAggregateError_1.isAggregateError)(error)) {
|
|
60
|
+
return error.errors.flatMap(flatErrors);
|
|
61
|
+
}
|
|
62
|
+
return error;
|
|
63
|
+
}
|
|
55
64
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/ruleset/validation/errors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/ruleset/validation/errors.ts"],"names":[],"mappings":";;;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E,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;KAAA,CACzG,CAAC;AACJ,CAAC;AA/CD,4CA+CC;AAED,SAAS,UAAU,CAAC,KAA8C;IAChE,IAAI,IAAA,mCAAgB,EAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;KACzC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAlias = void 0;
|
|
4
|
+
const json_1 = require("@stoplight/json");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const alias_1 = require("../../alias");
|
|
7
|
+
const formats_1 = require("../../formats");
|
|
8
|
+
const error_1 = require("./common/error");
|
|
9
|
+
function getOverrides(overrides, key) {
|
|
10
|
+
if (!Array.isArray(overrides))
|
|
11
|
+
return null;
|
|
12
|
+
const index = Number(key);
|
|
13
|
+
if (Number.isNaN(index))
|
|
14
|
+
return null;
|
|
15
|
+
if (index < 0 && index >= overrides.length)
|
|
16
|
+
return null;
|
|
17
|
+
const actualOverrides = overrides[index];
|
|
18
|
+
return (0, json_1.isPlainObject)(actualOverrides) && (0, json_1.isPlainObject)(actualOverrides.aliases) ? actualOverrides.aliases : null;
|
|
19
|
+
}
|
|
20
|
+
function validateAlias(ruleset, alias, path) {
|
|
21
|
+
try {
|
|
22
|
+
const parsedPath = path.slice(1).split('/');
|
|
23
|
+
const formats = (0, lodash_1.get)(ruleset, [...parsedPath.slice(0, parsedPath.indexOf('rules') + 2), 'formats']);
|
|
24
|
+
const aliases = parsedPath[0] === 'overrides'
|
|
25
|
+
? {
|
|
26
|
+
...ruleset.aliases,
|
|
27
|
+
...getOverrides(ruleset.overrides, parsedPath[1]),
|
|
28
|
+
}
|
|
29
|
+
: ruleset.aliases;
|
|
30
|
+
(0, alias_1.resolveAlias)(aliases !== null && aliases !== void 0 ? aliases : null, alias, Array.isArray(formats) ? new formats_1.Formats(formats) : null);
|
|
31
|
+
}
|
|
32
|
+
catch (ex) {
|
|
33
|
+
return (0, error_1.wrapError)(ex, path);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.validateAlias = validateAlias;
|
|
37
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["../../../../src/ruleset/validation/validators/alias.ts"],"names":[],"mappings":";;;AAAA,0CAAgD;AAChD,mCAA6B;AAC7B,uCAA2C;AAC3C,2CAAwC;AACxC,0CAA2C;AAE3C,SAAS,YAAY,CAAC,SAAkB,EAAE,GAAW;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAE3C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAExD,MAAM,eAAe,GAAY,SAAS,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,IAAA,oBAAa,EAAC,eAAe,CAAC,IAAI,IAAA,oBAAa,EAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACnH,CAAC;AAED,SAAgB,aAAa,CAC3B,OAAmF,EACnF,KAAa,EACb,IAAY;IAEZ,IAAI;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAY,IAAA,YAAG,EAAC,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QAE5G,MAAM,OAAO,GACX,UAAU,CAAC,CAAC,CAAC,KAAK,WAAW;YAC3B,CAAC,CAAC;gBACE,GAAG,OAAO,CAAC,OAAO;gBAClB,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;aAClD;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAEtB,IAAA,oBAAY,EAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,iBAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KAC5F;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,IAAA,iBAAS,EAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC5B;AACH,CAAC;AArBD,sCAqBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function wrapError(ex: unknown, path: string): Error;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const es_aggregate_error_1 = (0, tslib_1.__importDefault)(require("es-aggregate-error"));
|
|
7
|
+
const errors_1 = require("../../errors");
|
|
8
|
+
const isAggregateError_1 = require("../../../../guards/isAggregateError");
|
|
9
|
+
function toRulesetValidationError(ex) {
|
|
10
|
+
if (ex instanceof errors_1.RulesetValidationError) {
|
|
11
|
+
ex.path.unshift(...this);
|
|
12
|
+
return ex;
|
|
13
|
+
}
|
|
14
|
+
return new errors_1.RulesetValidationError((0, lodash_1.isError)(ex) ? ex.message : String(ex), [...this]);
|
|
15
|
+
}
|
|
16
|
+
function wrapError(ex, path) {
|
|
17
|
+
const parsedPath = path.slice(1).split('/');
|
|
18
|
+
if ((0, isAggregateError_1.isAggregateError)(ex)) {
|
|
19
|
+
return new es_aggregate_error_1.default(ex.errors.map(toRulesetValidationError, parsedPath));
|
|
20
|
+
}
|
|
21
|
+
return toRulesetValidationError.call(parsedPath, ex);
|
|
22
|
+
}
|
|
23
|
+
exports.wrapError = wrapError;
|
|
24
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../../src/ruleset/validation/validators/common/error.ts"],"names":[],"mappings":";;;;AAAA,mCAAiC;AACjC,yFAAgD;AAEhD,yCAAsD;AACtD,0EAAuE;AAEvE,SAAS,wBAAwB,CAA8B,EAAW;IACxE,IAAI,EAAE,YAAY,+BAAsB,EAAE;QACxC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QACzB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,IAAI,+BAAsB,CAAC,IAAA,gBAAO,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,SAAgB,SAAS,CAAC,EAAW,EAAE,IAAY;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5C,IAAI,IAAA,mCAAgB,EAAC,EAAE,CAAC,EAAE;QACxB,OAAO,IAAI,4BAAc,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC,CAAC;KAChF;IAED,OAAO,wBAAwB,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AARD,8BAQC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFunction = void 0;
|
|
4
|
+
const error_1 = require("./common/error");
|
|
5
|
+
function assertRulesetFunction(maybeRulesetFunction) {
|
|
6
|
+
if (typeof maybeRulesetFunction !== 'function') {
|
|
7
|
+
throw Error('Function is not defined');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function validateFunction(fn, opts, path) {
|
|
11
|
+
try {
|
|
12
|
+
assertRulesetFunction(fn);
|
|
13
|
+
if (!('validator' in fn))
|
|
14
|
+
return;
|
|
15
|
+
const validator = fn.validator.bind(fn);
|
|
16
|
+
validator(opts);
|
|
17
|
+
}
|
|
18
|
+
catch (ex) {
|
|
19
|
+
return (0, error_1.wrapError)(ex, path);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.validateFunction = validateFunction;
|
|
23
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../src/ruleset/validation/validators/function.ts"],"names":[],"mappings":";;;AACA,0CAA2C;AAE3C,SAAS,qBAAqB,CAC5B,oBAA6B;IAE7B,IAAI,OAAO,oBAAoB,KAAK,UAAU,EAAE;QAC9C,MAAM,KAAK,CAAC,yBAAyB,CAAC,CAAC;KACxC;AACH,CAAC;AAED,SAAgB,gBAAgB,CAC9B,EAA4D,EAC5D,IAAa,EACb,IAAY;IAEZ,IAAI;QACF,qBAAqB,CAAC,EAAE,CAAC,CAAC;QAE1B,IAAI,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC;YAAE,OAAO;QAEjC,MAAM,SAAS,GAA8C,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,SAAS,CAAC,IAAI,CAAC,CAAC;KACjB;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,IAAA,iBAAS,EAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC5B;AACH,CAAC;AAfD,4CAeC"}
|
package/dist/types/function.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { IDocumentInventory } from '../documentInventory';
|
|
|
3
3
|
import type { IRule } from '../ruleset/rule';
|
|
4
4
|
import type { IDocument } from '../document';
|
|
5
5
|
import type { JSONSchema7 } from 'json-schema';
|
|
6
|
-
export declare type RulesetFunction<I
|
|
6
|
+
export declare type RulesetFunction<I = unknown, O = unknown> = (input: I, options: O, context: RulesetFunctionContext) => void | IFunctionResult[] | Promise<void | IFunctionResult[]>;
|
|
7
7
|
export declare type RulesetFunctionContext = {
|
|
8
8
|
path: JsonPath;
|
|
9
9
|
document: IDocument;
|
|
@@ -11,7 +11,7 @@ export declare type RulesetFunctionContext = {
|
|
|
11
11
|
rule: IRule;
|
|
12
12
|
};
|
|
13
13
|
export declare type IFunction = RulesetFunction;
|
|
14
|
-
export declare type RulesetFunctionWithValidator<I
|
|
14
|
+
export declare type RulesetFunctionWithValidator<I = unknown, O = unknown> = RulesetFunction<I, O> & {
|
|
15
15
|
validator<O = unknown>(options: unknown): asserts options is O;
|
|
16
16
|
readonly schemas: Readonly<{
|
|
17
17
|
input: Readonly<JSONSchema7> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replacer.js","sourceRoot":"","sources":["../../src/utils/replacer.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"replacer.js","sourceRoot":"","sources":["../../src/utils/replacer.ts"],"names":[],"mappings":";;;;AACA,2EAAgC;AAIhC,MAAa,QAAQ;IAInB,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC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