New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@redocly/openapi-core

Package Overview
Dependencies
Maintainers
9
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redocly/openapi-core - npm Package Compare versions

Comparing version 1.0.0-beta.127 to 1.0.0-beta.128

lib/rules/common/spec-strict-refs.d.ts

18

lib/bundle.js

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

}
const resolvedRefMap = yield resolve_1.resolveDocument({
let resolvedRefMap = yield resolve_1.resolveDocument({
rootDocument: document,

@@ -83,4 +83,18 @@ rootType: types.Root,

});
if (preprocessors.length > 0) {
// Make additional pass to resolve refs defined in preprocessors.
walk_1.walkDocument({
document,
rootType: types.Root,
normalizedVisitors: visitors_1.normalizeVisitors(preprocessors, types),
resolvedRefMap,
ctx,
});
resolvedRefMap = yield resolve_1.resolveDocument({
rootDocument: document,
rootType: types.Root,
externalRefResolver,
});
}
const bundleVisitor = visitors_1.normalizeVisitors([
...preprocessors,
{

@@ -87,0 +101,0 @@ severity: 'error',

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

'scalar-property-missing-example': 'error',
'spec-strict-refs': 'error',
},

@@ -53,0 +54,0 @@ oas3_0Rules: {

10

lib/config/config-resolvers.js

@@ -78,2 +78,5 @@ "use strict";

catch (e) {
if (e instanceof SyntaxError) {
throw e;
}
throw new Error(`Failed to load plugin "${plugin}". Please provide a valid path`);

@@ -257,3 +260,6 @@ }

for (const [ruleKey, rule] of Object.entries(rules)) {
if (ruleKey.startsWith('assert/') && typeof rule === 'object' && rule !== null) {
// keep the old assert/ syntax as an alias
if ((ruleKey.startsWith('rule/') || ruleKey.startsWith('assert/')) &&
typeof rule === 'object' &&
rule !== null) {
const assertion = rule;

@@ -267,3 +273,3 @@ if (plugins) {

}
assertions.push(Object.assign(Object.assign({}, assertion), { assertionId: ruleKey.replace('assert/', '') }));
assertions.push(Object.assign(Object.assign({}, assertion), { assertionId: ruleKey.replace(/rule\/|assert\//, '') }));
}

@@ -270,0 +276,0 @@ else {

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

spec: 'error',
'spec-strict-refs': 'off',
},

@@ -36,0 +37,0 @@ oas3_0Rules: {

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

spec: 'error',
'spec-strict-refs': 'off',
},

@@ -36,0 +37,0 @@ oas3_0Rules: {

@@ -5,3 +5,3 @@ import type { ProblemSeverity, UserContext } from '../walk';

import { Location } from '../ref-utils';
import { SkipFunctionContext } from '../visitors';
import type { SkipFunctionContext } from '../visitors';
export declare type RuleSeverity = ProblemSeverity | 'off';

@@ -8,0 +8,0 @@ export declare type RuleSettings = {

@@ -194,8 +194,22 @@ "use strict";

const { styleguideConfig, rawConfigRest } = extractFlatConfig(rest);
return Object.assign({ theme: {
const transformedConfig = Object.assign({ theme: {
openapi: Object.assign(Object.assign(Object.assign({}, referenceDocs), rawConfig['features.openapi']), (_a = rawConfig.theme) === null || _a === void 0 ? void 0 : _a.openapi),
mockServer: Object.assign(Object.assign({}, rawConfig['features.mockServer']), (_b = rawConfig.theme) === null || _b === void 0 ? void 0 : _b.mockServer),
}, apis: transformApis(apis) || transformApiDefinitionsToApis(apiDefinitions), styleguide: styleguideConfig || lint }, rawConfigRest);
showDeprecationMessages(transformedConfig);
return transformedConfig;
}
exports.transformConfig = transformConfig;
function showDeprecationMessages(config) {
var _a, _b;
let allRules = Object.assign({}, (_a = config.styleguide) === null || _a === void 0 ? void 0 : _a.rules);
for (const api of Object.values(config.apis || {})) {
allRules = Object.assign(Object.assign({}, allRules), (_b = api === null || api === void 0 ? void 0 : api.styleguide) === null || _b === void 0 ? void 0 : _b.rules);
}
for (const ruleKey of Object.keys(allRules)) {
if (ruleKey.startsWith('assert/')) {
logger_1.logger.warn(`\nThe 'assert/' syntax in ${ruleKey} is deprecated. Update your configuration to use 'rule/' instead. Examples and more information: https://redocly.com/docs/cli/rules/configurable-rules/\n`);
}
}
}
function getResolveConfig(resolve) {

@@ -202,0 +216,0 @@ var _a, _b;

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

const regularRules = config_1.initRules(rules, config, 'rules', oasVersion);
const normalizedVisitors = visitors_1.normalizeVisitors([...preprocessors, ...regularRules], types);
const resolvedRefMap = yield resolve_1.resolveDocument({
let resolvedRefMap = yield resolve_1.resolveDocument({
rootDocument: document,

@@ -67,2 +66,18 @@ rootType: types.Root,

});
if (preprocessors.length > 0) {
// Make additional pass to resolve refs defined in preprocessors.
walk_1.walkDocument({
document,
rootType: types.Root,
normalizedVisitors: visitors_1.normalizeVisitors(preprocessors, types),
resolvedRefMap,
ctx,
});
resolvedRefMap = yield resolve_1.resolveDocument({
rootDocument: document,
rootType: types.Root,
externalRefResolver,
});
}
const normalizedVisitors = visitors_1.normalizeVisitors(regularRules, types);
walk_1.walkDocument({

@@ -69,0 +84,0 @@ document,

@@ -45,3 +45,4 @@ import { Oas2Rule } from '../../visitors';

'required-string-property-missing-min-length': import("../../visitors").Oas3Rule;
'spec-strict-refs': import("../../visitors").Oas3Rule | Oas2Rule;
};
export declare const preprocessors: {};

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

const required_string_property_missing_min_length_1 = require("../common/required-string-property-missing-min-length");
const spec_strict_refs_1 = require("../common/spec-strict-refs");
exports.rules = {

@@ -89,3 +90,4 @@ spec: spec_1.OasSpec,

'required-string-property-missing-min-length': required_string_property_missing_min_length_1.RequiredStringPropertyMissingMinLength,
'spec-strict-refs': spec_strict_refs_1.SpecStrictRefs,
};
exports.preprocessors = {};

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

const required_string_property_missing_min_length_1 = require("../common/required-string-property-missing-min-length");
const spec_strict_refs_1 = require("../common/spec-strict-refs");
exports.rules = {

@@ -109,3 +110,4 @@ spec: spec_1.OasSpec,

'required-string-property-missing-min-length': required_string_property_missing_min_length_1.RequiredStringPropertyMissingMinLength,
'spec-strict-refs': spec_strict_refs_1.SpecStrictRefs,
};
exports.preprocessors = {};

@@ -60,9 +60,4 @@ "use strict";

},
ExampleMap: {
Example(_node, { key, report, location }) {
validateKey(key, report, location, 'examples');
},
},
};
};
exports.SpecComponentsInvalidMapName = SpecComponentsInvalidMapName;

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

'required-string-property-missing-min-length',
'spec-strict-refs',
];

@@ -200,5 +201,9 @@ const nodeTypesList = [

additionalProperties: (value, key) => {
if (key.startsWith('assert/')) {
if (key.startsWith('rule/')) {
return 'Assert';
}
else if (key.startsWith('assert/')) {
// keep the old assert/ prefix as an alias
return 'Assert';
}
else if (builtInRulesList.includes(key) || utils_1.isCustomRuleId(key)) {

@@ -205,0 +210,0 @@ if (typeof value === 'string') {

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

function reportFn(ruleId, severity, opts) {
const loc = opts.location
const normalizedLocation = opts.location
? Array.isArray(opts.location)

@@ -263,7 +263,6 @@ ? opts.location

: [Object.assign(Object.assign({}, currentLocation), { reportOnKey: false })];
const location = normalizedLocation.map((l) => (Object.assign(Object.assign(Object.assign({}, currentLocation), { reportOnKey: false }), l)));
const ruleSeverity = opts.forceSeverity || severity;
if (ruleSeverity !== 'off') {
ctx.problems.push(Object.assign(Object.assign({ ruleId: opts.ruleId || ruleId, severity: ruleSeverity }, opts), { suggest: opts.suggest || [], location: loc.map((loc) => {
return Object.assign(Object.assign(Object.assign({}, currentLocation), { reportOnKey: false }), loc);
}) }));
ctx.problems.push(Object.assign(Object.assign({ ruleId: opts.ruleId || ruleId, severity: ruleSeverity }, opts), { suggest: opts.suggest || [], location }));
}

@@ -270,0 +269,0 @@ }

{
"name": "@redocly/openapi-core",
"version": "1.0.0-beta.127",
"version": "1.0.0-beta.128",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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