@redocly/openapi-core 1.0.0-beta.94 → 1.0.0-beta.97
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/README.md +1 -1
- package/__tests__/bundle.test.ts +6 -6
- package/__tests__/fixtures/extension.js +1 -1
- package/__tests__/login.test.ts +2 -2
- package/__tests__/ref-utils.test.ts +1 -1
- package/__tests__/utils.ts +30 -18
- package/lib/benchmark/benches/recommended-oas3.bench.js +2 -3
- package/lib/benchmark/utils.d.ts +2 -1
- package/lib/benchmark/utils.js +10 -7
- package/lib/bundle.d.ts +2 -2
- package/lib/config/all.d.ts +2 -2
- package/lib/config/builtIn.d.ts +1 -1
- package/lib/config/config-resolvers.d.ts +16 -0
- package/lib/config/config-resolvers.js +242 -0
- package/lib/config/config.d.ts +18 -130
- package/lib/config/config.js +34 -245
- package/lib/config/index.d.ts +7 -0
- package/lib/config/index.js +19 -0
- package/lib/config/load.d.ts +2 -1
- package/lib/config/load.js +20 -13
- package/lib/config/minimal.d.ts +2 -2
- package/lib/config/recommended.d.ts +2 -2
- package/lib/config/types.d.ts +113 -0
- package/lib/config/types.js +2 -0
- package/lib/config/utils.d.ts +13 -0
- package/lib/config/utils.js +160 -0
- package/lib/format/format.d.ts +1 -1
- package/lib/format/format.js +30 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +5 -6
- package/lib/lint.d.ts +1 -1
- package/lib/lint.js +5 -7
- package/lib/redocly/index.d.ts +1 -1
- package/lib/redocly/index.js +10 -26
- package/lib/redocly/redocly-client-types.d.ts +1 -1
- package/lib/redocly/registry-api-types.d.ts +1 -0
- package/lib/redocly/registry-api.d.ts +2 -2
- package/lib/redocly/registry-api.js +2 -1
- package/lib/resolve.d.ts +1 -1
- package/lib/resolve.js +1 -2
- package/lib/rules/common/assertions/index.js +1 -1
- package/lib/rules/common/assertions/utils.d.ts +1 -1
- package/lib/rules/common/assertions/utils.js +6 -2
- package/lib/utils.d.ts +4 -2
- package/lib/utils.js +20 -3
- package/package.json +9 -6
- package/src/__tests__/lint.test.ts +1 -1
- package/src/benchmark/benches/recommended-oas3.bench.ts +2 -3
- package/src/benchmark/benchmark.js +1 -1
- package/src/benchmark/utils.ts +13 -8
- package/src/bundle.ts +2 -1
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +157 -0
- package/src/config/__tests__/config-resolvers.test.ts +429 -0
- package/src/config/__tests__/config.test.ts +17 -29
- package/src/config/__tests__/fixtures/plugin.js +1 -1
- package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +12 -0
- package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +67 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +8 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +19 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +10 -0
- package/src/config/__tests__/fixtures/resolve-config/plugin.js +66 -0
- package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +4 -0
- package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +5 -0
- package/src/config/__tests__/load.test.ts +8 -1
- package/src/config/all.ts +3 -2
- package/src/config/builtIn.ts +2 -1
- package/src/config/config-resolvers.ts +359 -0
- package/src/config/config.ts +60 -468
- package/src/config/index.ts +7 -0
- package/src/config/load.ts +37 -31
- package/src/config/minimal.ts +2 -2
- package/src/config/recommended.ts +2 -2
- package/src/config/types.ts +168 -0
- package/src/config/utils.ts +208 -0
- package/src/decorators/__tests__/remove-x-internal.test.ts +5 -5
- package/src/format/format.ts +38 -7
- package/src/index.ts +6 -2
- package/src/lint.ts +4 -5
- package/src/redocly/__tests__/redocly-client.test.ts +7 -0
- package/src/redocly/index.ts +14 -41
- package/src/redocly/redocly-client-types.ts +1 -1
- package/src/redocly/registry-api-types.ts +1 -0
- package/src/redocly/registry-api.ts +5 -1
- package/src/resolve.ts +2 -4
- package/src/rules/__tests__/no-unresolved-refs.test.ts +4 -4
- package/src/rules/common/__tests__/info-description.test.ts +3 -3
- package/src/rules/common/__tests__/info-license.test.ts +2 -2
- package/src/rules/common/__tests__/license-url.test.ts +2 -2
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -1
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +5 -5
- package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -1
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +3 -3
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +3 -3
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +3 -3
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +2 -2
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -1
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +4 -4
- package/src/rules/common/__tests__/operation-security-defined.test.ts +2 -2
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +2 -2
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +2 -2
- package/src/rules/common/__tests__/path-not-include-query.test.ts +2 -2
- package/src/rules/common/__tests__/path-params-defined.test.ts +3 -3
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +3 -3
- package/src/rules/common/__tests__/spec.test.ts +1 -1
- package/src/rules/common/__tests__/tag-description.test.ts +2 -2
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +2 -2
- package/src/rules/common/assertions/index.ts +1 -1
- package/src/rules/common/assertions/utils.ts +5 -2
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +3 -3
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
- package/src/rules/oas2/__tests__/spec/utils.ts +10 -7
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +3 -3
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +6 -6
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +2 -2
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +8 -8
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +2 -2
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +3 -3
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -1
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +23 -14
- package/src/rules/oas3/__tests__/spec/spec.test.ts +4 -4
- package/src/rules/oas3/__tests__/spec/utils.ts +10 -7
- package/src/utils.ts +21 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -15,6 +15,6 @@ export declare type AssertToApply = {
|
|
|
15
15
|
runsOnValues: boolean;
|
|
16
16
|
};
|
|
17
17
|
export declare function buildVisitorObject(subject: string, context: Record<string, any>[], subjectVisitor: any): Record<string, any>;
|
|
18
|
-
export declare function buildSubjectVisitor(properties: string | string[], asserts: AssertToApply[], context?: Record<string, any>[]): (node: any, { report, location, key, type }: UserContext) => void;
|
|
18
|
+
export declare function buildSubjectVisitor(properties: string | string[], asserts: AssertToApply[], context?: Record<string, any>[]): (node: any, { report, location, key, type, resolve }: UserContext) => void;
|
|
19
19
|
export declare function getIntersectionLength(keys: string[], properties: string[]): number;
|
|
20
20
|
export declare function isOrdered(value: any[], options: OrderOptions | OrderDirection): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isOrdered = exports.getIntersectionLength = exports.buildSubjectVisitor = exports.buildVisitorObject = void 0;
|
|
4
|
+
const ref_utils_1 = require("../../../ref-utils");
|
|
4
5
|
const asserts_1 = require("./asserts");
|
|
5
6
|
function buildVisitorObject(subject, context, subjectVisitor) {
|
|
6
7
|
if (!context) {
|
|
@@ -44,7 +45,8 @@ function buildVisitorObject(subject, context, subjectVisitor) {
|
|
|
44
45
|
}
|
|
45
46
|
exports.buildVisitorObject = buildVisitorObject;
|
|
46
47
|
function buildSubjectVisitor(properties, asserts, context) {
|
|
47
|
-
return function (node, { report, location, key, type }) {
|
|
48
|
+
return function (node, { report, location, key, type, resolve }) {
|
|
49
|
+
var _a;
|
|
48
50
|
// We need to check context's last node if it has the same type as subject node;
|
|
49
51
|
// if yes - that means we didn't create context's last node visitor,
|
|
50
52
|
// so we need to handle 'matchParentKeys' and 'excludeParentKeys' conditions here;
|
|
@@ -67,7 +69,9 @@ function buildSubjectVisitor(properties, asserts, context) {
|
|
|
67
69
|
for (const assert of asserts) {
|
|
68
70
|
if (properties) {
|
|
69
71
|
for (const property of properties) {
|
|
70
|
-
|
|
72
|
+
// we can have resolvable scalar so need to resolve value here.
|
|
73
|
+
const value = ref_utils_1.isRef(node[property]) ? (_a = resolve(node[property])) === null || _a === void 0 ? void 0 : _a.node : node[property];
|
|
74
|
+
runAssertion(value, assert, location.child(property), report);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
else {
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpResolveConfig } from './config/config';
|
|
2
1
|
import { UserContext } from './walk';
|
|
2
|
+
import type { HttpResolveConfig } from './config';
|
|
3
3
|
export { parseYaml, stringifyYaml } from './js-yaml';
|
|
4
4
|
export declare type StackFrame<T> = {
|
|
5
5
|
prev: StackFrame<T> | null;
|
|
@@ -22,7 +22,6 @@ export declare function readFileFromUrl(url: string, config: HttpResolveConfig):
|
|
|
22
22
|
body: any;
|
|
23
23
|
mimeType: any;
|
|
24
24
|
}>;
|
|
25
|
-
export declare function match(url: string, pattern: string): boolean;
|
|
26
25
|
export declare function pickObjectProps<T extends Record<string, unknown>>(object: T, keys: Array<string>): T;
|
|
27
26
|
export declare function omitObjectProps<T extends Record<string, unknown>>(object: T, keys: Array<string>): T;
|
|
28
27
|
export declare function splitCamelCaseIntoWords(str: string): Set<string>;
|
|
@@ -36,3 +35,6 @@ export declare function isPathParameter(pathSegment: string): boolean;
|
|
|
36
35
|
*/
|
|
37
36
|
export declare function slash(path: string): string;
|
|
38
37
|
export declare function isNotEmptyObject(obj: any): boolean;
|
|
38
|
+
export declare function isString(value: unknown): value is string;
|
|
39
|
+
export declare function isNotString<T>(value: string | T): value is T;
|
|
40
|
+
export declare function assignExisting<T>(target: Record<string, T>, obj: Record<string, T>): void;
|
package/lib/utils.js
CHANGED
|
@@ -9,12 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.
|
|
12
|
+
exports.assignExisting = exports.isNotString = exports.isString = exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.readFileFromUrl = exports.isEmptyArray = exports.isEmptyObject = exports.isPlainObject = exports.notUndefined = exports.loadYaml = exports.popStack = exports.pushStack = exports.stringifyYaml = exports.parseYaml = void 0;
|
|
13
13
|
const fs = require("fs");
|
|
14
14
|
const minimatch = require("minimatch");
|
|
15
15
|
const node_fetch_1 = require("node-fetch");
|
|
16
16
|
const pluralize = require("pluralize");
|
|
17
17
|
const js_yaml_1 = require("./js-yaml");
|
|
18
|
+
const config_1 = require("./config");
|
|
18
19
|
var js_yaml_2 = require("./js-yaml");
|
|
19
20
|
Object.defineProperty(exports, "parseYaml", { enumerable: true, get: function () { return js_yaml_2.parseYaml; } });
|
|
20
21
|
Object.defineProperty(exports, "stringifyYaml", { enumerable: true, get: function () { return js_yaml_2.stringifyYaml; } });
|
|
@@ -56,7 +57,7 @@ function readFileFromUrl(url, config) {
|
|
|
56
57
|
for (const header of config.headers) {
|
|
57
58
|
if (match(url, header.matches)) {
|
|
58
59
|
headers[header.name] =
|
|
59
|
-
header.envVariable !== undefined ?
|
|
60
|
+
header.envVariable !== undefined ? config_1.env[header.envVariable] || '' : header.value;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
const req = yield (config.customFetch || node_fetch_1.default)(url, {
|
|
@@ -76,7 +77,6 @@ function match(url, pattern) {
|
|
|
76
77
|
}
|
|
77
78
|
return minimatch(url, pattern);
|
|
78
79
|
}
|
|
79
|
-
exports.match = match;
|
|
80
80
|
function pickObjectProps(object, keys) {
|
|
81
81
|
return Object.fromEntries(keys.filter((key) => key in object).map((key) => [key, object[key]]));
|
|
82
82
|
}
|
|
@@ -156,3 +156,20 @@ function isNotEmptyObject(obj) {
|
|
|
156
156
|
return !!obj && Object.keys(obj).length > 0;
|
|
157
157
|
}
|
|
158
158
|
exports.isNotEmptyObject = isNotEmptyObject;
|
|
159
|
+
// TODO: use it everywhere
|
|
160
|
+
function isString(value) {
|
|
161
|
+
return typeof value === 'string';
|
|
162
|
+
}
|
|
163
|
+
exports.isString = isString;
|
|
164
|
+
function isNotString(value) {
|
|
165
|
+
return !isString(value);
|
|
166
|
+
}
|
|
167
|
+
exports.isNotString = isNotString;
|
|
168
|
+
function assignExisting(target, obj) {
|
|
169
|
+
for (let k of Object.keys(obj)) {
|
|
170
|
+
if (target.hasOwnProperty(k)) {
|
|
171
|
+
target[k] = obj[k];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.assignExisting = assignExisting;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.97",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/Redocly/
|
|
13
|
+
"url": "https://github.com/Redocly/redocly-cli.git"
|
|
14
14
|
},
|
|
15
15
|
"browser": {
|
|
16
|
-
"fs": false
|
|
16
|
+
"fs": false,
|
|
17
|
+
"path": "path-browserify",
|
|
18
|
+
"os": false,
|
|
19
|
+
"node-fetch": false
|
|
17
20
|
},
|
|
18
|
-
"homepage": "https://github.com/Redocly/
|
|
21
|
+
"homepage": "https://github.com/Redocly/redocly-cli",
|
|
19
22
|
"keywords": [
|
|
20
23
|
"linter",
|
|
21
24
|
"OpenAPI",
|
|
@@ -36,7 +39,7 @@
|
|
|
36
39
|
"js-levenshtein": "^1.1.6",
|
|
37
40
|
"js-yaml": "^4.1.0",
|
|
38
41
|
"lodash.isequal": "^4.5.0",
|
|
39
|
-
"minimatch": "^
|
|
42
|
+
"minimatch": "^5.0.1",
|
|
40
43
|
"node-fetch": "^2.6.1",
|
|
41
44
|
"pluralize": "^8.0.0",
|
|
42
45
|
"yaml-ast-parser": "0.0.43"
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
"@types/js-levenshtein": "^1.1.0",
|
|
46
49
|
"@types/js-yaml": "^4.0.3",
|
|
47
50
|
"@types/lodash.isequal": "^4.5.5",
|
|
48
|
-
"@types/minimatch": "^3.0.
|
|
51
|
+
"@types/minimatch": "^3.0.5",
|
|
49
52
|
"@types/node-fetch": "^2.5.7",
|
|
50
53
|
"@types/pluralize": "^0.0.29",
|
|
51
54
|
"typescript": "^4.0.5"
|
|
@@ -174,7 +174,7 @@ describe('lint', () => {
|
|
|
174
174
|
const results = await lintDocument({
|
|
175
175
|
externalRefResolver: new BaseResolver(),
|
|
176
176
|
document,
|
|
177
|
-
config: makeConfig({ spec: 'error' }),
|
|
177
|
+
config: await makeConfig({ spec: 'error' }),
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { join as pathJoin, resolve as pathResolve } from 'path';
|
|
3
3
|
import { lintDocument } from '../../lint';
|
|
4
|
-
import { LintConfig } from '../../config
|
|
4
|
+
import { LintConfig, defaultPlugin, resolvePreset } from '../../config';
|
|
5
5
|
import { BaseResolver } from '../../resolve';
|
|
6
6
|
import { parseYamlToDocument } from '../utils';
|
|
7
|
-
import { defaultPlugin } from '../../config/builtIn';
|
|
8
7
|
|
|
9
8
|
export const name = 'Validate with recommended rules';
|
|
10
9
|
export const count = 10;
|
|
@@ -18,6 +17,6 @@ export function measureAsync() {
|
|
|
18
17
|
return lintDocument({
|
|
19
18
|
externalRefResolver: new BaseResolver(),
|
|
20
19
|
document: rebillyDocument,
|
|
21
|
-
config: new LintConfig(
|
|
20
|
+
config: new LintConfig(resolvePreset('recommended', [defaultPlugin])),
|
|
22
21
|
});
|
|
23
22
|
}
|
|
@@ -29,7 +29,7 @@ function prepareRevision(revision) {
|
|
|
29
29
|
|
|
30
30
|
// Returns the complete git hash for a given git revision reference.
|
|
31
31
|
const hash = exec(`git rev-parse "${revision}"`);
|
|
32
|
-
const dir = path.join(os.tmpdir(), '
|
|
32
|
+
const dir = path.join(os.tmpdir(), 'redocly-cli-benchmark', hash);
|
|
33
33
|
if (fs.existsSync(dir)) {
|
|
34
34
|
fs.rmdirSync(dir, { recursive: true});
|
|
35
35
|
}
|
package/src/benchmark/utils.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { parseYaml } from '../js-yaml';
|
|
2
2
|
import { Document, Source } from '../resolve';
|
|
3
3
|
import { Oas3RuleSet } from '../oas-types';
|
|
4
|
-
import {
|
|
4
|
+
import { LintConfig, mergeExtends, resolvePlugins } from '../config';
|
|
5
|
+
|
|
6
|
+
import type { RuleConfig, Plugin, ResolvedLintConfig } from '../config/types';
|
|
5
7
|
|
|
6
8
|
export function parseYamlToDocument(body: string, absoluteRef: string = ''): Document {
|
|
7
9
|
return {
|
|
@@ -16,16 +18,19 @@ export function makeConfigForRuleset(rules: Oas3RuleSet, plugin?: Partial<Plugin
|
|
|
16
18
|
Object.keys(rules).forEach((name) => {
|
|
17
19
|
rulesConf[`${ruleId}/${name}`] = 'error';
|
|
18
20
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
plugins: [
|
|
21
|
+
const extendConfigs = [
|
|
22
|
+
resolvePlugins([
|
|
22
23
|
{
|
|
23
24
|
...plugin,
|
|
24
25
|
id: ruleId,
|
|
25
26
|
rules: { oas3: rules },
|
|
26
27
|
},
|
|
27
|
-
],
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
]) as ResolvedLintConfig,
|
|
29
|
+
];
|
|
30
|
+
if (rules) {
|
|
31
|
+
extendConfigs.push({ rules });
|
|
32
|
+
}
|
|
33
|
+
const lint = mergeExtends(extendConfigs);
|
|
34
|
+
|
|
35
|
+
return new LintConfig(lint);
|
|
31
36
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { NormalizedNodeType, normalizeTypes, NodeType } from './types';
|
|
|
8
8
|
import { WalkContext, walkDocument, UserContext, ResolveResult } from './walk';
|
|
9
9
|
import { detectOpenAPI, openAPIMajor, OasMajorVersion } from './oas-types';
|
|
10
10
|
import { isRef, Location, refBaseName } from './ref-utils';
|
|
11
|
-
import type { Config, LintConfig } from './config/config';
|
|
12
11
|
import { initRules } from './config/rules';
|
|
13
12
|
import { reportUnresolvedRef } from './rules/no-unresolved-refs';
|
|
14
13
|
import { isPlainObject } from './utils';
|
|
@@ -17,6 +16,8 @@ import { isRedoclyRegistryURL } from './redocly';
|
|
|
17
16
|
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './rules/oas2/remove-unused-components';
|
|
18
17
|
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './rules/oas3/remove-unused-components';
|
|
19
18
|
|
|
19
|
+
import type { Config, LintConfig } from './config';
|
|
20
|
+
|
|
20
21
|
export type Oas3RuleSet = Record<string, Oas3Rule>;
|
|
21
22
|
|
|
22
23
|
export enum OasVersion {
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`resolveConfig should ignore minimal from the root and read local file 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"decorators": Object {},
|
|
6
|
+
"doNotResolveExamples": undefined,
|
|
7
|
+
"oas2Decorators": Object {},
|
|
8
|
+
"oas2Preprocessors": Object {},
|
|
9
|
+
"oas2Rules": Object {},
|
|
10
|
+
"oas3_0Decorators": Object {},
|
|
11
|
+
"oas3_0Preprocessors": Object {},
|
|
12
|
+
"oas3_0Rules": Object {
|
|
13
|
+
"no-empty-servers": "error",
|
|
14
|
+
"no-example-value-and-externalValue": "error",
|
|
15
|
+
"no-invalid-media-type-examples": "error",
|
|
16
|
+
"no-server-example.com": "warn",
|
|
17
|
+
"no-server-trailing-slash": "error",
|
|
18
|
+
"no-servers-empty-enum": "error",
|
|
19
|
+
"no-undefined-server-variable": "error",
|
|
20
|
+
"no-unused-components": "warn",
|
|
21
|
+
},
|
|
22
|
+
"oas3_1Decorators": Object {},
|
|
23
|
+
"oas3_1Preprocessors": Object {},
|
|
24
|
+
"oas3_1Rules": Object {
|
|
25
|
+
"no-empty-servers": "error",
|
|
26
|
+
"no-example-value-and-externalValue": "error",
|
|
27
|
+
"no-server-example.com": "warn",
|
|
28
|
+
"no-server-trailing-slash": "error",
|
|
29
|
+
"no-servers-empty-enum": "error",
|
|
30
|
+
"no-undefined-server-variable": "error",
|
|
31
|
+
"no-unused-components": "warn",
|
|
32
|
+
},
|
|
33
|
+
"preprocessors": Object {},
|
|
34
|
+
"recommendedFallback": false,
|
|
35
|
+
"rules": Object {
|
|
36
|
+
"assertions": "warn",
|
|
37
|
+
"boolean-parameter-prefixes": "error",
|
|
38
|
+
"info-contact": "off",
|
|
39
|
+
"info-description": "warn",
|
|
40
|
+
"info-license": "warn",
|
|
41
|
+
"info-license-url": "warn",
|
|
42
|
+
"local/operation-id-not-test": "error",
|
|
43
|
+
"no-ambiguous-paths": "warn",
|
|
44
|
+
"no-enum-type-mismatch": "error",
|
|
45
|
+
"no-identical-paths": "error",
|
|
46
|
+
"no-invalid-media-type-examples": "error",
|
|
47
|
+
"no-path-trailing-slash": "error",
|
|
48
|
+
"no-unresolved-refs": "error",
|
|
49
|
+
"operation-2xx-response": "warn",
|
|
50
|
+
"operation-4xx-response": "error",
|
|
51
|
+
"operation-description": "error",
|
|
52
|
+
"operation-operationId": "warn",
|
|
53
|
+
"operation-operationId-unique": "error",
|
|
54
|
+
"operation-operationId-url-safe": "error",
|
|
55
|
+
"operation-parameters-unique": "error",
|
|
56
|
+
"operation-security-defined": "error",
|
|
57
|
+
"operation-singular-tag": "off",
|
|
58
|
+
"operation-summary": "error",
|
|
59
|
+
"operation-tag-defined": "off",
|
|
60
|
+
"parameter-description": "off",
|
|
61
|
+
"path-declaration-must-exist": "error",
|
|
62
|
+
"path-http-verbs-order": "error",
|
|
63
|
+
"path-not-include-query": "error",
|
|
64
|
+
"path-parameters-defined": "error",
|
|
65
|
+
"paths-kebab-case": "off",
|
|
66
|
+
"spec": "error",
|
|
67
|
+
"tag-description": "warn",
|
|
68
|
+
"tags-alphabetical": "off",
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
exports[`resolveLint should resolve extends with local file config witch contains path to nested config 1`] = `
|
|
74
|
+
Object {
|
|
75
|
+
"decorators": Object {},
|
|
76
|
+
"doNotResolveExamples": undefined,
|
|
77
|
+
"oas2Decorators": Object {},
|
|
78
|
+
"oas2Preprocessors": Object {},
|
|
79
|
+
"oas2Rules": Object {},
|
|
80
|
+
"oas3_0Decorators": Object {},
|
|
81
|
+
"oas3_0Preprocessors": Object {},
|
|
82
|
+
"oas3_0Rules": Object {
|
|
83
|
+
"no-empty-servers": "error",
|
|
84
|
+
"no-example-value-and-externalValue": "error",
|
|
85
|
+
"no-invalid-media-type-examples": "warn",
|
|
86
|
+
"no-server-example.com": "warn",
|
|
87
|
+
"no-server-trailing-slash": "error",
|
|
88
|
+
"no-servers-empty-enum": "error",
|
|
89
|
+
"no-undefined-server-variable": "error",
|
|
90
|
+
"no-unused-components": "warn",
|
|
91
|
+
},
|
|
92
|
+
"oas3_1Decorators": Object {},
|
|
93
|
+
"oas3_1Preprocessors": Object {},
|
|
94
|
+
"oas3_1Rules": Object {
|
|
95
|
+
"no-empty-servers": "error",
|
|
96
|
+
"no-example-value-and-externalValue": "error",
|
|
97
|
+
"no-server-example.com": "warn",
|
|
98
|
+
"no-server-trailing-slash": "error",
|
|
99
|
+
"no-servers-empty-enum": "error",
|
|
100
|
+
"no-undefined-server-variable": "error",
|
|
101
|
+
"no-unused-components": "warn",
|
|
102
|
+
},
|
|
103
|
+
"preprocessors": Object {},
|
|
104
|
+
"recommendedFallback": undefined,
|
|
105
|
+
"rules": Object {
|
|
106
|
+
"assertions": Array [
|
|
107
|
+
Object {
|
|
108
|
+
"assertionId": "path-item-get-defined",
|
|
109
|
+
"defined": true,
|
|
110
|
+
"message": "Every path item must have a GET operation.",
|
|
111
|
+
"property": "get",
|
|
112
|
+
"subject": "PathItem",
|
|
113
|
+
},
|
|
114
|
+
Object {
|
|
115
|
+
"assertionId": "tag-description",
|
|
116
|
+
"message": "Tag description must be at least 13 characters and end with a full stop.",
|
|
117
|
+
"minLength": 13,
|
|
118
|
+
"pattern": "/\\\\.$/",
|
|
119
|
+
"property": "description",
|
|
120
|
+
"severity": "error",
|
|
121
|
+
"subject": "Tag",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
"boolean-parameter-prefixes": "error",
|
|
125
|
+
"info-contact": "off",
|
|
126
|
+
"info-description": "warn",
|
|
127
|
+
"info-license": "warn",
|
|
128
|
+
"info-license-url": "warn",
|
|
129
|
+
"local/operation-id-not-test": "error",
|
|
130
|
+
"no-ambiguous-paths": "warn",
|
|
131
|
+
"no-enum-type-mismatch": "error",
|
|
132
|
+
"no-identical-paths": "error",
|
|
133
|
+
"no-invalid-media-type-examples": "warn",
|
|
134
|
+
"no-path-trailing-slash": "error",
|
|
135
|
+
"no-unresolved-refs": "error",
|
|
136
|
+
"operation-2xx-response": "error",
|
|
137
|
+
"operation-4xx-response": "off",
|
|
138
|
+
"operation-description": "off",
|
|
139
|
+
"operation-operationId": "warn",
|
|
140
|
+
"operation-operationId-unique": "error",
|
|
141
|
+
"operation-operationId-url-safe": "error",
|
|
142
|
+
"operation-parameters-unique": "error",
|
|
143
|
+
"operation-security-defined": "error",
|
|
144
|
+
"operation-singular-tag": "off",
|
|
145
|
+
"operation-summary": "error",
|
|
146
|
+
"operation-tag-defined": "off",
|
|
147
|
+
"parameter-description": "off",
|
|
148
|
+
"path-declaration-must-exist": "error",
|
|
149
|
+
"path-not-include-query": "error",
|
|
150
|
+
"path-parameters-defined": "error",
|
|
151
|
+
"paths-kebab-case": "off",
|
|
152
|
+
"spec": "error",
|
|
153
|
+
"tag-description": "warn",
|
|
154
|
+
"tags-alphabetical": "off",
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
`;
|