@redocly/openapi-core 1.0.0-beta.127 → 1.0.0-beta.129
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/lib/bundle.js +16 -2
- package/lib/config/all.js +1 -0
- package/lib/config/config-resolvers.js +8 -2
- package/lib/config/config.d.ts +2 -1
- package/lib/config/config.js +1 -0
- package/lib/config/minimal.js +1 -0
- package/lib/config/recommended.js +1 -0
- package/lib/config/types.d.ts +13 -1
- package/lib/config/types.js +13 -0
- package/lib/config/utils.js +15 -1
- package/lib/lint.js +17 -2
- package/lib/rules/common/assertions/index.js +3 -4
- package/lib/rules/common/spec-strict-refs.d.ts +2 -0
- package/lib/rules/common/spec-strict-refs.js +30 -0
- package/lib/rules/oas2/index.d.ts +1 -0
- package/lib/rules/oas2/index.js +2 -0
- package/lib/rules/oas3/index.js +2 -0
- package/lib/rules/oas3/spec-components-invalid-map-name.js +0 -5
- package/lib/types/config-external-schemas.d.ts +1619 -0
- package/lib/types/config-external-schemas.js +736 -0
- package/lib/types/redocly-yaml.js +11 -8
- package/lib/walk.js +3 -4
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConfigTypes = void 0;
|
|
4
|
+
const config_external_schemas_1 = require("./config-external-schemas");
|
|
4
5
|
const _1 = require(".");
|
|
5
6
|
const utils_1 = require("../utils");
|
|
6
7
|
const builtInRulesList = [
|
|
@@ -56,6 +57,7 @@ const builtInRulesList = [
|
|
|
56
57
|
'scalar-property-missing-example',
|
|
57
58
|
'spec-components-invalid-map-name',
|
|
58
59
|
'required-string-property-missing-min-length',
|
|
60
|
+
'spec-strict-refs',
|
|
59
61
|
];
|
|
60
62
|
const nodeTypesList = [
|
|
61
63
|
'any',
|
|
@@ -147,7 +149,7 @@ const RootConfigStyleguide = {
|
|
|
147
149
|
} }, ConfigStyleguide.properties),
|
|
148
150
|
};
|
|
149
151
|
const ConfigRoot = {
|
|
150
|
-
properties: Object.assign(Object.assign({ organization: { type: 'string' }, apis: 'ConfigApis' }, RootConfigStyleguide.properties), { theme: 'ConfigRootTheme', 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', region: { enum: ['us', 'eu'] }, resolve: {
|
|
152
|
+
properties: Object.assign(Object.assign({ organization: { type: 'string' }, apis: 'ConfigApis' }, RootConfigStyleguide.properties), { theme: 'ConfigRootTheme', 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', region: { enum: ['us', 'eu'] }, telemetry: { enum: ['on', 'off'] }, resolve: {
|
|
151
153
|
properties: {
|
|
152
154
|
http: 'ConfigHTTP',
|
|
153
155
|
doNotResolveExamples: { type: 'boolean' },
|
|
@@ -157,7 +159,7 @@ const ConfigRoot = {
|
|
|
157
159
|
items: {
|
|
158
160
|
type: 'string',
|
|
159
161
|
},
|
|
160
|
-
} }),
|
|
162
|
+
}, redirects: { type: 'object', additionalProperties: config_external_schemas_1.redirectConfigSchema }, licenseKey: { type: 'string' }, seo: config_external_schemas_1.seoConfigSchema, rbac: config_external_schemas_1.rbacConfigSchema, responseHeaders: config_external_schemas_1.responseHeaderSchema, mockServer: config_external_schemas_1.mockServerConfigSchema, sso: config_external_schemas_1.ssoConfigSchema, developerOnboarding: config_external_schemas_1.devOnboardingConfigSchema, scorecard: config_external_schemas_1.scorecardConfigSchema, i18n: config_external_schemas_1.i18nConfigSchema }),
|
|
161
163
|
};
|
|
162
164
|
const ConfigApis = {
|
|
163
165
|
properties: {},
|
|
@@ -174,7 +176,7 @@ const ConfigApisProperties = {
|
|
|
174
176
|
items: {
|
|
175
177
|
type: 'string',
|
|
176
178
|
},
|
|
177
|
-
} }),
|
|
179
|
+
}, title: { type: 'string' }, rbac: { type: 'object' }, metadata: { type: 'object' } }),
|
|
178
180
|
required: ['root'],
|
|
179
181
|
};
|
|
180
182
|
const ConfigHTTP = {
|
|
@@ -188,15 +190,16 @@ const ConfigHTTP = {
|
|
|
188
190
|
},
|
|
189
191
|
};
|
|
190
192
|
const ConfigRootTheme = {
|
|
191
|
-
properties: {
|
|
192
|
-
openapi: 'ConfigReferenceDocs',
|
|
193
|
-
mockServer: 'ConfigMockServer',
|
|
194
|
-
},
|
|
193
|
+
properties: Object.assign(Object.assign({}, config_external_schemas_1.themeConfigSchema.properties), { openapi: 'ConfigReferenceDocs', mockServer: 'ConfigMockServer' }),
|
|
195
194
|
};
|
|
196
195
|
const Rules = {
|
|
197
196
|
properties: {},
|
|
198
197
|
additionalProperties: (value, key) => {
|
|
199
|
-
if (key.startsWith('
|
|
198
|
+
if (key.startsWith('rule/')) {
|
|
199
|
+
return 'Assert';
|
|
200
|
+
}
|
|
201
|
+
else if (key.startsWith('assert/')) {
|
|
202
|
+
// keep the old assert/ prefix as an alias
|
|
200
203
|
return 'Assert';
|
|
201
204
|
}
|
|
202
205
|
else if (builtInRulesList.includes(key) || utils_1.isCustomRuleId(key)) {
|
package/lib/walk.js
CHANGED
|
@@ -254,16 +254,15 @@ function walkDocument(opts) {
|
|
|
254
254
|
}, collectParents(context), context);
|
|
255
255
|
}
|
|
256
256
|
function reportFn(ruleId, severity, opts) {
|
|
257
|
-
const
|
|
257
|
+
const normalizedLocation = opts.location
|
|
258
258
|
? Array.isArray(opts.location)
|
|
259
259
|
? opts.location
|
|
260
260
|
: [opts.location]
|
|
261
261
|
: [Object.assign(Object.assign({}, currentLocation), { reportOnKey: false })];
|
|
262
|
+
const location = normalizedLocation.map((l) => (Object.assign(Object.assign(Object.assign({}, currentLocation), { reportOnKey: false }), l)));
|
|
262
263
|
const ruleSeverity = opts.forceSeverity || severity;
|
|
263
264
|
if (ruleSeverity !== 'off') {
|
|
264
|
-
ctx.problems.push(Object.assign(Object.assign({ ruleId: opts.ruleId || ruleId, severity: ruleSeverity }, opts), { suggest: opts.suggest || [], location
|
|
265
|
-
return Object.assign(Object.assign(Object.assign({}, currentLocation), { reportOnKey: false }), loc);
|
|
266
|
-
}) }));
|
|
265
|
+
ctx.problems.push(Object.assign(Object.assign({ ruleId: opts.ruleId || ruleId, severity: ruleSeverity }, opts), { suggest: opts.suggest || [], location }));
|
|
267
266
|
}
|
|
268
267
|
}
|
|
269
268
|
function getVisitorDataFn(ruleId) {
|