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

@stoplight/spectral

Package Overview
Dependencies
Maintainers
6
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/spectral - npm Package Compare versions

Comparing version 0.1.0-beta.3 to 0.1.0-beta.4

lib/rulesets/oas/functions/oasOpParams/__tests__/index.d.ts

7

lib/functions/alphabetical.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("./utils/ensureRule");
exports.alphabetical = function (object, r, ruleMeta) {
exports.alphabetical = function (opts) {
var results = [];
var _a = r.input, keyedBy = _a.keyedBy, inputProperties = _a.properties;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var _a = rule.input, keyedBy = _a.keyedBy, inputProperties = _a.properties;
var properties = inputProperties;

@@ -35,3 +36,3 @@ if (properties && !Array.isArray(properties)) {

object[property].should.be.deepEqual(arrayCopy);
}, ruleMeta);
}, meta);
if (res) {

@@ -38,0 +39,0 @@ results.push(res);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("./utils/ensureRule");
exports.maxLength = function (object, r, meta) {
exports.maxLength = function (opts) {
var results = [];
var _a = r.input, value = _a.value, property = _a.property;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var _a = rule.input, value = _a.value, property = _a.property;
var target;

@@ -8,0 +9,0 @@ if (property) {

@@ -7,10 +7,13 @@ "use strict";

};
exports.notContain = function (object, r, ruleMeta) {
exports.notContain = function (opts) {
var results = [];
var _a = r.input, value = _a.value, properties = _a.properties;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var _a = rule.input, value = _a.value, properties = _a.properties;
var _loop_1 = function (property) {
if (object && object.hasOwnProperty(property)) {
var res = ensureRule_1.ensureRule(function () {
object[property].should.be.a.String().and.not.match(regexFromString(value), r.description);
}, ruleMeta);
object[property].should.be.a
.String()
.and.not.match(regexFromString(value), rule.description);
}, meta);
if (res) {

@@ -17,0 +20,0 @@ results.push(res);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("./utils/ensureRule");
exports.notEndWith = function (object, r, ruleMeta) {
exports.notEndWith = function (opts) {
var results = [];
var _a = r.input, value = _a.value, property = _a.property;
var object = opts.object;
var rule = opts.rule, meta = opts.meta;
var _a = rule.input, value = _a.value, property = _a.property;
var process = function (target) {
var res = ensureRule_1.ensureRule(function () {
target.should.not.endWith(value);
}, ruleMeta);
}, meta);
if (res) {

@@ -12,0 +14,0 @@ results.push(res);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("./utils/ensureRule");
exports.or = function (object, r, ruleMeta) {
exports.or = function (opts) {
var results = [];
var properties = r.input.properties;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var properties = rule.input.properties;
var found = false;

@@ -16,4 +17,4 @@ for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {

var res = ensureRule_1.ensureRule(function () {
found.should.be.exactly(true, r.description);
}, ruleMeta);
found.should.be.exactly(true, rule.description);
}, meta);
if (res) {

@@ -20,0 +21,0 @@ results.push(res);

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

var should = require("should/as-function");
exports.pattern = function (object, r, ruleMeta) {
exports.pattern = function (opts) {
var results = [];
var _a = r.input, omit = _a.omit, property = _a.property, split = _a.split, value = _a.value;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var _a = rule.input, omit = _a.omit, property = _a.property, split = _a.split, value = _a.value;
// if the collected object is not an object/array, set our target to be

@@ -39,4 +40,4 @@ // the object itself

var res = ensureRule_1.ensureRule(function () {
should(re.test(component)).be.exactly(true, r.summary + ", but received: " + component);
}, ruleMeta);
should(re.test(component)).be.exactly(true, rule.summary + ", but received: " + component);
}, meta);
if (res) {

@@ -43,0 +44,0 @@ results.push(res);

@@ -16,5 +16,6 @@ "use strict";

ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema';
exports.schema = function (object, r, meta) {
exports.schema = function (opts) {
var results = [];
var schemaObj = r.input.schema;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var schemaObj = rule.input.schema;
// TODO: potential performance improvements (compile, etc)?

@@ -32,4 +33,4 @@ if (!ajv.validate(schemaObj, object) && ajv.errors) {

name: meta.name,
summary: r.summary,
severity: r.severity ? r.severity : types_1.RuleSeverity.ERROR,
summary: rule.summary,
severity: rule.severity ? rule.severity : types_1.RuleSeverity.ERROR,
message: e.message ? e.message : '',

@@ -36,0 +37,0 @@ });

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

var should = require("should/as-function");
exports.truthy = function (object, r, meta) {
exports.truthy = function (opts) {
var results = [];
var _a = r.input, inputProperties = _a.properties, max = _a.max;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var _a = rule.input, inputProperties = _a.properties, max = _a.max;
var properties = inputProperties;

@@ -11,0 +12,0 @@ if (!Array.isArray(properties))

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

var should = require("should");
exports.xor = function (object, r, ruleMeta) {
exports.xor = function (opts) {
var results = [];
var properties = r.input.properties;
var object = opts.object, rule = opts.rule, meta = opts.meta;
var properties = rule.input.properties;
var found = false;

@@ -15,4 +16,4 @@ for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {

var innerRes = ensureRule_1.ensureRule(function () {
should.fail(true, false, r.summary);
}, ruleMeta);
should.fail(true, false, rule.summary);
}, meta);
if (innerRes) {

@@ -26,4 +27,4 @@ results.push(innerRes);

var res = ensureRule_1.ensureRule(function () {
found.should.be.exactly(true, r.summary);
}, ruleMeta);
found.should.be.exactly(true, rule.summary);
}, meta);
if (res) {

@@ -30,0 +31,0 @@ results.push(res);

@@ -12,5 +12,26 @@ import * as types from './types';

interface IRunOpts {
/**
* The un-resolved object being parsed
*/
target: object;
/**
* The fully-resolved object being parsed
*/
resTarget?: object;
/**
* A stringified version of the target
*/
strTarget?: string;
/**
* The specification to apply to the target
*/
spec: string;
/**
* Optional ruleset to apply to the target. If not provided, the initialized ruleset will be used
* instead.
*/
rulesets?: types.IRuleset[];
/**
* Optional rule type, when supplied only rules of this type are run
*/
type?: types.RuleType;

@@ -26,3 +47,3 @@ }

setRules(rulesets: types.IRuleset[]): void;
run({ target, spec, rulesets, type }: IRunOpts): types.IRuleResult[];
run(opts: IRunOpts): types.IRuleResult[];
private _parseRuleDefinition;

@@ -29,0 +50,0 @@ private _rulesetToRules;

@@ -39,4 +39,4 @@ "use strict";

};
Spectral.prototype.run = function (_a) {
var target = _a.target, spec = _a.spec, _b = _a.rulesets, rulesets = _b === void 0 ? [] : _b, type = _a.type;
Spectral.prototype.run = function (opts) {
var target = opts.target, spec = opts.spec, _a = opts.rulesets, rulesets = _a === void 0 ? [] : _a, type = opts.type;
var results = [];

@@ -54,5 +54,5 @@ if (rulesets.length) {

continue;
for (var _i = 0, _c = this._paths[path]; _i < _c.length; _i++) {
var ruleName = _c[_i];
var _d = runRules[ruleName], rule = _d.rule, apply = _d.apply, format = _d.format;
for (var _i = 0, _b = this._paths[path]; _i < _b.length; _i++) {
var ruleName = _b[_i];
var _c = runRules[ruleName], rule = _c.rule, apply = _c.apply, format = _c.format;
if (!rule.enabled || (type && rule.type !== type) || format.indexOf(spec) === -1) {

@@ -69,11 +69,26 @@ continue;

var nodes = jp.nodes(target, path);
for (var _e = 0, nodes_1 = nodes; _e < nodes_1.length; _e++) {
var n = nodes_1[_e];
for (var _d = 0, nodes_1 = nodes; _d < nodes_1.length; _d++) {
var n = nodes_1[_d];
var nPath = n.path, value = n.value;
try {
var result = apply(value, rule, {
path: nPath,
name: ruleName,
var opt = {
object: value,
rule: rule,
});
meta: {
path: nPath,
name: ruleName,
rule: rule,
},
};
if (path === '$') {
// allow resolved and stringified targets to be passed to rules when operating on
// the root path
if (opts.resTarget) {
opt.resObj = opts.resTarget;
}
if (opts.strTarget) {
opt.strObj = opts.strTarget;
}
}
var result = apply(opt);
results.push.apply(results, result);

@@ -80,0 +95,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("../../../../functions/utils/ensureRule");
exports.oasOp2xxResponse = function (_object, _r, ruleMeta) {
exports.oasOp2xxResponse = function (opts) {
var results = [];
var responses = Object.keys(_object);
var object = opts.object, meta = opts.meta;
var responses = Object.keys(object);
var res = ensureRule_1.ensureRule(function () {

@@ -11,3 +12,3 @@ responses

.length.should.aboveOrEqual(1);
}, ruleMeta);
}, meta);
if (res)

@@ -14,0 +15,0 @@ results.push(res);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ensureRule_1 = require("../../../../functions/utils/ensureRule");
exports.oasOpFormDataConsumeCheck = function (_object, _r, ruleMeta) {
exports.oasOpFormDataConsumeCheck = function (opts) {
var results = [];
var operation = _object;
var object = opts.object, meta = opts.meta;
var operation = object;
var parameters = operation.parameters;

@@ -12,3 +13,3 @@ var consumes = operation.consumes || [];

consumes.should.matchAny(/(application\/x-www-form-urlencoded|multipart\/form-data)/);
}, ruleMeta);
}, meta);
if (res)

@@ -15,0 +16,0 @@ results.push(res);

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

var ensureRule_1 = require("../../../../functions/utils/ensureRule");
exports.oasOpIdUnique = function (_object, _r, ruleMeta) {
exports.oasOpIdUnique = function (opts) {
var results = [];
var _a = _object.paths, paths = _a === void 0 ? {} : _a;
var object = opts.object, meta = opts.meta;
var _a = object.paths, paths = _a === void 0 ? {} : _a;
var ids = [];

@@ -23,6 +24,6 @@ for (var path in paths) {

ids.forEach(function (operationId) {
var meta = tslib_1.__assign({}, ruleMeta, { path: operationId.path });
var m = tslib_1.__assign({}, meta, { path: operationId.path });
var res = ensureRule_1.ensureRule(function () {
ids.filter(function (id) { return id.operationId === operationId.operationId; }).length.should.equal(1);
}, meta);
}, m);
if (res) {

@@ -29,0 +30,0 @@ results.push(res);

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

var ensureRule_1 = require("../../../../functions/utils/ensureRule");
exports.oasOpSecurityDefined = function (_object, _r, ruleMeta) {
exports.oasOpSecurityDefined = function (opts) {
var results = [];
var _a = _object.paths, paths = _a === void 0 ? {} : _a, _b = _object.securityDefinitions, securityDefinitions = _b === void 0 ? {} : _b;
var object = opts.object, meta = opts.meta;
var _a = object.paths, paths = _a === void 0 ? {} : _a, _b = object.securityDefinitions, securityDefinitions = _b === void 0 ? {} : _b;
var allDefs = Object.keys(securityDefinitions);

@@ -18,6 +19,6 @@ for (var path in paths) {

var securityKey_1 = Object.keys(security[index])[0];
var meta = tslib_1.__assign({}, ruleMeta, { path: ['$', 'paths', path, operation, 'security', index] });
var m = tslib_1.__assign({}, meta, { path: ['$', 'paths', path, operation, 'security', index] });
var res = ensureRule_1.ensureRule(function () {
allDefs.should.containEql(securityKey_1);
}, meta);
}, m);
if (res) {

@@ -24,0 +25,0 @@ results.push(res);

@@ -24,3 +24,4 @@ "use strict";

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -38,3 +39,4 @@ '/foo': {

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -54,3 +56,4 @@ '/foo/{bar}': {

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -75,3 +78,4 @@ '/foo/{bar}': {

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -97,3 +101,4 @@ '/foo/{bar}': {

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -122,2 +127,3 @@ '/foo/{bar}': {

expect(results.length).toEqual(1);
expect(results[0].path).toEqual(['$', 'paths', '/foo/{bar}']);
expect(results[0].message).toContain('bar');

@@ -128,3 +134,4 @@ });

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -145,2 +152,3 @@ '/foo/{bar}/{bar}': {

expect(results.length).toEqual(1);
expect(results[0].path).toEqual(['$', 'paths', '/foo/{bar}/{bar}']);
expect(results[0].message).toContain('bar');

@@ -151,3 +159,4 @@ });

spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -168,7 +177,9 @@ '/foo/{bar}': {

expect(results.length).toEqual(1);
expect(results[0].path).toEqual(['$', 'paths', '/foo/{bar}', 'parameters']);
});
test.only('Error if paths are functionally equivalent', function () {
test('Error if paths are functionally equivalent', function () {
var results = s.run({
spec: 'oas2',
target: {
target: {},
resTarget: {
paths: {

@@ -199,4 +210,5 @@ '/foo/{boo}': {

expect(results.length).toEqual(1);
expect(results[0].path).toEqual(['$', 'paths']);
});
});
//# sourceMappingURL=index.js.map

@@ -5,4 +5,12 @@ "use strict";

var pathRegex = /(\{[a-zA-Z0-9_-]+\})+/g;
exports.oasPathParam = function (_object, _r, ruleMeta) {
exports.oasPathParam = function (opts) {
var results = [];
var object = opts.object;
var resObj = opts.resObj, rule = opts.rule, meta = opts.meta;
if (!resObj) {
console.warn('oasPathParam expects a resolved object, but none was provided. Results may not be correct.');
}
else {
object = resObj;
}
/**

@@ -15,6 +23,9 @@ * This rule verifies:

*/
if (!object.paths) {
return [];
}
// keep track of normalized paths for verifying paths are unique
var uniquePaths = {};
for (var path in _object) {
if (!_object[path])
for (var path in object.paths) {
if (!object.paths[path])
continue;

@@ -25,3 +36,3 @@ // verify normalized paths are functionally unique (ie `/path/{one}` vs `/path/{two}` are

if (uniquePaths[normalized]) {
results.push(generateResult("Paths " + uniquePaths[normalized] + " and " + path + " are functionally equivalent", ruleMeta.path.slice(), _r, ruleMeta));
results.push(generateResult("Paths " + uniquePaths[normalized] + " and " + path + " are functionally equivalent", meta.path.concat(['paths']), rule, meta));
}

@@ -38,3 +49,3 @@ else {

if (pathElements[p]) {
results.push(generateResult("Templated path parameter " + p + " is used multiple times.", ruleMeta.path.concat([path]), _r, ruleMeta));
results.push(generateResult("Templated path parameter " + p + " is used multiple times.", meta.path.concat(['paths', path]), rule, meta));
}

@@ -50,15 +61,15 @@ else {

var topParams = {};
if (_object[path].parameters) {
for (var _i = 0, _a = _object[path].parameters; _i < _a.length; _i++) {
if (object.paths[path].parameters) {
for (var _i = 0, _a = object.paths[path].parameters; _i < _a.length; _i++) {
var p = _a[_i];
if (p.in && p.in === 'path' && p.name) {
if (!p.required) {
results.push(generateResult("Path parameter " + p.name + " must have `required` set to `true`", ruleMeta.path.concat([path, 'parameters']), _r, ruleMeta));
results.push(generateResult("Path parameter " + p.name + " must have `required` set to `true`", meta.path.concat(['paths', path, 'parameters']), rule, meta));
}
if (topParams[p.name]) {
// name has already been specified
results.push(generateResult("Path parameter name '" + p.name + "' is used multiple times.", ruleMeta.path.concat([path, 'parameters']), _r, ruleMeta));
results.push(generateResult("Path parameter name '" + p.name + "' is used multiple times.", meta.path.concat(['paths', path, 'parameters']), rule, meta));
continue;
}
topParams[p.name] = [path, 'parameters'];
topParams[p.name] = meta.path.concat(['paths', path, 'parameters']);
}

@@ -69,4 +80,4 @@ }

var operationParams = {};
for (var op in _object[path]) {
if (!_object[path][op])
for (var op in object.paths[path]) {
if (!object.paths[path][op])
continue;

@@ -76,14 +87,14 @@ if (op === 'parameters') {

}
if (_object[path][op].parameters) {
if (object.paths[path][op].parameters) {
// temporary store for tracking parameters specified across operations (to make sure
// parameters are not defined multiple times under the same operation)
var tmp = {};
for (var _b = 0, _c = _object[path][op].parameters; _b < _c.length; _b++) {
for (var _b = 0, _c = object.paths[path][op].parameters; _b < _c.length; _b++) {
var p = _c[_b];
if (p.in && p.in === 'path' && p.name) {
if (!p.required) {
results.push(generateResult("Path parameter " + p.name + " must have `required` set to `true`", ruleMeta.path.concat([path, op, 'parameters']), _r, ruleMeta));
results.push(generateResult("Path parameter " + p.name + " must have `required` set to `true`", meta.path.concat(['paths', path, op, 'parameters']), rule, meta));
}
if (tmp[p.name]) {
results.push(generateResult("Operation parameter name '" + p.name + "' is used multiple times.", ruleMeta.path.concat([path, op, 'parameters']), _r, ruleMeta));
results.push(generateResult("Operation parameter name '" + p.name + "' is used multiple times.", meta.path.concat(['paths', path, op, 'parameters']), rule, meta));
continue;

@@ -95,3 +106,3 @@ }

tmp[p.name] = {};
operationParams[p.name] = [path, op];
operationParams[p.name] = ['paths', path, op];
}

@@ -106,6 +117,6 @@ }

if (!topParams[p] && !operationParams[p]) {
results.push(generateResult("Templated path parameter '" + p + "' does not have a corresponding parameter definition.", ruleMeta.path.concat([path]), _r, ruleMeta));
results.push(generateResult("Templated path parameter '" + p + "' does not have a corresponding parameter definition.", meta.path.concat(['paths', path]), rule, meta));
}
else if (topParams[p] && operationParams[p]) {
results.push(generateResult("Templated path parameter '" + p + "' has multiple definitions", ruleMeta.path.concat([path]), _r, ruleMeta));
results.push(generateResult("Templated path parameter '" + p + "' has multiple definitions", meta.path.concat(['paths', path]), rule, meta));
}

@@ -121,4 +132,4 @@ }

if (!pathElements[p]) {
var resPath = topParams[p];
results.push(generateResult("Parameter '" + p + "' does not have a corresponding path parameter template.", ruleMeta.path.concat(resPath), _r, ruleMeta));
var resPath = paramObj[p];
results.push(generateResult("Parameter '" + p + "' does not have a corresponding path parameter template.", meta.path.concat(resPath), rule, meta));
}

@@ -130,3 +141,3 @@ }

};
function generateResult(message, path, _r, _m) {
function generateResult(message, path, rule, _m) {
return {

@@ -136,7 +147,7 @@ message: message,

name: _m.name,
summary: _r.summary,
summary: rule.summary,
severity: _m.rule.severity ? _m.rule.severity : types_1.RuleSeverity.ERROR,
type: _r.type,
type: rule.type,
};
}
//# sourceMappingURL=index.js.map

@@ -13,14 +13,20 @@ "use strict";

oasOpIdUnique: require('./functions/oasOpIdUnique').oasOpIdUnique,
oasOpNoBodyFormData: require('./functions/oasOpNoBodyFormData').oasOpNoBodyFormData,
oasOpInBodyOne: require('./functions/oasOpInBodyOne').oasOpInBodyOne,
oasOpParametersUnique: require('./functions/oasOpParametersUnique').oasOpParametersUnique,
oasOpFormDataConsumeCheck: require('./functions/oasOpFormDataConsumeCheck')
.oasOpFormDataConsumeCheck,
oasOpParams: require('./functions/oasOpParams').oasOpParams,
},
rules: {
'oas2|oas3': {
'operation-parameters': {
enabled: true,
function: 'oasOpParams',
path: '$',
summary: 'Operation parameters are unique and non-repeating.',
type: types_1.RuleType.VALIDATION,
tags: ['operation'],
},
'operation-2xx-response': {
enabled: true,
function: 'oasOp2xxResponse',
path: "$..paths.*[?( name() !== 'parameters' )].responses",
path: exports.operationPath + ".responses",
summary: 'Operation must have at least one `2xx` response.',

@@ -46,30 +52,6 @@ type: types_1.RuleType.STYLE,

},
'operation-no-body-formData': {
enabled: true,
function: 'oasOpNoBodyFormData',
path: "$..paths.*[?( name() !== 'parameters' )].parameters",
summary: 'Operation cannot have both `in:body` and `in:formData` parameters.',
type: types_1.RuleType.VALIDATION,
tags: ['operation'],
},
'operation-in-body-one': {
enabled: true,
function: 'oasOpInBodyOne',
path: "$..paths.*[?( name() !== 'parameters' )].parameters",
summary: 'Operation must have only one `in:body` parameter.',
type: types_1.RuleType.VALIDATION,
tags: ['operation'],
},
'operation-parameters-unique': {
enabled: true,
function: 'oasOpParametersUnique',
path: "$..paths.*[?( name() !== 'parameters' )].parameters",
summary: 'Operations must have unique `name` + `in` parameters.',
type: types_1.RuleType.VALIDATION,
tags: ['operation'],
},
'operation-formData-consume-check': {
enabled: true,
function: 'oasOpFormDataConsumeCheck',
path: "$..paths.*[?( name() !== 'parameters' )]",
path: exports.operationPath,
summary: 'Operations with an `in: formData` parameter must include `application/x-www-form-urlencoded` or `multipart/form-data` in their consumes property.',

@@ -84,3 +66,3 @@ type: types_1.RuleType.VALIDATION,

severity: types_1.RuleSeverity.ERROR,
path: '$..paths',
path: '$',
function: 'oasPathParam',

@@ -101,3 +83,3 @@ tags: ['path'],

'example-value-or-externalValue': {
enabled: true,
enabled: false,
function: types_1.RuleFunction.XOR,

@@ -135,3 +117,3 @@ input: {

summary: 'API `license` must be present and non-empty string.',
enabled: true,
enabled: false,
function: types_1.RuleFunction.TRUTHY,

@@ -146,3 +128,3 @@ input: {

'license-apimatic-bug': {
enabled: true,
enabled: false,
function: types_1.RuleFunction.NOT_CONTAIN,

@@ -169,5 +151,5 @@ input: {

},
'model-examples': {
'model-description': {
summary: 'Definition `description` must be present and non-empty string.',
enabled: true,
enabled: false,
function: types_1.RuleFunction.TRUTHY,

@@ -181,3 +163,3 @@ input: {

'no-eval-in-descriptions': {
enabled: true,
enabled: false,
function: types_1.RuleFunction.NOT_CONTAIN,

@@ -205,3 +187,3 @@ input: {

summary: 'References should start with `#/`.',
enabled: true,
enabled: false,
function: types_1.RuleFunction.PATTERN,

@@ -227,3 +209,3 @@ input: {

'openapi-tags-alphabetical': {
enabled: true,
enabled: false,
function: types_1.RuleFunction.ALPHABETICAL,

@@ -240,4 +222,4 @@ input: {

'operation-default-response': {
summary: 'Operation must have a default response.',
enabled: true,
summary: 'Operations must have a default response.',
enabled: false,
function: types_1.RuleFunction.TRUTHY,

@@ -258,3 +240,3 @@ input: {

},
path: "$..paths.*[?( name() !== 'parameters' )]",
path: exports.operationPath,
type: types_1.RuleType.STYLE,

@@ -276,3 +258,3 @@ tags: ['operation'],

summary: 'Operation must have one and only one tag.',
enabled: true,
enabled: false,
function: types_1.RuleFunction.SCHEMA,

@@ -289,3 +271,3 @@ input: {

},
path: "$..paths.*[?( name() !== 'parameters' )].tags",
path: exports.operationPath + ".tags",
type: types_1.RuleType.STYLE,

@@ -296,3 +278,3 @@ tags: ['operation'],

summary: 'Operation `summary` should start with upper case and end with a dot.',
enabled: true,
enabled: false,
function: types_1.RuleFunction.PATTERN,

@@ -302,3 +284,3 @@ input: {

},
path: "$..paths.*[?( name() !== 'parameters' )].summary",
path: exports.operationPath + ".summary",
type: types_1.RuleType.STYLE,

@@ -330,3 +312,3 @@ tags: ['operation'],

'parameter-description': {
enabled: true,
enabled: false,
function: types_1.RuleFunction.TRUTHY,

@@ -333,0 +315,0 @@ input: {

@@ -9,3 +9,10 @@ /// <reference types="node" />

export declare type Path = Array<string | number>;
export declare type IRuleFunction<I = Rule> = (object: any, r: I, ruleMeta: IRuleMetadata) => IRuleResult[];
export interface IRuleOpts<I = Rule> {
object: any;
strObj?: string;
resObj?: any;
rule: I;
meta: IRuleMetadata;
}
export declare type IRuleFunction<I = Rule> = (opts: IRuleOpts<I>) => IRuleResult[];
export interface IRuleResult {

@@ -12,0 +19,0 @@ type: RuleType;

{
"name": "@stoplight/spectral",
"version": "0.1.0-beta.3",
"version": "0.1.0-beta.4",
"description": "An object linting framework",

@@ -5,0 +5,0 @@ "author": "Stoplight, Inc. (support@stoplight.io)",

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

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