@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
package/src/redocly/index.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
|
-
import {
|
|
4
|
+
import { green } from 'colorette';
|
|
5
5
|
import { RegistryApi } from './registry-api';
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_REGION, DOMAINS, AVAILABLE_REGIONS, env } from '../config/config';
|
|
7
7
|
import { RegionalToken, RegionalTokenWithValidity } from './redocly-client-types';
|
|
8
8
|
import { isNotEmptyObject } from '../utils';
|
|
9
9
|
|
|
10
|
+
import type { AccessTokens, Region } from '../config/types';
|
|
11
|
+
|
|
10
12
|
const TOKEN_FILENAME = '.redocly-config.json';
|
|
11
13
|
|
|
12
|
-
let REDOCLY_DOMAIN: string; // workaround for the isRedoclyRegistryURL, see more below
|
|
13
14
|
export class RedoclyClient {
|
|
14
15
|
private accessTokens: AccessTokens = {};
|
|
15
16
|
private region: Region;
|
|
@@ -19,31 +20,20 @@ export class RedoclyClient {
|
|
|
19
20
|
constructor(region?: Region) {
|
|
20
21
|
this.region = this.loadRegion(region);
|
|
21
22
|
this.loadTokens();
|
|
22
|
-
this.domain = region ? DOMAINS[region] :
|
|
23
|
+
this.domain = region ? DOMAINS[region] : env.REDOCLY_DOMAIN || DOMAINS[DEFAULT_REGION];
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
* We can't use process.env here because it is replaced by a const in some client-side bundles,
|
|
26
|
-
* which breaks assignment.
|
|
27
|
-
*/
|
|
28
|
-
REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
|
|
25
|
+
env.REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
|
|
29
26
|
this.registryApi = new RegistryApi(this.accessTokens, this.region);
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
loadRegion(region?: Region) {
|
|
33
30
|
if (region && !DOMAINS[region]) {
|
|
34
|
-
|
|
35
|
-
red(
|
|
36
|
-
`Invalid argument: region in config file.\nGiven: ${green(
|
|
37
|
-
region,
|
|
38
|
-
)}, choices: "us", "eu".\n`,
|
|
39
|
-
),
|
|
40
|
-
);
|
|
41
|
-
process.exit(1);
|
|
31
|
+
throw new Error(`Invalid argument: region in config file.\nGiven: ${green(region)}, choices: "us", "eu".`);
|
|
42
32
|
}
|
|
43
33
|
|
|
44
|
-
if (
|
|
34
|
+
if (env.REDOCLY_DOMAIN) {
|
|
45
35
|
return (AVAILABLE_REGIONS.find(
|
|
46
|
-
(region) => DOMAINS[region as Region] ===
|
|
36
|
+
(region) => DOMAINS[region as Region] === env.REDOCLY_DOMAIN,
|
|
47
37
|
) || DEFAULT_REGION) as Region;
|
|
48
38
|
}
|
|
49
39
|
return region || DEFAULT_REGION;
|
|
@@ -63,18 +53,7 @@ export class RedoclyClient {
|
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
async getAuthorizationHeader(): Promise<string | undefined> {
|
|
66
|
-
|
|
67
|
-
// print this only if there is token but invalid
|
|
68
|
-
if (token && !this.isAuthorizedWithRedoclyByRegion()) {
|
|
69
|
-
process.stderr.write(
|
|
70
|
-
`${yellow(
|
|
71
|
-
'Warning:',
|
|
72
|
-
)} invalid Redocly API key. Use "npx @redocly/openapi-cli login" to provide your API key\n`,
|
|
73
|
-
);
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return token;
|
|
56
|
+
return this.accessTokens[this.region];
|
|
78
57
|
}
|
|
79
58
|
// </backward compatibility: portal>
|
|
80
59
|
|
|
@@ -94,10 +73,10 @@ export class RedoclyClient {
|
|
|
94
73
|
}),
|
|
95
74
|
});
|
|
96
75
|
}
|
|
97
|
-
if (
|
|
76
|
+
if (env.REDOCLY_AUTHORIZATION) {
|
|
98
77
|
this.setAccessTokens({
|
|
99
78
|
...this.accessTokens,
|
|
100
|
-
[this.region]:
|
|
79
|
+
[this.region]: env.REDOCLY_AUTHORIZATION,
|
|
101
80
|
});
|
|
102
81
|
}
|
|
103
82
|
}
|
|
@@ -162,15 +141,11 @@ export class RedoclyClient {
|
|
|
162
141
|
|
|
163
142
|
async login(accessToken: string, verbose: boolean = false) {
|
|
164
143
|
const credentialsPath = resolve(homedir(), TOKEN_FILENAME);
|
|
165
|
-
process.stdout.write(gray('\n Logging in...\n'));
|
|
166
144
|
|
|
167
145
|
try {
|
|
168
146
|
await this.verifyToken(accessToken, this.region, verbose);
|
|
169
147
|
} catch (err) {
|
|
170
|
-
|
|
171
|
-
red('Authorization failed. Please check if you entered a valid API key.\n'),
|
|
172
|
-
);
|
|
173
|
-
process.exit(1);
|
|
148
|
+
throw new Error('Authorization failed. Please check if you entered a valid API key.');
|
|
174
149
|
}
|
|
175
150
|
|
|
176
151
|
const credentials = {
|
|
@@ -181,7 +156,6 @@ export class RedoclyClient {
|
|
|
181
156
|
this.accessTokens = credentials;
|
|
182
157
|
this.registryApi.setAccessTokens(credentials);
|
|
183
158
|
writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2));
|
|
184
|
-
process.stdout.write(green(' Authorization confirmed. ✅\n\n'));
|
|
185
159
|
}
|
|
186
160
|
|
|
187
161
|
logout(): void {
|
|
@@ -189,12 +163,11 @@ export class RedoclyClient {
|
|
|
189
163
|
if (existsSync(credentialsPath)) {
|
|
190
164
|
unlinkSync(credentialsPath);
|
|
191
165
|
}
|
|
192
|
-
process.stdout.write('Logged out from the Redocly account. ✋\n');
|
|
193
166
|
}
|
|
194
167
|
}
|
|
195
168
|
|
|
196
169
|
export function isRedoclyRegistryURL(link: string): boolean {
|
|
197
|
-
const domain =
|
|
170
|
+
const domain = env.REDOCLY_DOMAIN || DOMAINS[DEFAULT_REGION];
|
|
198
171
|
|
|
199
172
|
const legacyDomain = domain === 'redocly.com' ? 'redoc.ly' : domain;
|
|
200
173
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import fetch, { RequestInit, HeadersInit } from 'node-fetch';
|
|
2
2
|
import { RegistryApiTypes } from './registry-api-types';
|
|
3
|
-
import {
|
|
3
|
+
import { DEFAULT_REGION, DOMAINS } from '../config/config';
|
|
4
4
|
import { isNotEmptyObject } from '../utils';
|
|
5
5
|
const version = require('../../package.json').version;
|
|
6
6
|
|
|
7
|
+
import type { AccessTokens, Region } from '../config/types';
|
|
8
|
+
|
|
7
9
|
export class RegistryApi {
|
|
8
10
|
constructor(private accessTokens: AccessTokens, private region: Region) {}
|
|
9
11
|
|
|
@@ -102,6 +104,7 @@ export class RegistryApi {
|
|
|
102
104
|
filePaths,
|
|
103
105
|
branch,
|
|
104
106
|
isUpsert,
|
|
107
|
+
isPublic,
|
|
105
108
|
}: RegistryApiTypes.PushApiParams) {
|
|
106
109
|
const response = await this.request(
|
|
107
110
|
`/${organizationId}/${name}/${version}`,
|
|
@@ -116,6 +119,7 @@ export class RegistryApi {
|
|
|
116
119
|
filePaths,
|
|
117
120
|
branch,
|
|
118
121
|
isUpsert,
|
|
122
|
+
isPublic,
|
|
119
123
|
}),
|
|
120
124
|
},
|
|
121
125
|
this.region,
|
package/src/resolve.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import * as url from 'url';
|
|
4
|
-
|
|
5
3
|
import { OasRef } from './typings/openapi';
|
|
6
4
|
import { isRef, joinPointer, escapePointer, parseRef, isAbsoluteUrl } from './ref-utils';
|
|
7
5
|
import type { YAMLNode, LoadOptions } from 'yaml-ast-parser';
|
|
8
6
|
import { NormalizedNodeType, isNamedType } from './types';
|
|
9
7
|
import { readFileFromUrl, parseYaml } from './utils';
|
|
10
|
-
import { ResolveConfig } from './config/
|
|
8
|
+
import { ResolveConfig } from './config/types';
|
|
11
9
|
|
|
12
10
|
export type CollectedRefs = Map<string /* absoluteFilePath */, Document>;
|
|
13
11
|
|
|
@@ -105,7 +103,7 @@ export class BaseResolver {
|
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
if (base && isAbsoluteUrl(base)) {
|
|
108
|
-
return
|
|
106
|
+
return new URL(ref, base).href;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
return path.resolve(base ? path.dirname(base) : process.cwd(), ref);
|
|
@@ -21,7 +21,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
|
|
|
21
21
|
const results = await lintDocument({
|
|
22
22
|
externalRefResolver: new BaseResolver(),
|
|
23
23
|
document,
|
|
24
|
-
config: makeConfig({
|
|
24
|
+
config: await makeConfig({
|
|
25
25
|
'no-unresolved-refs': 'error',
|
|
26
26
|
}),
|
|
27
27
|
});
|
|
@@ -61,7 +61,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
|
|
|
61
61
|
const results = await lintDocument({
|
|
62
62
|
externalRefResolver: new BaseResolver(),
|
|
63
63
|
document,
|
|
64
|
-
config: makeConfig({
|
|
64
|
+
config: await makeConfig({
|
|
65
65
|
'no-unresolved-refs': 'error',
|
|
66
66
|
}),
|
|
67
67
|
});
|
|
@@ -118,7 +118,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
|
|
|
118
118
|
const results = await lintDocument({
|
|
119
119
|
externalRefResolver: new BaseResolver(),
|
|
120
120
|
document,
|
|
121
|
-
config: makeConfig({
|
|
121
|
+
config: await makeConfig({
|
|
122
122
|
'no-unresolved-refs': 'error',
|
|
123
123
|
}),
|
|
124
124
|
});
|
|
@@ -142,7 +142,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
|
|
|
142
142
|
const results = await lintDocument({
|
|
143
143
|
externalRefResolver: new BaseResolver(),
|
|
144
144
|
document,
|
|
145
|
-
config: makeConfig({
|
|
145
|
+
config: await makeConfig({
|
|
146
146
|
'no-unresolved-refs': 'error',
|
|
147
147
|
}),
|
|
148
148
|
});
|
|
@@ -17,7 +17,7 @@ describe('Oas3 info-description', () => {
|
|
|
17
17
|
const results = await lintDocument({
|
|
18
18
|
externalRefResolver: new BaseResolver(),
|
|
19
19
|
document,
|
|
20
|
-
config: makeConfig({
|
|
20
|
+
config: await makeConfig({
|
|
21
21
|
'info-description': 'error',
|
|
22
22
|
}),
|
|
23
23
|
});
|
|
@@ -55,7 +55,7 @@ describe('Oas3 info-description', () => {
|
|
|
55
55
|
const results = await lintDocument({
|
|
56
56
|
externalRefResolver: new BaseResolver(),
|
|
57
57
|
document,
|
|
58
|
-
config: makeConfig({
|
|
58
|
+
config: await makeConfig({
|
|
59
59
|
'info-description': 'error',
|
|
60
60
|
}),
|
|
61
61
|
});
|
|
@@ -92,7 +92,7 @@ describe('Oas3 info-description', () => {
|
|
|
92
92
|
const results = await lintDocument({
|
|
93
93
|
externalRefResolver: new BaseResolver(),
|
|
94
94
|
document,
|
|
95
|
-
config: makeConfig({
|
|
95
|
+
config: await makeConfig({
|
|
96
96
|
'info-description': 'error',
|
|
97
97
|
}),
|
|
98
98
|
});
|
|
@@ -17,7 +17,7 @@ describe('Oas3 info-license', () => {
|
|
|
17
17
|
const results = await lintDocument({
|
|
18
18
|
externalRefResolver: new BaseResolver(),
|
|
19
19
|
document,
|
|
20
|
-
config: makeConfig({ 'info-license': 'error' }),
|
|
20
|
+
config: await makeConfig({ 'info-license': 'error' }),
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -54,7 +54,7 @@ describe('Oas3 info-license', () => {
|
|
|
54
54
|
const results = await lintDocument({
|
|
55
55
|
externalRefResolver: new BaseResolver(),
|
|
56
56
|
document,
|
|
57
|
-
config: makeConfig({ 'info-license': 'error' }),
|
|
57
|
+
config: await makeConfig({ 'info-license': 'error' }),
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -18,7 +18,7 @@ describe('Oas3 license-url', () => {
|
|
|
18
18
|
const results = await lintDocument({
|
|
19
19
|
externalRefResolver: new BaseResolver(),
|
|
20
20
|
document,
|
|
21
|
-
config: makeConfig({ 'info-license-url': 'error' }),
|
|
21
|
+
config: await makeConfig({ 'info-license-url': 'error' }),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -55,7 +55,7 @@ describe('Oas3 license-url', () => {
|
|
|
55
55
|
const results = await lintDocument({
|
|
56
56
|
externalRefResolver: new BaseResolver(),
|
|
57
57
|
document,
|
|
58
|
-
config: makeConfig({ 'info-license-url': 'error' }),
|
|
58
|
+
config: await makeConfig({ 'info-license-url': 'error' }),
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -46,7 +46,7 @@ describe('no-ambiguous-paths', () => {
|
|
|
46
46
|
const results = await lintDocument({
|
|
47
47
|
externalRefResolver: new BaseResolver(),
|
|
48
48
|
document,
|
|
49
|
-
config: makeConfig({ 'no-ambiguous-paths': 'error' }),
|
|
49
|
+
config: await makeConfig({ 'no-ambiguous-paths': 'error' }),
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -29,7 +29,7 @@ describe('Oas3 typed enum', () => {
|
|
|
29
29
|
const results = await lintDocument({
|
|
30
30
|
externalRefResolver: new BaseResolver(),
|
|
31
31
|
document,
|
|
32
|
-
config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
32
|
+
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -62,7 +62,7 @@ describe('Oas3 typed enum', () => {
|
|
|
62
62
|
const results = await lintDocument({
|
|
63
63
|
externalRefResolver: new BaseResolver(),
|
|
64
64
|
document,
|
|
65
|
-
config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
65
|
+
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -92,7 +92,7 @@ describe('Oas3 typed enum', () => {
|
|
|
92
92
|
const results = await lintDocument({
|
|
93
93
|
externalRefResolver: new BaseResolver(),
|
|
94
94
|
document,
|
|
95
|
-
config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
95
|
+
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -140,7 +140,7 @@ describe('Oas3 typed enum', () => {
|
|
|
140
140
|
const results = await lintDocument({
|
|
141
141
|
externalRefResolver: new BaseResolver(),
|
|
142
142
|
document,
|
|
143
|
-
config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
143
|
+
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -185,7 +185,7 @@ describe('Oas3 typed enum', () => {
|
|
|
185
185
|
const results = await lintDocument({
|
|
186
186
|
externalRefResolver: new BaseResolver(),
|
|
187
187
|
document,
|
|
188
|
-
config: makeConfig({ 'spec': 'error', 'no-enum-type-mismatch': 'error' }),
|
|
188
|
+
config: await makeConfig({ 'spec': 'error', 'no-enum-type-mismatch': 'error' }),
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -34,7 +34,7 @@ describe('no-identical-paths', () => {
|
|
|
34
34
|
const results = await lintDocument({
|
|
35
35
|
externalRefResolver: new BaseResolver(),
|
|
36
36
|
document,
|
|
37
|
-
config: makeConfig({ 'no-identical-paths': 'error' }),
|
|
37
|
+
config: await makeConfig({ 'no-identical-paths': 'error' }),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -19,7 +19,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
19
19
|
const results = await lintDocument({
|
|
20
20
|
externalRefResolver: new BaseResolver(),
|
|
21
21
|
document,
|
|
22
|
-
config: makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
22
|
+
config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -56,7 +56,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
56
56
|
const results = await lintDocument({
|
|
57
57
|
externalRefResolver: new BaseResolver(),
|
|
58
58
|
document,
|
|
59
|
-
config: makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
59
|
+
config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -77,7 +77,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
77
77
|
const results = await lintDocument({
|
|
78
78
|
externalRefResolver: new BaseResolver(),
|
|
79
79
|
document,
|
|
80
|
-
config: makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
80
|
+
config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -21,7 +21,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
21
21
|
const results = await lintDocument({
|
|
22
22
|
externalRefResolver: new BaseResolver(),
|
|
23
23
|
document,
|
|
24
|
-
config: makeConfig({ 'operation-2xx-response': 'error' }),
|
|
24
|
+
config: await makeConfig({ 'operation-2xx-response': 'error' }),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -60,7 +60,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
60
60
|
const results = await lintDocument({
|
|
61
61
|
externalRefResolver: new BaseResolver(),
|
|
62
62
|
document,
|
|
63
|
-
config: makeConfig({ 'operation-2xx-response': 'error' }),
|
|
63
|
+
config: await makeConfig({ 'operation-2xx-response': 'error' }),
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -83,7 +83,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
83
83
|
const results = await lintDocument({
|
|
84
84
|
externalRefResolver: new BaseResolver(),
|
|
85
85
|
document,
|
|
86
|
-
config: makeConfig({ 'operation-2xx-response': 'error' }),
|
|
86
|
+
config: await makeConfig({ 'operation-2xx-response': 'error' }),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -21,7 +21,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
21
21
|
const results = await lintDocument({
|
|
22
22
|
externalRefResolver: new BaseResolver(),
|
|
23
23
|
document,
|
|
24
|
-
config: makeConfig({ 'operation-4xx-response': 'error' }),
|
|
24
|
+
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -60,7 +60,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
60
60
|
const results = await lintDocument({
|
|
61
61
|
externalRefResolver: new BaseResolver(),
|
|
62
62
|
document,
|
|
63
|
-
config: makeConfig({ 'operation-4xx-response': 'error' }),
|
|
63
|
+
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -83,7 +83,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
83
83
|
const results = await lintDocument({
|
|
84
84
|
externalRefResolver: new BaseResolver(),
|
|
85
85
|
document,
|
|
86
|
-
config: makeConfig({ 'operation-4xx-response': 'error' }),
|
|
86
|
+
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -26,7 +26,7 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
26
26
|
const results = await lintDocument({
|
|
27
27
|
externalRefResolver: new BaseResolver(),
|
|
28
28
|
document,
|
|
29
|
-
config: makeConfig({ 'operation-operationId-unique': 'error' }),
|
|
29
|
+
config: await makeConfig({ 'operation-operationId-unique': 'error' }),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -68,7 +68,7 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
68
68
|
const results = await lintDocument({
|
|
69
69
|
externalRefResolver: new BaseResolver(),
|
|
70
70
|
document,
|
|
71
|
-
config: makeConfig({ 'peration-operationId-unique': 'error' }),
|
|
71
|
+
config: await makeConfig({ 'peration-operationId-unique': 'error' }),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -21,7 +21,7 @@ describe('Oas3 operation-operationId-url-safe', () => {
|
|
|
21
21
|
const results = await lintDocument({
|
|
22
22
|
externalRefResolver: new BaseResolver(),
|
|
23
23
|
document,
|
|
24
|
-
config: makeConfig({ 'operation-operationId-url-safe': 'error' }),
|
|
24
|
+
config: await makeConfig({ 'operation-operationId-url-safe': 'error' }),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -22,7 +22,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
22
22
|
const results = await lintDocument({
|
|
23
23
|
externalRefResolver: new BaseResolver(),
|
|
24
24
|
document,
|
|
25
|
-
config: makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
25
|
+
config: await makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -65,7 +65,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
65
65
|
const results = await lintDocument({
|
|
66
66
|
externalRefResolver: new BaseResolver(),
|
|
67
67
|
document,
|
|
68
|
-
config: makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
68
|
+
config: await makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -95,7 +95,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
95
95
|
const results = await lintDocument({
|
|
96
96
|
externalRefResolver: new BaseResolver(),
|
|
97
97
|
document,
|
|
98
|
-
config: makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
98
|
+
config: await makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -143,7 +143,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
143
143
|
const results = await lintDocument({
|
|
144
144
|
externalRefResolver: new BaseResolver(),
|
|
145
145
|
document,
|
|
146
|
-
config: makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
146
|
+
config: await makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -19,7 +19,7 @@ describe('Oas3 operation-security-defined', () => {
|
|
|
19
19
|
const results = await lintDocument({
|
|
20
20
|
externalRefResolver: new BaseResolver(),
|
|
21
21
|
document,
|
|
22
|
-
config: makeConfig({ 'operation-security-defined': 'error' }),
|
|
22
|
+
config: await makeConfig({ 'operation-security-defined': 'error' }),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -61,7 +61,7 @@ describe('Oas3 operation-security-defined', () => {
|
|
|
61
61
|
const results = await lintDocument({
|
|
62
62
|
externalRefResolver: new BaseResolver(),
|
|
63
63
|
document,
|
|
64
|
-
config: makeConfig({ 'operation-security-defined': 'error' }),
|
|
64
|
+
config: await makeConfig({ 'operation-security-defined': 'error' }),
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -24,7 +24,7 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
24
24
|
const results = await lintDocument({
|
|
25
25
|
externalRefResolver: new BaseResolver(),
|
|
26
26
|
document,
|
|
27
|
-
config: makeConfig({ 'operation-singular-tag': 'error' }),
|
|
27
|
+
config: await makeConfig({ 'operation-singular-tag': 'error' }),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -64,7 +64,7 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
64
64
|
const results = await lintDocument({
|
|
65
65
|
externalRefResolver: new BaseResolver(),
|
|
66
66
|
document,
|
|
67
|
-
config: makeConfig({ 'operation-singular-tag': 'error' }),
|
|
67
|
+
config: await makeConfig({ 'operation-singular-tag': 'error' }),
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -23,7 +23,7 @@ describe('Common path-http-verbs-order', () => {
|
|
|
23
23
|
const results = await lintDocument({
|
|
24
24
|
externalRefResolver: new BaseResolver(),
|
|
25
25
|
document,
|
|
26
|
-
config: makeConfig({ 'path-http-verbs-order': 'error' }),
|
|
26
|
+
config: await makeConfig({ 'path-http-verbs-order': 'error' }),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -87,7 +87,7 @@ describe('Common path-http-verbs-order', () => {
|
|
|
87
87
|
const results = await lintDocument({
|
|
88
88
|
externalRefResolver: new BaseResolver(),
|
|
89
89
|
document,
|
|
90
|
-
config: makeConfig({ 'path-http-verbs-order': 'error' }),
|
|
90
|
+
config: await makeConfig({ 'path-http-verbs-order': 'error' }),
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -19,7 +19,7 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
19
19
|
const results = await lintDocument({
|
|
20
20
|
externalRefResolver: new BaseResolver(),
|
|
21
21
|
document,
|
|
22
|
-
config: makeConfig({ 'path-not-include-query': 'error' }),
|
|
22
|
+
config: await makeConfig({ 'path-not-include-query': 'error' }),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -56,7 +56,7 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
56
56
|
const results = await lintDocument({
|
|
57
57
|
externalRefResolver: new BaseResolver(),
|
|
58
58
|
document,
|
|
59
|
-
config: makeConfig({ 'path-not-include-query': 'error' }),
|
|
59
|
+
config: await makeConfig({ 'path-not-include-query': 'error' }),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -24,7 +24,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
24
24
|
const results = await lintDocument({
|
|
25
25
|
externalRefResolver: new BaseResolver(),
|
|
26
26
|
document,
|
|
27
|
-
config: makeConfig({ 'path-params-defined': 'error' }),
|
|
27
|
+
config: await makeConfig({ 'path-params-defined': 'error' }),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
@@ -52,7 +52,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
52
52
|
const results = await lintDocument({
|
|
53
53
|
externalRefResolver: new BaseResolver(),
|
|
54
54
|
document,
|
|
55
|
-
config: makeConfig({ 'path-params-defined': 'error' }),
|
|
55
|
+
config: await makeConfig({ 'path-params-defined': 'error' }),
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -96,7 +96,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
96
96
|
const results = await lintDocument({
|
|
97
97
|
externalRefResolver: new BaseResolver(),
|
|
98
98
|
document,
|
|
99
|
-
config: makeConfig({ 'path-params-defined': 'error' }),
|
|
99
|
+
config: await makeConfig({ 'path-params-defined': 'error' }),
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -22,7 +22,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
22
22
|
const results = await lintDocument({
|
|
23
23
|
externalRefResolver: new BaseResolver(),
|
|
24
24
|
document,
|
|
25
|
-
config: makeConfig({ 'paths-kebab-case': 'error' }),
|
|
25
|
+
config: await makeConfig({ 'paths-kebab-case': 'error' }),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -61,7 +61,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
61
61
|
const results = await lintDocument({
|
|
62
62
|
externalRefResolver: new BaseResolver(),
|
|
63
63
|
document,
|
|
64
|
-
config: makeConfig({ 'paths-kebab-case': 'error' }),
|
|
64
|
+
config: await makeConfig({ 'paths-kebab-case': 'error' }),
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -98,7 +98,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
98
98
|
const results = await lintDocument({
|
|
99
99
|
externalRefResolver: new BaseResolver(),
|
|
100
100
|
document,
|
|
101
|
-
config: makeConfig({
|
|
101
|
+
config: await makeConfig({
|
|
102
102
|
'paths-kebab-case': 'error',
|
|
103
103
|
'no-path-trailing-slash': 'off',
|
|
104
104
|
}),
|
|
@@ -25,7 +25,7 @@ describe('Oas3 spec', () => {
|
|
|
25
25
|
const results = await lintDocument({
|
|
26
26
|
externalRefResolver: new BaseResolver(),
|
|
27
27
|
document,
|
|
28
|
-
config: makeConfig({ 'spec': 'error' }),
|
|
28
|
+
config: await makeConfig({ 'spec': 'error' }),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|