@redocly/openapi-core 1.3.0 → 1.4.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/CHANGELOG.md +6 -0
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +4 -4
- package/lib/benchmark/benches/recommended-oas3.bench.js +4 -4
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +3 -3
- package/lib/benchmark/utils.js +3 -3
- package/lib/bundle.d.ts +4 -4
- package/lib/bundle.js +23 -23
- package/lib/config/all.d.ts +2 -2
- package/lib/config/all.js +44 -8
- package/lib/config/builtIn.js +2 -0
- package/lib/config/config-resolvers.js +25 -25
- package/lib/config/config.js +9 -9
- package/lib/config/index.js +5 -1
- package/lib/config/load.d.ts +1 -1
- package/lib/config/load.js +6 -6
- package/lib/config/minimal.d.ts +2 -2
- package/lib/config/minimal.js +34 -3
- package/lib/config/recommended-strict.d.ts +3 -0
- package/lib/config/recommended-strict.js +92 -0
- package/lib/config/recommended.d.ts +2 -2
- package/lib/config/recommended.js +34 -3
- package/lib/config/rules.d.ts +1 -1
- package/lib/config/types.d.ts +47 -46
- package/lib/config/types.js +2 -2
- package/lib/config/utils.js +26 -14
- package/lib/decorators/common/filters/filter-helper.js +4 -4
- package/lib/decorators/common/filters/filter-in.js +2 -2
- package/lib/decorators/common/filters/filter-out.js +2 -2
- package/lib/decorators/common/info-description-override.js +1 -1
- package/lib/decorators/common/media-type-examples-override.js +3 -3
- package/lib/decorators/common/operation-description-override.js +1 -1
- package/lib/decorators/common/registry-dependencies.js +1 -1
- package/lib/decorators/common/remove-x-internal.js +4 -4
- package/lib/decorators/common/tag-description-override.js +1 -1
- package/lib/format/codeframes.d.ts +6 -6
- package/lib/format/format.d.ts +2 -2
- package/lib/format/format.js +12 -12
- package/lib/js-yaml/index.d.ts +2 -2
- package/lib/js-yaml/index.js +2 -2
- package/lib/lint.js +18 -18
- package/lib/oas-types.d.ts +12 -10
- package/lib/oas-types.js +2 -2
- package/lib/redocly/index.js +10 -10
- package/lib/redocly/registry-api.js +2 -2
- package/lib/resolve.d.ts +4 -4
- package/lib/resolve.js +18 -18
- package/lib/rules/ajv.js +1 -1
- package/lib/rules/async2/index.d.ts +2 -11
- package/lib/rules/common/assertions/asserts.d.ts +3 -3
- package/lib/rules/common/assertions/asserts.js +21 -21
- package/lib/rules/common/assertions/index.d.ts +4 -4
- package/lib/rules/common/assertions/index.js +3 -3
- package/lib/rules/common/assertions/utils.d.ts +4 -4
- package/lib/rules/common/assertions/utils.js +3 -3
- package/lib/rules/common/info-contact.js +1 -1
- package/lib/rules/common/info-license-url.js +1 -1
- package/lib/rules/common/info-license.js +1 -1
- package/lib/rules/common/no-enum-type-mismatch.js +3 -3
- package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
- package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
- package/lib/rules/common/no-invalid-schema-examples.js +3 -3
- package/lib/rules/common/operation-2xx-response.js +2 -2
- package/lib/rules/common/operation-4xx-response.js +2 -2
- package/lib/rules/common/operation-description.js +1 -1
- package/lib/rules/common/operation-operationId.js +1 -1
- package/lib/rules/common/operation-summary.js +1 -1
- package/lib/rules/common/path-segment-plural.js +1 -1
- package/lib/rules/common/response-contains-header.js +2 -2
- package/lib/rules/common/spec-strict-refs.js +1 -1
- package/lib/rules/common/spec.js +11 -11
- package/lib/rules/common/tag-description.js +1 -1
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
- package/lib/rules/oas2/index.d.ts +2 -46
- package/lib/rules/oas2/remove-unused-components.js +1 -1
- package/lib/rules/oas2/request-mime-type.js +2 -2
- package/lib/rules/oas2/response-contains-property.js +2 -2
- package/lib/rules/oas2/response-mime-type.js +2 -2
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
- package/lib/rules/oas3/index.d.ts +1 -1
- package/lib/rules/oas3/index.js +1 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
- package/lib/rules/oas3/remove-unused-components.js +2 -2
- package/lib/rules/oas3/request-mime-type.js +3 -3
- package/lib/rules/oas3/response-contains-property.js +2 -2
- package/lib/rules/oas3/response-mime-type.js +3 -3
- package/lib/rules/utils.js +3 -3
- package/lib/types/asyncapi.js +21 -21
- package/lib/types/index.d.ts +8 -8
- package/lib/types/oas2.js +14 -14
- package/lib/types/oas3.js +27 -27
- package/lib/types/oas3_1.js +6 -6
- package/lib/types/redocly-yaml.d.ts +11 -0
- package/lib/types/redocly-yaml.js +71 -53
- package/lib/types/theme-config.js +1 -1
- package/lib/typings/common.d.ts +2 -2
- package/lib/typings/openapi.d.ts +6 -6
- package/lib/typings/swagger.d.ts +3 -3
- package/lib/utils.d.ts +5 -5
- package/lib/utils.js +3 -3
- package/lib/visitors.d.ts +40 -40
- package/lib/walk.d.ts +14 -15
- package/lib/walk.js +11 -11
- package/package.json +2 -2
- package/src/__tests__/lint.test.ts +40 -40
- package/src/__tests__/normalizeVisitors.test.ts +23 -5
- package/src/__tests__/ref-utils.test.ts +7 -7
- package/src/__tests__/resolve-http.test.ts +10 -10
- package/src/__tests__/resolve.test.ts +39 -39
- package/src/__tests__/walk.test.ts +48 -48
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
- package/src/config/__tests__/config-resolvers.test.ts +30 -1
- package/src/config/__tests__/config.test.ts +88 -88
- package/src/config/__tests__/load.test.ts +12 -8
- package/src/config/__tests__/utils.test.ts +18 -18
- package/src/config/all.ts +46 -9
- package/src/config/builtIn.ts +2 -0
- package/src/config/minimal.ts +36 -4
- package/src/config/recommended-strict.ts +93 -0
- package/src/config/recommended.ts +36 -4
- package/src/config/types.ts +22 -8
- package/src/config/utils.ts +15 -0
- package/src/decorators/common/media-type-examples-override.ts +2 -2
- package/src/lint.ts +3 -3
- package/src/oas-types.ts +26 -3
- package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
- package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
- package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
- package/src/rules/async2/index.ts +2 -1
- package/src/rules/common/__tests__/info-license.test.ts +6 -6
- package/src/rules/common/__tests__/license-url.test.ts +6 -6
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
- package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
- package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
- package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
- package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
- package/src/rules/common/__tests__/security-defined.test.ts +21 -21
- package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
- package/src/rules/common/__tests__/spec.test.ts +102 -102
- package/src/rules/common/__tests__/tag-description.test.ts +6 -6
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
- package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
- package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
- package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
- package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
- package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
- package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
- package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
- package/src/rules/oas2/index.ts +3 -1
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
- package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
- package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
- package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
- package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
- package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
- package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
- package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
- package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
- package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
- package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
- package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
- package/src/rules/oas3/index.ts +3 -3
- package/src/types/redocly-yaml.ts +75 -40
- package/src/visitors.ts +3 -3
- package/src/walk.ts +23 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -38,7 +38,7 @@ function resolveConfig(rawConfig, configPath) {
|
|
|
38
38
|
if ((_b = (_a = rawConfig.styleguide) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.some(utils_3.isNotString)) {
|
|
39
39
|
throw new Error(`Error configuration format not detected in extends value must contain strings`);
|
|
40
40
|
}
|
|
41
|
-
const resolver = new resolve_1.BaseResolver(utils_2.getResolveConfig(rawConfig.resolve));
|
|
41
|
+
const resolver = new resolve_1.BaseResolver((0, utils_2.getResolveConfig)(rawConfig.resolve));
|
|
42
42
|
const apis = yield resolveApis({
|
|
43
43
|
rawConfig,
|
|
44
44
|
configPath,
|
|
@@ -59,11 +59,11 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
59
59
|
return [];
|
|
60
60
|
// TODO: implement or reuse Resolver approach so it will work in node and browser envs
|
|
61
61
|
const requireFunc = (plugin) => {
|
|
62
|
-
if (env_1.isBrowser && utils_3.isString(plugin)) {
|
|
62
|
+
if (env_1.isBrowser && (0, utils_3.isString)(plugin)) {
|
|
63
63
|
logger_1.logger.error(`Cannot load ${plugin}. Plugins aren't supported in browser yet.`);
|
|
64
64
|
return undefined;
|
|
65
65
|
}
|
|
66
|
-
if (utils_3.isString(plugin)) {
|
|
66
|
+
if ((0, utils_3.isString)(plugin)) {
|
|
67
67
|
try {
|
|
68
68
|
const absoltePluginPath = path.resolve(path.dirname(configPath), plugin);
|
|
69
69
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -86,7 +86,7 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
86
86
|
const seenPluginIds = new Map();
|
|
87
87
|
return plugins
|
|
88
88
|
.map((p) => {
|
|
89
|
-
if (utils_3.isString(p) && ref_utils_1.isAbsoluteUrl(p)) {
|
|
89
|
+
if ((0, utils_3.isString)(p) && (0, ref_utils_1.isAbsoluteUrl)(p)) {
|
|
90
90
|
throw new Error(logger_1.colorize.red(`We don't support remote plugins yet.`));
|
|
91
91
|
}
|
|
92
92
|
// TODO: resolve npm packages similar to eslint
|
|
@@ -110,13 +110,13 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
110
110
|
}
|
|
111
111
|
plugin.rules = {};
|
|
112
112
|
if (pluginModule.rules.oas3) {
|
|
113
|
-
plugin.rules.oas3 = utils_2.prefixRules(pluginModule.rules.oas3, id);
|
|
113
|
+
plugin.rules.oas3 = (0, utils_2.prefixRules)(pluginModule.rules.oas3, id);
|
|
114
114
|
}
|
|
115
115
|
if (pluginModule.rules.oas2) {
|
|
116
|
-
plugin.rules.oas2 = utils_2.prefixRules(pluginModule.rules.oas2, id);
|
|
116
|
+
plugin.rules.oas2 = (0, utils_2.prefixRules)(pluginModule.rules.oas2, id);
|
|
117
117
|
}
|
|
118
118
|
if (pluginModule.rules.async2) {
|
|
119
|
-
plugin.rules.async2 = utils_2.prefixRules(pluginModule.rules.async2, id);
|
|
119
|
+
plugin.rules.async2 = (0, utils_2.prefixRules)(pluginModule.rules.async2, id);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
if (pluginModule.preprocessors) {
|
|
@@ -127,13 +127,13 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
127
127
|
}
|
|
128
128
|
plugin.preprocessors = {};
|
|
129
129
|
if (pluginModule.preprocessors.oas3) {
|
|
130
|
-
plugin.preprocessors.oas3 = utils_2.prefixRules(pluginModule.preprocessors.oas3, id);
|
|
130
|
+
plugin.preprocessors.oas3 = (0, utils_2.prefixRules)(pluginModule.preprocessors.oas3, id);
|
|
131
131
|
}
|
|
132
132
|
if (pluginModule.preprocessors.oas2) {
|
|
133
|
-
plugin.preprocessors.oas2 = utils_2.prefixRules(pluginModule.preprocessors.oas2, id);
|
|
133
|
+
plugin.preprocessors.oas2 = (0, utils_2.prefixRules)(pluginModule.preprocessors.oas2, id);
|
|
134
134
|
}
|
|
135
135
|
if (pluginModule.preprocessors.async2) {
|
|
136
|
-
plugin.preprocessors.async2 = utils_2.prefixRules(pluginModule.preprocessors.async2, id);
|
|
136
|
+
plugin.preprocessors.async2 = (0, utils_2.prefixRules)(pluginModule.preprocessors.async2, id);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
if (pluginModule.decorators) {
|
|
@@ -144,13 +144,13 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
144
144
|
}
|
|
145
145
|
plugin.decorators = {};
|
|
146
146
|
if (pluginModule.decorators.oas3) {
|
|
147
|
-
plugin.decorators.oas3 = utils_2.prefixRules(pluginModule.decorators.oas3, id);
|
|
147
|
+
plugin.decorators.oas3 = (0, utils_2.prefixRules)(pluginModule.decorators.oas3, id);
|
|
148
148
|
}
|
|
149
149
|
if (pluginModule.decorators.oas2) {
|
|
150
|
-
plugin.decorators.oas2 = utils_2.prefixRules(pluginModule.decorators.oas2, id);
|
|
150
|
+
plugin.decorators.oas2 = (0, utils_2.prefixRules)(pluginModule.decorators.oas2, id);
|
|
151
151
|
}
|
|
152
152
|
if (pluginModule.decorators.async2) {
|
|
153
|
-
plugin.decorators.async2 = utils_2.prefixRules(pluginModule.decorators.async2, id);
|
|
153
|
+
plugin.decorators.async2 = (0, utils_2.prefixRules)(pluginModule.decorators.async2, id);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
if (pluginModule.assertions) {
|
|
@@ -188,18 +188,18 @@ function resolveAndMergeNestedStyleguideConfig({ styleguideConfig, configPath =
|
|
|
188
188
|
if (parentConfigPaths.includes(configPath)) {
|
|
189
189
|
throw new Error(`Circular dependency in config file: "${configPath}"`);
|
|
190
190
|
}
|
|
191
|
-
const plugins = utils_2.getUniquePlugins(resolvePlugins([...((styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.plugins) || []), builtIn_1.defaultPlugin], configPath));
|
|
191
|
+
const plugins = (0, utils_2.getUniquePlugins)(resolvePlugins([...((styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.plugins) || []), builtIn_1.defaultPlugin], configPath));
|
|
192
192
|
const pluginPaths = (_a = styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.plugins) === null || _a === void 0 ? void 0 : _a.filter(utils_3.isString).map((p) => path.resolve(path.dirname(configPath), p));
|
|
193
|
-
const resolvedConfigPath = ref_utils_1.isAbsoluteUrl(configPath)
|
|
193
|
+
const resolvedConfigPath = (0, ref_utils_1.isAbsoluteUrl)(configPath)
|
|
194
194
|
? configPath
|
|
195
195
|
: configPath && path.resolve(configPath);
|
|
196
196
|
const extendConfigs = yield Promise.all(((_b = styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.extends) === null || _b === void 0 ? void 0 : _b.map((presetItem) => __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
if (!ref_utils_1.isAbsoluteUrl(presetItem) && !path.extname(presetItem)) {
|
|
197
|
+
if (!(0, ref_utils_1.isAbsoluteUrl)(presetItem) && !path.extname(presetItem)) {
|
|
198
198
|
return resolvePreset(presetItem, plugins);
|
|
199
199
|
}
|
|
200
|
-
const pathItem = ref_utils_1.isAbsoluteUrl(presetItem)
|
|
200
|
+
const pathItem = (0, ref_utils_1.isAbsoluteUrl)(presetItem)
|
|
201
201
|
? presetItem
|
|
202
|
-
: ref_utils_1.isAbsoluteUrl(configPath)
|
|
202
|
+
: (0, ref_utils_1.isAbsoluteUrl)(configPath)
|
|
203
203
|
? new URL(presetItem, configPath).href
|
|
204
204
|
: path.resolve(path.dirname(configPath), presetItem);
|
|
205
205
|
const extendedStyleguideConfig = yield loadExtendStyleguideConfig(pathItem, resolver);
|
|
@@ -209,11 +209,11 @@ function resolveAndMergeNestedStyleguideConfig({ styleguideConfig, configPath =
|
|
|
209
209
|
resolver: resolver,
|
|
210
210
|
}, [...parentConfigPaths, resolvedConfigPath], extendPaths);
|
|
211
211
|
}))) || []);
|
|
212
|
-
const _d = utils_2.mergeExtends([
|
|
212
|
+
const _d = (0, utils_2.mergeExtends)([
|
|
213
213
|
...extendConfigs,
|
|
214
214
|
Object.assign(Object.assign({}, styleguideConfig), { plugins, extends: undefined, extendPaths: [...parentConfigPaths, resolvedConfigPath], pluginPaths }),
|
|
215
215
|
]), { plugins: mergedPlugins = [] } = _d, styleguide = __rest(_d, ["plugins"]);
|
|
216
|
-
return Object.assign(Object.assign({}, styleguide), { extendPaths: (_c = styleguide.extendPaths) === null || _c === void 0 ? void 0 : _c.filter((path) => path && !ref_utils_1.isAbsoluteUrl(path)), plugins: utils_2.getUniquePlugins(mergedPlugins), recommendedFallback: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.recommendedFallback, doNotResolveExamples: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.doNotResolveExamples });
|
|
216
|
+
return Object.assign(Object.assign({}, styleguide), { extendPaths: (_c = styleguide.extendPaths) === null || _c === void 0 ? void 0 : _c.filter((path) => path && !(0, ref_utils_1.isAbsoluteUrl)(path)), plugins: (0, utils_2.getUniquePlugins)(mergedPlugins), recommendedFallback: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.recommendedFallback, doNotResolveExamples: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.doNotResolveExamples });
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
function resolveStyleguideConfig(opts, parentConfigPaths = [], extendPaths = []) {
|
|
@@ -225,7 +225,7 @@ function resolveStyleguideConfig(opts, parentConfigPaths = [], extendPaths = [])
|
|
|
225
225
|
exports.resolveStyleguideConfig = resolveStyleguideConfig;
|
|
226
226
|
function resolvePreset(presetName, plugins) {
|
|
227
227
|
var _a;
|
|
228
|
-
const { pluginId, configName } = utils_2.parsePresetName(presetName);
|
|
228
|
+
const { pluginId, configName } = (0, utils_2.parsePresetName)(presetName);
|
|
229
229
|
const plugin = plugins.find((p) => p.id === pluginId);
|
|
230
230
|
if (!plugin) {
|
|
231
231
|
throw new Error(`Invalid config ${logger_1.colorize.red(presetName)}: plugin ${pluginId} is not included.`);
|
|
@@ -243,7 +243,7 @@ function loadExtendStyleguideConfig(filePath, resolver) {
|
|
|
243
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
244
244
|
try {
|
|
245
245
|
const fileSource = yield resolver.loadExternalRef(filePath);
|
|
246
|
-
const rawConfig = utils_2.transformConfig(utils_3.parseYaml(fileSource.body));
|
|
246
|
+
const rawConfig = (0, utils_2.transformConfig)((0, utils_3.parseYaml)(fileSource.body));
|
|
247
247
|
if (!rawConfig.styleguide) {
|
|
248
248
|
throw new Error(`Styleguide configuration format not detected: "${filePath}"`);
|
|
249
249
|
}
|
|
@@ -255,7 +255,7 @@ function loadExtendStyleguideConfig(filePath, resolver) {
|
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig) {
|
|
258
|
-
const resultLint = Object.assign(Object.assign(Object.assign({}, rootStyleguideConfig), utils_1.pickDefined(apiStyleguideConfig)), { rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.rules), oas2Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Rules), oas3_0Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Rules), oas3_1Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Rules), preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.preprocessors), oas2Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Preprocessors), oas3_0Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Preprocessors), oas3_1Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Preprocessors), decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.decorators), oas2Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Decorators), oas3_0Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Decorators), oas3_1Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Decorators), recommendedFallback: (apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.extends)
|
|
258
|
+
const resultLint = Object.assign(Object.assign(Object.assign({}, rootStyleguideConfig), (0, utils_1.pickDefined)(apiStyleguideConfig)), { rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.rules), oas2Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Rules), oas3_0Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Rules), oas3_1Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Rules), preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.preprocessors), oas2Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Preprocessors), oas3_0Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Preprocessors), oas3_1Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Preprocessors), decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.decorators), oas2Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Decorators), oas3_0Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Decorators), oas3_1Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Decorators), recommendedFallback: (apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.extends)
|
|
259
259
|
? false
|
|
260
260
|
: rootStyleguideConfig.recommendedFallback });
|
|
261
261
|
return resultLint;
|
|
@@ -294,7 +294,7 @@ function groupStyleguideAssertionRules({ rules, plugins, }) {
|
|
|
294
294
|
return transformedRules;
|
|
295
295
|
}
|
|
296
296
|
function registerCustomAssertions(plugins, assertion) {
|
|
297
|
-
for (const field of utils_3.keysOf(assertion.assertions)) {
|
|
297
|
+
for (const field of (0, utils_3.keysOf)(assertion.assertions)) {
|
|
298
298
|
const [pluginId, fn] = field.split('/');
|
|
299
299
|
if (!pluginId || !fn)
|
|
300
300
|
continue;
|
|
@@ -305,6 +305,6 @@ function registerCustomAssertions(plugins, assertion) {
|
|
|
305
305
|
if (!plugin.assertions || !plugin.assertions[fn]) {
|
|
306
306
|
throw Error(`Plugin ${logger_1.colorize.red(pluginId)} doesn't export assertions function with name ${logger_1.colorize.red(fn)}.`);
|
|
307
307
|
}
|
|
308
|
-
asserts_1.asserts[field] = asserts_1.buildAssertCustomFunction(plugin.assertions[fn]);
|
|
308
|
+
asserts_1.asserts[field] = (0, asserts_1.buildAssertCustomFunction)(plugin.assertions[fn]);
|
|
309
309
|
}
|
|
310
310
|
}
|
package/lib/config/config.js
CHANGED
|
@@ -30,7 +30,7 @@ function getDomains() {
|
|
|
30
30
|
}
|
|
31
31
|
function getIgnoreFilePath(configFile) {
|
|
32
32
|
if (configFile) {
|
|
33
|
-
return utils_1.doesYamlFileExist(configFile)
|
|
33
|
+
return (0, utils_1.doesYamlFileExist)(configFile)
|
|
34
34
|
? path.join(path.dirname(configFile), exports.IGNORE_FILE)
|
|
35
35
|
: path.join(configFile, exports.IGNORE_FILE);
|
|
36
36
|
}
|
|
@@ -73,17 +73,17 @@ class StyleguideConfig {
|
|
|
73
73
|
this.resolveIgnore(getIgnoreFilePath(configFile));
|
|
74
74
|
}
|
|
75
75
|
resolveIgnore(ignoreFile) {
|
|
76
|
-
if (!ignoreFile || !utils_1.doesYamlFileExist(ignoreFile))
|
|
76
|
+
if (!ignoreFile || !(0, utils_1.doesYamlFileExist)(ignoreFile))
|
|
77
77
|
return;
|
|
78
78
|
this.ignore =
|
|
79
|
-
js_yaml_1.parseYaml(fs.readFileSync(ignoreFile, 'utf-8')) || {};
|
|
79
|
+
(0, js_yaml_1.parseYaml)(fs.readFileSync(ignoreFile, 'utf-8')) || {};
|
|
80
80
|
// resolve ignore paths
|
|
81
81
|
for (const fileName of Object.keys(this.ignore)) {
|
|
82
|
-
this.ignore[ref_utils_1.isAbsoluteUrl(fileName) ? fileName : path.resolve(path.dirname(ignoreFile), fileName)] = this.ignore[fileName];
|
|
82
|
+
this.ignore[(0, ref_utils_1.isAbsoluteUrl)(fileName) ? fileName : path.resolve(path.dirname(ignoreFile), fileName)] = this.ignore[fileName];
|
|
83
83
|
for (const ruleId of Object.keys(this.ignore[fileName])) {
|
|
84
84
|
this.ignore[fileName][ruleId] = new Set(this.ignore[fileName][ruleId]);
|
|
85
85
|
}
|
|
86
|
-
if (!ref_utils_1.isAbsoluteUrl(fileName)) {
|
|
86
|
+
if (!(0, ref_utils_1.isAbsoluteUrl)(fileName)) {
|
|
87
87
|
delete this.ignore[fileName];
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -93,15 +93,15 @@ class StyleguideConfig {
|
|
|
93
93
|
const ignoreFile = path.join(dir, exports.IGNORE_FILE);
|
|
94
94
|
const mapped = {};
|
|
95
95
|
for (const absFileName of Object.keys(this.ignore)) {
|
|
96
|
-
const mappedDefinitionName = ref_utils_1.isAbsoluteUrl(absFileName)
|
|
96
|
+
const mappedDefinitionName = (0, ref_utils_1.isAbsoluteUrl)(absFileName)
|
|
97
97
|
? absFileName
|
|
98
|
-
: utils_1.slash(path.relative(dir, absFileName));
|
|
98
|
+
: (0, utils_1.slash)(path.relative(dir, absFileName));
|
|
99
99
|
const ignoredRules = (mapped[mappedDefinitionName] = this.ignore[absFileName]);
|
|
100
100
|
for (const ruleId of Object.keys(ignoredRules)) {
|
|
101
101
|
ignoredRules[ruleId] = Array.from(ignoredRules[ruleId]);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
fs.writeFileSync(ignoreFile, IGNORE_BANNER + js_yaml_1.stringifyYaml(mapped));
|
|
104
|
+
fs.writeFileSync(ignoreFile, IGNORE_BANNER + (0, js_yaml_1.stringifyYaml)(mapped));
|
|
105
105
|
}
|
|
106
106
|
addIgnore(problem) {
|
|
107
107
|
const ignore = this.ignore;
|
|
@@ -265,7 +265,7 @@ class Config {
|
|
|
265
265
|
this.apis = rawConfig.apis || {};
|
|
266
266
|
this.styleguide = new StyleguideConfig(rawConfig.styleguide || {}, configFile);
|
|
267
267
|
this.theme = rawConfig.theme || {};
|
|
268
|
-
this.resolve = utils_2.getResolveConfig(rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.resolve);
|
|
268
|
+
this.resolve = (0, utils_2.getResolveConfig)(rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.resolve);
|
|
269
269
|
this.region = rawConfig.region;
|
|
270
270
|
this.organization = rawConfig.organization;
|
|
271
271
|
this.files = rawConfig.files || [];
|
package/lib/config/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/config/load.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function loadConfig(options?: {
|
|
|
11
11
|
export declare const CONFIG_FILE_NAMES: string[];
|
|
12
12
|
export declare function findConfig(dir?: string): string | undefined;
|
|
13
13
|
export declare function getConfig(configPath?: string | undefined, processRawConfig?: (rawConfig: RawConfig) => void | Promise<void>): Promise<RawConfig>;
|
|
14
|
-
|
|
14
|
+
type CreateConfigOptions = {
|
|
15
15
|
extends?: string[];
|
|
16
16
|
tokens?: RegionalTokenWithValidity[];
|
|
17
17
|
configPath?: string;
|
package/lib/config/load.js
CHANGED
|
@@ -25,7 +25,7 @@ function addConfigMetadata({ rawConfig, customExtends, configPath, tokens, files
|
|
|
25
25
|
rawConfig.styleguide = rawConfig.styleguide || {};
|
|
26
26
|
rawConfig.styleguide.extends = customExtends;
|
|
27
27
|
}
|
|
28
|
-
else if (utils_1.isEmptyObject(rawConfig)) {
|
|
28
|
+
else if ((0, utils_1.isEmptyObject)(rawConfig)) {
|
|
29
29
|
rawConfig.styleguide = { extends: ['recommended'], recommendedFallback: true };
|
|
30
30
|
}
|
|
31
31
|
if (tokens === null || tokens === void 0 ? void 0 : tokens.length) {
|
|
@@ -55,7 +55,7 @@ function addConfigMetadata({ rawConfig, customExtends, configPath, tokens, files
|
|
|
55
55
|
: []));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
return config_resolvers_1.resolveConfig(Object.assign(Object.assign({}, rawConfig), { files: files !== null && files !== void 0 ? files : rawConfig.files, region: region !== null && region !== void 0 ? region : rawConfig.region }), configPath);
|
|
58
|
+
return (0, config_resolvers_1.resolveConfig)(Object.assign(Object.assign({}, rawConfig), { files: files !== null && files !== void 0 ? files : rawConfig.files, region: region !== null && region !== void 0 ? region : rawConfig.region }), configPath);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
function loadConfig(options = {}) {
|
|
@@ -92,14 +92,14 @@ function findConfig(dir) {
|
|
|
92
92
|
exports.findConfig = findConfig;
|
|
93
93
|
function getConfig(configPath = findConfig(), processRawConfig) {
|
|
94
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
if (!configPath || !utils_1.doesYamlFileExist(configPath))
|
|
95
|
+
if (!configPath || !(0, utils_1.doesYamlFileExist)(configPath))
|
|
96
96
|
return {};
|
|
97
97
|
try {
|
|
98
|
-
const rawConfig = (yield utils_1.loadYaml(configPath)) || {};
|
|
98
|
+
const rawConfig = (yield (0, utils_1.loadYaml)(configPath)) || {};
|
|
99
99
|
if (typeof processRawConfig === 'function') {
|
|
100
100
|
yield processRawConfig(rawConfig);
|
|
101
101
|
}
|
|
102
|
-
return utils_2.transformConfig(rawConfig);
|
|
102
|
+
return (0, utils_2.transformConfig)(rawConfig);
|
|
103
103
|
}
|
|
104
104
|
catch (e) {
|
|
105
105
|
if (e instanceof utils_2.ConfigValidationError) {
|
|
@@ -112,7 +112,7 @@ function getConfig(configPath = findConfig(), processRawConfig) {
|
|
|
112
112
|
exports.getConfig = getConfig;
|
|
113
113
|
function createConfig(config, options) {
|
|
114
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
return addConfigMetadata(Object.assign({ rawConfig: utils_2.transformConfig(typeof config === 'string' ? js_yaml_1.parseYaml(config) : config) }, options));
|
|
115
|
+
return addConfigMetadata(Object.assign({ rawConfig: (0, utils_2.transformConfig)(typeof config === 'string' ? (0, js_yaml_1.parseYaml)(config) : config) }, options));
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
exports.createConfig = createConfig;
|
package/lib/config/minimal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginStyleguideConfig } from './types';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const minimal: PluginStyleguideConfig<'built-in'>;
|
|
3
|
+
export default minimal;
|
package/lib/config/minimal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const minimal = {
|
|
4
4
|
rules: {
|
|
5
5
|
'info-contact': 'off',
|
|
6
6
|
'info-license': 'off',
|
|
@@ -27,11 +27,25 @@ exports.default = {
|
|
|
27
27
|
'operation-singular-tag': 'off',
|
|
28
28
|
'no-unresolved-refs': 'error',
|
|
29
29
|
'no-enum-type-mismatch': 'warn',
|
|
30
|
-
'boolean-parameter-prefixes': 'off',
|
|
31
30
|
'paths-kebab-case': 'off',
|
|
32
31
|
spec: 'error',
|
|
33
32
|
'spec-strict-refs': 'off',
|
|
34
|
-
'
|
|
33
|
+
'no-http-verbs-in-paths': 'off',
|
|
34
|
+
'no-invalid-parameter-examples': 'off',
|
|
35
|
+
'no-invalid-schema-examples': 'off',
|
|
36
|
+
'path-excludes-patterns': 'off',
|
|
37
|
+
'path-http-verbs-order': 'off',
|
|
38
|
+
'path-params-defined': 'off',
|
|
39
|
+
'required-string-property-missing-min-length': 'off',
|
|
40
|
+
'response-contains-header': 'off',
|
|
41
|
+
'path-segment-plural': 'off',
|
|
42
|
+
'scalar-property-missing-example': 'off',
|
|
43
|
+
},
|
|
44
|
+
oas2Rules: {
|
|
45
|
+
'boolean-parameter-prefixes': 'off',
|
|
46
|
+
'request-mime-type': 'off',
|
|
47
|
+
'response-contains-property': 'off',
|
|
48
|
+
'response-mime-type': 'off',
|
|
35
49
|
},
|
|
36
50
|
oas3_0Rules: {
|
|
37
51
|
'no-invalid-media-type-examples': {
|
|
@@ -46,6 +60,12 @@ exports.default = {
|
|
|
46
60
|
'no-undefined-server-variable': 'warn',
|
|
47
61
|
'no-server-variables-empty-enum': 'error',
|
|
48
62
|
'spec-components-invalid-map-name': 'warn',
|
|
63
|
+
'boolean-parameter-prefixes': 'off',
|
|
64
|
+
'component-name-unique': 'off',
|
|
65
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
66
|
+
'request-mime-type': 'off',
|
|
67
|
+
'response-contains-property': 'off',
|
|
68
|
+
'response-mime-type': 'off',
|
|
49
69
|
},
|
|
50
70
|
oas3_1Rules: {
|
|
51
71
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -57,5 +77,16 @@ exports.default = {
|
|
|
57
77
|
'no-undefined-server-variable': 'warn',
|
|
58
78
|
'no-server-variables-empty-enum': 'error',
|
|
59
79
|
'spec-components-invalid-map-name': 'warn',
|
|
80
|
+
'boolean-parameter-prefixes': 'off',
|
|
81
|
+
'component-name-unique': 'off',
|
|
82
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
83
|
+
'request-mime-type': 'off',
|
|
84
|
+
'response-contains-property': 'off',
|
|
85
|
+
'response-mime-type': 'off',
|
|
86
|
+
},
|
|
87
|
+
async2Rules: {
|
|
88
|
+
'channels-kebab-case': 'off',
|
|
89
|
+
'no-channel-trailing-slash': 'off',
|
|
60
90
|
},
|
|
61
91
|
};
|
|
92
|
+
exports.default = minimal;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const recommendedStrict = {
|
|
4
|
+
rules: {
|
|
5
|
+
'info-contact': 'off',
|
|
6
|
+
'info-license': 'error',
|
|
7
|
+
'info-license-url': 'error',
|
|
8
|
+
'tag-description': 'error',
|
|
9
|
+
'tags-alphabetical': 'off',
|
|
10
|
+
'parameter-description': 'off',
|
|
11
|
+
'no-path-trailing-slash': 'error',
|
|
12
|
+
'no-identical-paths': 'error',
|
|
13
|
+
'no-ambiguous-paths': 'error',
|
|
14
|
+
'path-declaration-must-exist': 'error',
|
|
15
|
+
'path-not-include-query': 'error',
|
|
16
|
+
'path-parameters-defined': 'error',
|
|
17
|
+
'operation-description': 'off',
|
|
18
|
+
'operation-2xx-response': 'error',
|
|
19
|
+
'operation-4xx-response': 'error',
|
|
20
|
+
'operation-operationId': 'error',
|
|
21
|
+
'operation-summary': 'error',
|
|
22
|
+
'operation-operationId-unique': 'error',
|
|
23
|
+
'operation-operationId-url-safe': 'error',
|
|
24
|
+
'operation-parameters-unique': 'error',
|
|
25
|
+
'operation-tag-defined': 'off',
|
|
26
|
+
'security-defined': 'error',
|
|
27
|
+
'operation-singular-tag': 'off',
|
|
28
|
+
'no-unresolved-refs': 'error',
|
|
29
|
+
'no-enum-type-mismatch': 'error',
|
|
30
|
+
'paths-kebab-case': 'off',
|
|
31
|
+
spec: 'error',
|
|
32
|
+
'spec-strict-refs': 'off',
|
|
33
|
+
'no-http-verbs-in-paths': 'off',
|
|
34
|
+
'no-invalid-parameter-examples': 'off',
|
|
35
|
+
'no-invalid-schema-examples': 'off',
|
|
36
|
+
'path-excludes-patterns': 'off',
|
|
37
|
+
'path-http-verbs-order': 'off',
|
|
38
|
+
'path-params-defined': 'off',
|
|
39
|
+
'path-segment-plural': 'off',
|
|
40
|
+
'required-string-property-missing-min-length': 'off',
|
|
41
|
+
'response-contains-header': 'off',
|
|
42
|
+
'scalar-property-missing-example': 'off',
|
|
43
|
+
},
|
|
44
|
+
oas2Rules: {
|
|
45
|
+
'boolean-parameter-prefixes': 'off',
|
|
46
|
+
'request-mime-type': 'off',
|
|
47
|
+
'response-contains-property': 'off',
|
|
48
|
+
'response-mime-type': 'off',
|
|
49
|
+
},
|
|
50
|
+
oas3_0Rules: {
|
|
51
|
+
'no-invalid-media-type-examples': {
|
|
52
|
+
severity: 'error',
|
|
53
|
+
allowAdditionalProperties: false,
|
|
54
|
+
},
|
|
55
|
+
'no-server-example.com': 'error',
|
|
56
|
+
'no-server-trailing-slash': 'error',
|
|
57
|
+
'no-empty-servers': 'error',
|
|
58
|
+
'no-example-value-and-externalValue': 'error',
|
|
59
|
+
'no-unused-components': 'error',
|
|
60
|
+
'no-undefined-server-variable': 'error',
|
|
61
|
+
'no-server-variables-empty-enum': 'error',
|
|
62
|
+
'spec-components-invalid-map-name': 'error',
|
|
63
|
+
'boolean-parameter-prefixes': 'off',
|
|
64
|
+
'component-name-unique': 'off',
|
|
65
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
66
|
+
'request-mime-type': 'off',
|
|
67
|
+
'response-contains-property': 'off',
|
|
68
|
+
'response-mime-type': 'off',
|
|
69
|
+
},
|
|
70
|
+
oas3_1Rules: {
|
|
71
|
+
'no-invalid-media-type-examples': 'error',
|
|
72
|
+
'no-server-example.com': 'error',
|
|
73
|
+
'no-server-trailing-slash': 'error',
|
|
74
|
+
'no-empty-servers': 'error',
|
|
75
|
+
'no-example-value-and-externalValue': 'error',
|
|
76
|
+
'no-unused-components': 'error',
|
|
77
|
+
'no-undefined-server-variable': 'error',
|
|
78
|
+
'no-server-variables-empty-enum': 'error',
|
|
79
|
+
'spec-components-invalid-map-name': 'error',
|
|
80
|
+
'boolean-parameter-prefixes': 'off',
|
|
81
|
+
'component-name-unique': 'off',
|
|
82
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
83
|
+
'request-mime-type': 'off',
|
|
84
|
+
'response-contains-property': 'off',
|
|
85
|
+
'response-mime-type': 'off',
|
|
86
|
+
},
|
|
87
|
+
async2Rules: {
|
|
88
|
+
'channels-kebab-case': 'off',
|
|
89
|
+
'no-channel-trailing-slash': 'off',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
exports.default = recommendedStrict;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginStyleguideConfig } from './types';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const recommended: PluginStyleguideConfig<'built-in'>;
|
|
3
|
+
export default recommended;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const recommended = {
|
|
4
4
|
rules: {
|
|
5
5
|
'info-contact': 'off',
|
|
6
6
|
'info-license': 'warn',
|
|
@@ -27,11 +27,25 @@ exports.default = {
|
|
|
27
27
|
'operation-singular-tag': 'off',
|
|
28
28
|
'no-unresolved-refs': 'error',
|
|
29
29
|
'no-enum-type-mismatch': 'error',
|
|
30
|
-
'boolean-parameter-prefixes': 'off',
|
|
31
30
|
'paths-kebab-case': 'off',
|
|
32
31
|
spec: 'error',
|
|
33
32
|
'spec-strict-refs': 'off',
|
|
34
|
-
'
|
|
33
|
+
'no-http-verbs-in-paths': 'off',
|
|
34
|
+
'no-invalid-parameter-examples': 'off',
|
|
35
|
+
'no-invalid-schema-examples': 'off',
|
|
36
|
+
'path-excludes-patterns': 'off',
|
|
37
|
+
'path-http-verbs-order': 'off',
|
|
38
|
+
'path-params-defined': 'off',
|
|
39
|
+
'path-segment-plural': 'off',
|
|
40
|
+
'required-string-property-missing-min-length': 'off',
|
|
41
|
+
'response-contains-header': 'off',
|
|
42
|
+
'scalar-property-missing-example': 'off',
|
|
43
|
+
},
|
|
44
|
+
oas2Rules: {
|
|
45
|
+
'boolean-parameter-prefixes': 'off',
|
|
46
|
+
'request-mime-type': 'off',
|
|
47
|
+
'response-contains-property': 'off',
|
|
48
|
+
'response-mime-type': 'off',
|
|
35
49
|
},
|
|
36
50
|
oas3_0Rules: {
|
|
37
51
|
'no-invalid-media-type-examples': {
|
|
@@ -46,6 +60,12 @@ exports.default = {
|
|
|
46
60
|
'no-undefined-server-variable': 'error',
|
|
47
61
|
'no-server-variables-empty-enum': 'error',
|
|
48
62
|
'spec-components-invalid-map-name': 'error',
|
|
63
|
+
'boolean-parameter-prefixes': 'off',
|
|
64
|
+
'component-name-unique': 'off',
|
|
65
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
66
|
+
'request-mime-type': 'off',
|
|
67
|
+
'response-contains-property': 'off',
|
|
68
|
+
'response-mime-type': 'off',
|
|
49
69
|
},
|
|
50
70
|
oas3_1Rules: {
|
|
51
71
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -57,5 +77,16 @@ exports.default = {
|
|
|
57
77
|
'no-undefined-server-variable': 'error',
|
|
58
78
|
'no-server-variables-empty-enum': 'error',
|
|
59
79
|
'spec-components-invalid-map-name': 'error',
|
|
80
|
+
'boolean-parameter-prefixes': 'off',
|
|
81
|
+
'component-name-unique': 'off',
|
|
82
|
+
'operation-4xx-problem-details-rfc7807': 'off',
|
|
83
|
+
'request-mime-type': 'off',
|
|
84
|
+
'response-contains-property': 'off',
|
|
85
|
+
'response-mime-type': 'off',
|
|
86
|
+
},
|
|
87
|
+
async2Rules: {
|
|
88
|
+
'channels-kebab-case': 'off',
|
|
89
|
+
'no-channel-trailing-slash': 'off',
|
|
60
90
|
},
|
|
61
91
|
};
|
|
92
|
+
exports.default = recommended;
|
package/lib/config/rules.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RuleSet, SpecVersion } from '../oas-types';
|
|
2
2
|
import { StyleguideConfig } from './config';
|
|
3
3
|
import type { ProblemSeverity } from '../walk';
|
|
4
|
-
|
|
4
|
+
type InitializedRule = {
|
|
5
5
|
severity: ProblemSeverity;
|
|
6
6
|
ruleId: string;
|
|
7
7
|
visitor: any;
|