@redocly/openapi-core 1.31.3 → 1.32.1
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 +16 -0
- package/lib/bundle.js +5 -0
- package/lib/config/all.js +3 -0
- package/lib/config/builtIn.js +5 -0
- package/lib/config/config-resolvers.js +34 -6
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +16 -0
- package/lib/config/minimal.js +3 -0
- package/lib/config/recommended-strict.js +3 -0
- package/lib/config/recommended.js +3 -0
- package/lib/config/rules.d.ts +2 -2
- package/lib/config/spec.js +3 -0
- package/lib/config/types.d.ts +8 -2
- package/lib/config/utils.js +13 -1
- package/lib/decorators/overlay1/index.d.ts +1 -0
- package/lib/decorators/overlay1/index.js +4 -0
- package/lib/oas-types.d.ts +9 -4
- package/lib/oas-types.js +10 -0
- package/lib/rules/common/assertions/index.d.ts +2 -2
- package/lib/rules/common/struct.d.ts +2 -2
- package/lib/rules/overlay1/index.d.ts +3 -0
- package/lib/rules/overlay1/index.js +12 -0
- package/lib/types/oas2.js +1 -1
- package/lib/types/oas3.js +1 -1
- package/lib/types/redocly-yaml.d.ts +2 -0
- package/lib/types/redocly-yaml.js +2 -0
- package/lib/typings/openapi.d.ts +2 -2
- package/lib/visitors.d.ts +11 -0
- package/package.json +1 -1
- package/src/bundle.ts +5 -0
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +10 -0
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +24 -0
- package/src/config/__tests__/config.test.ts +11 -0
- package/src/config/all.ts +3 -0
- package/src/config/builtIn.ts +5 -0
- package/src/config/config-resolvers.ts +36 -6
- package/src/config/config.ts +20 -0
- package/src/config/minimal.ts +3 -0
- package/src/config/recommended-strict.ts +3 -0
- package/src/config/recommended.ts +3 -0
- package/src/config/rules.ts +9 -1
- package/src/config/spec.ts +3 -0
- package/src/config/types.ts +13 -1
- package/src/config/utils.ts +15 -0
- package/src/decorators/overlay1/index.ts +1 -0
- package/src/lint.ts +3 -0
- package/src/oas-types.ts +20 -0
- package/src/rules/common/assertions/index.ts +9 -2
- package/src/rules/common/struct.ts +16 -3
- package/src/rules/overlay1/__tests__/info-contact.test.ts +112 -0
- package/src/rules/overlay1/index.ts +14 -0
- package/src/types/oas2.ts +1 -1
- package/src/types/oas3.ts +1 -1
- package/src/types/redocly-yaml.ts +5 -0
- package/src/typings/openapi.ts +2 -2
- package/src/visitors.ts +19 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @redocly/openapi-core
|
|
2
2
|
|
|
3
|
+
## 1.32.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed the `x-example` property in Swagger 2.0 to accept any data type, rather than requiring it to be an object.
|
|
8
|
+
|
|
9
|
+
## 1.32.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Added support for linting, preprocessors, decorators, and type extensions for Overlay v1 documents.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated OAS3 Schema type definition to correct `type` keyword enum, removed `null`.
|
|
18
|
+
|
|
3
19
|
## 1.31.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/lib/bundle.js
CHANGED
|
@@ -211,6 +211,11 @@ function mapTypeToComponent(typeName, version) {
|
|
|
211
211
|
default:
|
|
212
212
|
return null;
|
|
213
213
|
}
|
|
214
|
+
case oas_types_1.SpecMajorVersion.Overlay1:
|
|
215
|
+
switch (typeName) {
|
|
216
|
+
default:
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
214
219
|
}
|
|
215
220
|
}
|
|
216
221
|
function replaceRef(ref, resolved, ctx) {
|
package/lib/config/all.js
CHANGED
package/lib/config/builtIn.js
CHANGED
|
@@ -11,11 +11,13 @@ const oas2_1 = require("../rules/oas2");
|
|
|
11
11
|
const async2_1 = require("../rules/async2");
|
|
12
12
|
const async3_1 = require("../rules/async3");
|
|
13
13
|
const arazzo_1 = require("../rules/arazzo");
|
|
14
|
+
const overlay1_1 = require("../rules/overlay1");
|
|
14
15
|
const oas3_2 = require("../decorators/oas3");
|
|
15
16
|
const oas2_2 = require("../decorators/oas2");
|
|
16
17
|
const async2_2 = require("../decorators/async2");
|
|
17
18
|
const async3_2 = require("../decorators/async3");
|
|
18
19
|
const arazzo_2 = require("../decorators/arazzo");
|
|
20
|
+
const overlay1_2 = require("../decorators/overlay1");
|
|
19
21
|
exports.builtInConfigs = {
|
|
20
22
|
recommended: recommended_1.default,
|
|
21
23
|
'recommended-strict': recommended_strict_1.default,
|
|
@@ -34,6 +36,7 @@ exports.defaultPlugin = {
|
|
|
34
36
|
async2: async2_1.rules,
|
|
35
37
|
async3: async3_1.rules,
|
|
36
38
|
arazzo1: arazzo_1.rules,
|
|
39
|
+
overlay1: overlay1_1.rules,
|
|
37
40
|
},
|
|
38
41
|
preprocessors: {
|
|
39
42
|
oas3: oas3_1.preprocessors,
|
|
@@ -41,6 +44,7 @@ exports.defaultPlugin = {
|
|
|
41
44
|
async2: async2_1.preprocessors,
|
|
42
45
|
async3: async3_1.preprocessors,
|
|
43
46
|
arazzo1: arazzo_1.preprocessors,
|
|
47
|
+
overlay1: overlay1_1.preprocessors,
|
|
44
48
|
},
|
|
45
49
|
decorators: {
|
|
46
50
|
oas3: oas3_2.decorators,
|
|
@@ -48,6 +52,7 @@ exports.defaultPlugin = {
|
|
|
48
52
|
async2: async2_2.decorators,
|
|
49
53
|
async3: async3_2.decorators,
|
|
50
54
|
arazzo1: arazzo_2.decorators,
|
|
55
|
+
overlay1: overlay1_2.decorators,
|
|
51
56
|
},
|
|
52
57
|
configs: exports.builtInConfigs,
|
|
53
58
|
};
|
|
@@ -167,8 +167,13 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
167
167
|
...(pluginModule.typeExtension ? { typeExtension: pluginModule.typeExtension } : {}),
|
|
168
168
|
};
|
|
169
169
|
if (pluginModule.rules) {
|
|
170
|
-
if (!pluginModule.rules.oas3 &&
|
|
171
|
-
|
|
170
|
+
if (!pluginModule.rules.oas3 &&
|
|
171
|
+
!pluginModule.rules.oas2 &&
|
|
172
|
+
!pluginModule.rules.async2 &&
|
|
173
|
+
!pluginModule.rules.async3 &&
|
|
174
|
+
!pluginModule.rules.arazzo1 &&
|
|
175
|
+
!pluginModule.rules.overlay1) {
|
|
176
|
+
throw new Error(`Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo\`, or \`overlay1\` rules "${p}.`);
|
|
172
177
|
}
|
|
173
178
|
plugin.rules = {};
|
|
174
179
|
if (pluginModule.rules.oas3) {
|
|
@@ -186,14 +191,18 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
186
191
|
if (pluginModule.rules.arazzo1) {
|
|
187
192
|
plugin.rules.arazzo1 = (0, utils_2.prefixRules)(pluginModule.rules.arazzo1, id);
|
|
188
193
|
}
|
|
194
|
+
if (pluginModule.rules.overlay1) {
|
|
195
|
+
plugin.rules.overlay1 = (0, utils_2.prefixRules)(pluginModule.rules.overlay1, id);
|
|
196
|
+
}
|
|
189
197
|
}
|
|
190
198
|
if (pluginModule.preprocessors) {
|
|
191
199
|
if (!pluginModule.preprocessors.oas3 &&
|
|
192
200
|
!pluginModule.preprocessors.oas2 &&
|
|
193
201
|
!pluginModule.preprocessors.async2 &&
|
|
194
202
|
!pluginModule.preprocessors.async3 &&
|
|
195
|
-
!pluginModule.preprocessors.arazzo1
|
|
196
|
-
|
|
203
|
+
!pluginModule.preprocessors.arazzo1 &&
|
|
204
|
+
!pluginModule.preprocessors.overlay1) {
|
|
205
|
+
throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, or \`overlay1\` preprocessors "${p}.`);
|
|
197
206
|
}
|
|
198
207
|
plugin.preprocessors = {};
|
|
199
208
|
if (pluginModule.preprocessors.oas3) {
|
|
@@ -211,14 +220,18 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
211
220
|
if (pluginModule.preprocessors.arazzo1) {
|
|
212
221
|
plugin.preprocessors.arazzo1 = (0, utils_2.prefixRules)(pluginModule.preprocessors.arazzo1, id);
|
|
213
222
|
}
|
|
223
|
+
if (pluginModule.preprocessors.overlay1) {
|
|
224
|
+
plugin.preprocessors.overlay1 = (0, utils_2.prefixRules)(pluginModule.preprocessors.overlay1, id);
|
|
225
|
+
}
|
|
214
226
|
}
|
|
215
227
|
if (pluginModule.decorators) {
|
|
216
228
|
if (!pluginModule.decorators.oas3 &&
|
|
217
229
|
!pluginModule.decorators.oas2 &&
|
|
218
230
|
!pluginModule.decorators.async2 &&
|
|
219
231
|
!pluginModule.decorators.async3 &&
|
|
220
|
-
!pluginModule.decorators.arazzo1
|
|
221
|
-
|
|
232
|
+
!pluginModule.decorators.arazzo1 &&
|
|
233
|
+
!pluginModule.decorators.overlay1) {
|
|
234
|
+
throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\`, \`arazzo1\`, or \`overlay1\` decorators "${p}.`);
|
|
222
235
|
}
|
|
223
236
|
plugin.decorators = {};
|
|
224
237
|
if (pluginModule.decorators.oas3) {
|
|
@@ -236,6 +249,9 @@ async function resolvePlugins(plugins, configDir = '') {
|
|
|
236
249
|
if (pluginModule.decorators.arazzo1) {
|
|
237
250
|
plugin.decorators.arazzo1 = (0, utils_2.prefixRules)(pluginModule.decorators.arazzo1, id);
|
|
238
251
|
}
|
|
252
|
+
if (pluginModule.decorators.overlay1) {
|
|
253
|
+
plugin.decorators.overlay1 = (0, utils_2.prefixRules)(pluginModule.decorators.overlay1, id);
|
|
254
|
+
}
|
|
239
255
|
}
|
|
240
256
|
if (pluginModule.assertions) {
|
|
241
257
|
plugin.assertions = pluginModule.assertions;
|
|
@@ -359,6 +375,10 @@ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig)
|
|
|
359
375
|
async2Rules: { ...rootStyleguideConfig?.async2Rules, ...apiStyleguideConfig?.async2Rules },
|
|
360
376
|
async3Rules: { ...rootStyleguideConfig?.async3Rules, ...apiStyleguideConfig?.async3Rules },
|
|
361
377
|
arazzo1Rules: { ...rootStyleguideConfig?.arazzo1Rules, ...apiStyleguideConfig?.arazzo1Rules },
|
|
378
|
+
overlay1Rules: {
|
|
379
|
+
...rootStyleguideConfig?.overlay1Rules,
|
|
380
|
+
...apiStyleguideConfig?.overlay1Rules,
|
|
381
|
+
},
|
|
362
382
|
preprocessors: {
|
|
363
383
|
...rootStyleguideConfig?.preprocessors,
|
|
364
384
|
...apiStyleguideConfig?.preprocessors,
|
|
@@ -375,6 +395,10 @@ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig)
|
|
|
375
395
|
...rootStyleguideConfig?.oas3_1Preprocessors,
|
|
376
396
|
...apiStyleguideConfig?.oas3_1Preprocessors,
|
|
377
397
|
},
|
|
398
|
+
overlay1Preprocessors: {
|
|
399
|
+
...rootStyleguideConfig?.overlay1Preprocessors,
|
|
400
|
+
...apiStyleguideConfig?.overlay1Preprocessors,
|
|
401
|
+
},
|
|
378
402
|
decorators: { ...rootStyleguideConfig?.decorators, ...apiStyleguideConfig?.decorators },
|
|
379
403
|
oas2Decorators: {
|
|
380
404
|
...rootStyleguideConfig?.oas2Decorators,
|
|
@@ -388,6 +412,10 @@ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig)
|
|
|
388
412
|
...rootStyleguideConfig?.oas3_1Decorators,
|
|
389
413
|
...apiStyleguideConfig?.oas3_1Decorators,
|
|
390
414
|
},
|
|
415
|
+
overlay1Decorators: {
|
|
416
|
+
...rootStyleguideConfig?.overlay1Decorators,
|
|
417
|
+
...apiStyleguideConfig?.overlay1Decorators,
|
|
418
|
+
},
|
|
391
419
|
recommendedFallback: apiStyleguideConfig?.extends
|
|
392
420
|
? false
|
|
393
421
|
: rootStyleguideConfig.recommendedFallback,
|
package/lib/config/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpecVersion, SpecMajorVersion } from '../oas-types';
|
|
2
2
|
import type { NormalizedProblem } from '../walk';
|
|
3
|
-
import type { Oas2RuleSet, Oas3RuleSet, Async3RuleSet, Arazzo1RuleSet } from '../oas-types';
|
|
3
|
+
import type { Oas2RuleSet, Oas3RuleSet, Async3RuleSet, Arazzo1RuleSet, Overlay1RuleSet } from '../oas-types';
|
|
4
4
|
import type { NodeType } from '../types';
|
|
5
5
|
import type { DecoratorConfig, Plugin, PreprocessorConfig, Region, ResolveConfig, ResolvedApi, ResolvedConfig, ResolvedStyleguideConfig, RuleConfig, RuleSettings, Telemetry, ThemeRawConfig } from './types';
|
|
6
6
|
export declare const IGNORE_FILE = ".redocly.lint-ignore.yaml";
|
|
@@ -32,7 +32,7 @@ export declare class StyleguideConfig {
|
|
|
32
32
|
preprocessors: string[];
|
|
33
33
|
decorators: string[];
|
|
34
34
|
};
|
|
35
|
-
getRulesForSpecVersion(version: SpecMajorVersion): Oas3RuleSet[] | Oas2RuleSet[] | Async3RuleSet[] | Arazzo1RuleSet[];
|
|
35
|
+
getRulesForSpecVersion(version: SpecMajorVersion): Oas3RuleSet[] | Oas2RuleSet[] | Async3RuleSet[] | Arazzo1RuleSet[] | Overlay1RuleSet[];
|
|
36
36
|
skipRules(rules?: string[]): void;
|
|
37
37
|
skipPreprocessors(preprocessors?: string[]): void;
|
|
38
38
|
skipDecorators(decorators?: string[]): void;
|
package/lib/config/config.js
CHANGED
|
@@ -40,6 +40,7 @@ class StyleguideConfig {
|
|
|
40
40
|
'async2Rules',
|
|
41
41
|
'async3Rules',
|
|
42
42
|
'arazzo1Rules',
|
|
43
|
+
'overlay1Rules',
|
|
43
44
|
];
|
|
44
45
|
replaceSpecWithStruct(ruleGroups, rawConfig);
|
|
45
46
|
this.rules = {
|
|
@@ -49,6 +50,7 @@ class StyleguideConfig {
|
|
|
49
50
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
|
50
51
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
|
51
52
|
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.rules, ...rawConfig.arazzo1Rules },
|
|
53
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.rules, ...rawConfig.overlay1Rules },
|
|
52
54
|
};
|
|
53
55
|
this.preprocessors = {
|
|
54
56
|
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.preprocessors, ...rawConfig.oas2Preprocessors },
|
|
@@ -57,6 +59,7 @@ class StyleguideConfig {
|
|
|
57
59
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.preprocessors, ...rawConfig.async2Preprocessors },
|
|
58
60
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.preprocessors, ...rawConfig.async3Preprocessors },
|
|
59
61
|
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Preprocessors },
|
|
62
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.preprocessors, ...rawConfig.overlay1Preprocessors },
|
|
60
63
|
};
|
|
61
64
|
this.decorators = {
|
|
62
65
|
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.decorators, ...rawConfig.oas2Decorators },
|
|
@@ -65,6 +68,7 @@ class StyleguideConfig {
|
|
|
65
68
|
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.decorators, ...rawConfig.async2Decorators },
|
|
66
69
|
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.decorators, ...rawConfig.async3Decorators },
|
|
67
70
|
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Decorators },
|
|
71
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.decorators, ...rawConfig.overlay1Decorators },
|
|
68
72
|
};
|
|
69
73
|
this.extendPaths = rawConfig.extendPaths || [];
|
|
70
74
|
this.pluginPaths = rawConfig.pluginPaths || [];
|
|
@@ -156,6 +160,11 @@ class StyleguideConfig {
|
|
|
156
160
|
continue;
|
|
157
161
|
extendedTypes = plugin.typeExtension.arazzo1(extendedTypes, version);
|
|
158
162
|
break;
|
|
163
|
+
case oas_types_1.SpecVersion.Overlay1:
|
|
164
|
+
if (!plugin.typeExtension.overlay1)
|
|
165
|
+
continue;
|
|
166
|
+
extendedTypes = plugin.typeExtension.overlay1(extendedTypes, version);
|
|
167
|
+
break;
|
|
159
168
|
default:
|
|
160
169
|
throw new Error('Not implemented');
|
|
161
170
|
}
|
|
@@ -254,6 +263,13 @@ class StyleguideConfig {
|
|
|
254
263
|
this.plugins.forEach((p) => p.rules?.arazzo1 && arazzo1Rules.push(p.rules.arazzo1));
|
|
255
264
|
this.plugins.forEach((p) => p.decorators?.arazzo1 && arazzo1Rules.push(p.decorators.arazzo1));
|
|
256
265
|
return arazzo1Rules;
|
|
266
|
+
case oas_types_1.SpecMajorVersion.Overlay1:
|
|
267
|
+
// eslint-disable-next-line no-case-declarations
|
|
268
|
+
const overlay1Rules = [];
|
|
269
|
+
this.plugins.forEach((p) => p.preprocessors?.overlay1 && overlay1Rules.push(p.preprocessors.overlay1));
|
|
270
|
+
this.plugins.forEach((p) => p.rules?.overlay1 && overlay1Rules.push(p.rules.overlay1));
|
|
271
|
+
this.plugins.forEach((p) => p.decorators?.overlay1 && overlay1Rules.push(p.decorators.overlay1));
|
|
272
|
+
return overlay1Rules;
|
|
257
273
|
}
|
|
258
274
|
}
|
|
259
275
|
skipRules(rules) {
|
package/lib/config/minimal.js
CHANGED
package/lib/config/rules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Arazzo1RuleSet, Async2RuleSet, Async3RuleSet, Oas2RuleSet, Oas3RuleSet, SpecVersion } from '../oas-types';
|
|
1
|
+
import type { Arazzo1RuleSet, Async2RuleSet, Async3RuleSet, Oas2RuleSet, Oas3RuleSet, Overlay1RuleSet, SpecVersion } from '../oas-types';
|
|
2
2
|
import type { StyleguideConfig } from './config';
|
|
3
3
|
import type { ProblemSeverity } from '../walk';
|
|
4
4
|
type InitializedRule = {
|
|
@@ -6,5 +6,5 @@ type InitializedRule = {
|
|
|
6
6
|
ruleId: string;
|
|
7
7
|
visitor: any;
|
|
8
8
|
};
|
|
9
|
-
export declare function initRules(rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet | Arazzo1RuleSet)[], config: StyleguideConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: SpecVersion): InitializedRule[];
|
|
9
|
+
export declare function initRules(rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet | Arazzo1RuleSet | Overlay1RuleSet)[], config: StyleguideConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: SpecVersion): InitializedRule[];
|
|
10
10
|
export {};
|
package/lib/config/spec.js
CHANGED
package/lib/config/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Location } from '../ref-utils';
|
|
2
2
|
import type { ProblemSeverity, UserContext } from '../walk';
|
|
3
|
-
import type { Oas3PreprocessorsSet, SpecMajorVersion, Oas3DecoratorsSet, Oas2RuleSet, Oas2PreprocessorsSet, Oas2DecoratorsSet, Oas3RuleSet, SpecVersion, Async2PreprocessorsSet, Async2DecoratorsSet, Async2RuleSet, Async3PreprocessorsSet, Async3DecoratorsSet, Async3RuleSet, Arazzo1RuleSet, Arazzo1PreprocessorsSet, Arazzo1DecoratorsSet, RuleMap } from '../oas-types';
|
|
3
|
+
import type { Oas3PreprocessorsSet, SpecMajorVersion, Oas3DecoratorsSet, Oas2RuleSet, Oas2PreprocessorsSet, Oas2DecoratorsSet, Oas3RuleSet, SpecVersion, Async2PreprocessorsSet, Async2DecoratorsSet, Async2RuleSet, Async3PreprocessorsSet, Async3DecoratorsSet, Async3RuleSet, Arazzo1RuleSet, Arazzo1PreprocessorsSet, Arazzo1DecoratorsSet, RuleMap, Overlay1PreprocessorsSet, Overlay1DecoratorsSet, Overlay1RuleSet } from '../oas-types';
|
|
4
4
|
import type { NodeType } from '../types';
|
|
5
5
|
import type { SkipFunctionContext } from '../visitors';
|
|
6
6
|
import type { JSONSchema } from 'json-schema-to-ts';
|
|
@@ -27,6 +27,7 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
27
27
|
async2Rules?: RuleMap<string, RuleConfig, T>;
|
|
28
28
|
async3Rules?: RuleMap<string, RuleConfig, T>;
|
|
29
29
|
arazzo1Rules?: RuleMap<string, RuleConfig, T>;
|
|
30
|
+
overlay1Rules?: RuleMap<string, RuleConfig, T>;
|
|
30
31
|
preprocessors?: Record<string, PreprocessorConfig>;
|
|
31
32
|
oas2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
32
33
|
oas3_0Preprocessors?: Record<string, PreprocessorConfig>;
|
|
@@ -34,6 +35,7 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
34
35
|
async2Preprocessors?: Record<string, PreprocessorConfig>;
|
|
35
36
|
async3Preprocessors?: Record<string, PreprocessorConfig>;
|
|
36
37
|
arazzo1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
38
|
+
overlay1Preprocessors?: Record<string, PreprocessorConfig>;
|
|
37
39
|
decorators?: Record<string, DecoratorConfig>;
|
|
38
40
|
oas2Decorators?: Record<string, DecoratorConfig>;
|
|
39
41
|
oas3_0Decorators?: Record<string, DecoratorConfig>;
|
|
@@ -41,6 +43,7 @@ export type StyleguideRawConfig<T = undefined> = {
|
|
|
41
43
|
async2Decorators?: Record<string, DecoratorConfig>;
|
|
42
44
|
async3Decorators?: Record<string, DecoratorConfig>;
|
|
43
45
|
arazzo1Decorators?: Record<string, DecoratorConfig>;
|
|
46
|
+
overlay1Decorators?: Record<string, DecoratorConfig>;
|
|
44
47
|
};
|
|
45
48
|
export type ApiStyleguideRawConfig = Omit<StyleguideRawConfig, 'plugins'>;
|
|
46
49
|
export type ResolvedStyleguideConfig = PluginStyleguideConfig & {
|
|
@@ -56,6 +59,7 @@ export type PreprocessorsConfig = {
|
|
|
56
59
|
async2?: Async2PreprocessorsSet;
|
|
57
60
|
async3?: Async3PreprocessorsSet;
|
|
58
61
|
arazzo1?: Arazzo1PreprocessorsSet;
|
|
62
|
+
overlay1?: Overlay1PreprocessorsSet;
|
|
59
63
|
};
|
|
60
64
|
export type DecoratorsConfig = {
|
|
61
65
|
oas3?: Oas3DecoratorsSet;
|
|
@@ -63,6 +67,7 @@ export type DecoratorsConfig = {
|
|
|
63
67
|
async2?: Async2DecoratorsSet;
|
|
64
68
|
async3?: Async3DecoratorsSet;
|
|
65
69
|
arazzo1?: Arazzo1DecoratorsSet;
|
|
70
|
+
overlay1?: Overlay1DecoratorsSet;
|
|
66
71
|
};
|
|
67
72
|
export type TypesExtensionFn = (types: Record<string, NodeType>, oasVersion: SpecVersion) => Record<string, NodeType>;
|
|
68
73
|
export type TypeExtensionsConfig = Partial<Record<SpecMajorVersion, TypesExtensionFn>>;
|
|
@@ -72,6 +77,7 @@ export type RulesConfig<T> = {
|
|
|
72
77
|
async2?: Async2RuleSet<T>;
|
|
73
78
|
async3?: Async3RuleSet<T>;
|
|
74
79
|
arazzo1?: Arazzo1RuleSet<T>;
|
|
80
|
+
overlay1?: Overlay1RuleSet<T>;
|
|
75
81
|
};
|
|
76
82
|
export type CustomRulesConfig = RulesConfig<undefined>;
|
|
77
83
|
export type AssertionContext = Partial<UserContext> & SkipFunctionContext & {
|
|
@@ -185,5 +191,5 @@ export type ThemeRawConfig = {
|
|
|
185
191
|
openapi?: Record<string, any>;
|
|
186
192
|
mockServer?: Record<string, any>;
|
|
187
193
|
};
|
|
188
|
-
export type RulesFields = 'rules' | 'oas2Rules' | 'oas3_0Rules' | 'oas3_1Rules' | 'async2Rules' | 'async3Rules' | 'arazzo1Rules' | 'preprocessors' | 'oas2Preprocessors' | 'oas3_0Preprocessors' | 'oas3_1Preprocessors' | 'async2Preprocessors' | 'async3Preprocessors' | 'arazzo1Preprocessors' | 'decorators' | 'oas2Decorators' | 'oas3_0Decorators' | 'oas3_1Decorators' | 'async2Decorators' | 'async3Decorators' | 'arazzo1Decorators';
|
|
194
|
+
export type RulesFields = 'rules' | 'oas2Rules' | 'oas3_0Rules' | 'oas3_1Rules' | 'async2Rules' | 'async3Rules' | 'arazzo1Rules' | 'overlay1Rules' | 'preprocessors' | 'oas2Preprocessors' | 'oas3_0Preprocessors' | 'oas3_1Preprocessors' | 'async2Preprocessors' | 'async3Preprocessors' | 'arazzo1Preprocessors' | 'overlay1Preprocessors' | 'decorators' | 'oas2Decorators' | 'oas3_0Decorators' | 'oas3_1Decorators' | 'async2Decorators' | 'async3Decorators' | 'arazzo1Decorators' | 'overlay1Decorators';
|
|
189
195
|
export {};
|
package/lib/config/utils.js
CHANGED
|
@@ -34,7 +34,7 @@ function transformApiDefinitionsToApis(apiDefinitions) {
|
|
|
34
34
|
}
|
|
35
35
|
return apis;
|
|
36
36
|
}
|
|
37
|
-
function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_0Rules, oas3_1Rules, async2Rules, async3Rules, arazzo1Rules, preprocessors, oas2Preprocessors, oas3_0Preprocessors, oas3_1Preprocessors, async2Preprocessors, async3Preprocessors, arazzo1Preprocessors, decorators, oas2Decorators, oas3_0Decorators, oas3_1Decorators, async2Decorators, async3Decorators, arazzo1Decorators, ...rawConfigRest }) {
|
|
37
|
+
function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_0Rules, oas3_1Rules, async2Rules, async3Rules, arazzo1Rules, overlay1Rules, preprocessors, oas2Preprocessors, oas3_0Preprocessors, oas3_1Preprocessors, async2Preprocessors, async3Preprocessors, arazzo1Preprocessors, overlay1Preprocessors, decorators, oas2Decorators, oas3_0Decorators, oas3_1Decorators, async2Decorators, async3Decorators, arazzo1Decorators, overlay1Decorators, ...rawConfigRest }) {
|
|
38
38
|
const styleguideConfig = {
|
|
39
39
|
plugins,
|
|
40
40
|
extends: _extends,
|
|
@@ -45,6 +45,7 @@ function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_
|
|
|
45
45
|
async2Rules,
|
|
46
46
|
async3Rules,
|
|
47
47
|
arazzo1Rules,
|
|
48
|
+
overlay1Rules,
|
|
48
49
|
preprocessors,
|
|
49
50
|
oas2Preprocessors,
|
|
50
51
|
oas3_0Preprocessors,
|
|
@@ -52,6 +53,7 @@ function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_
|
|
|
52
53
|
async2Preprocessors,
|
|
53
54
|
async3Preprocessors,
|
|
54
55
|
arazzo1Preprocessors,
|
|
56
|
+
overlay1Preprocessors,
|
|
55
57
|
decorators,
|
|
56
58
|
oas2Decorators,
|
|
57
59
|
oas3_0Decorators,
|
|
@@ -59,6 +61,7 @@ function extractFlatConfig({ plugins, extends: _extends, rules, oas2Rules, oas3_
|
|
|
59
61
|
async2Decorators,
|
|
60
62
|
async3Decorators,
|
|
61
63
|
arazzo1Decorators,
|
|
64
|
+
overlay1Decorators,
|
|
62
65
|
doNotResolveExamples: rawConfigRest.resolve?.doNotResolveExamples,
|
|
63
66
|
};
|
|
64
67
|
if ((rawConfigRest.lint && rawConfigRest.styleguide) ||
|
|
@@ -104,6 +107,7 @@ function mergeExtends(rulesConfList) {
|
|
|
104
107
|
async2Rules: {},
|
|
105
108
|
async3Rules: {},
|
|
106
109
|
arazzo1Rules: {},
|
|
110
|
+
overlay1Rules: {},
|
|
107
111
|
preprocessors: {},
|
|
108
112
|
oas2Preprocessors: {},
|
|
109
113
|
oas3_0Preprocessors: {},
|
|
@@ -111,6 +115,7 @@ function mergeExtends(rulesConfList) {
|
|
|
111
115
|
async2Preprocessors: {},
|
|
112
116
|
async3Preprocessors: {},
|
|
113
117
|
arazzo1Preprocessors: {},
|
|
118
|
+
overlay1Preprocessors: {},
|
|
114
119
|
decorators: {},
|
|
115
120
|
oas2Decorators: {},
|
|
116
121
|
oas3_0Decorators: {},
|
|
@@ -118,6 +123,7 @@ function mergeExtends(rulesConfList) {
|
|
|
118
123
|
async2Decorators: {},
|
|
119
124
|
async3Decorators: {},
|
|
120
125
|
arazzo1Decorators: {},
|
|
126
|
+
overlay1Decorators: {},
|
|
121
127
|
plugins: [],
|
|
122
128
|
pluginPaths: [],
|
|
123
129
|
extendPaths: [],
|
|
@@ -139,6 +145,8 @@ function mergeExtends(rulesConfList) {
|
|
|
139
145
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Rules, rulesConf.rules);
|
|
140
146
|
(0, utils_1.assignConfig)(result.arazzo1Rules, rulesConf.arazzo1Rules);
|
|
141
147
|
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Rules, rulesConf.rules);
|
|
148
|
+
(0, utils_1.assignConfig)(result.overlay1Rules, rulesConf.overlay1Rules);
|
|
149
|
+
(0, utils_1.assignOnlyExistingConfig)(result.overlay1Rules, rulesConf.rules);
|
|
142
150
|
(0, utils_1.assignConfig)(result.preprocessors, rulesConf.preprocessors);
|
|
143
151
|
(0, utils_1.assignConfig)(result.oas2Preprocessors, rulesConf.oas2Preprocessors);
|
|
144
152
|
(0, utils_1.assignOnlyExistingConfig)(result.oas2Preprocessors, rulesConf.preprocessors);
|
|
@@ -152,6 +160,8 @@ function mergeExtends(rulesConfList) {
|
|
|
152
160
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Preprocessors, rulesConf.preprocessors);
|
|
153
161
|
(0, utils_1.assignConfig)(result.arazzo1Preprocessors, rulesConf.arazzo1Preprocessors);
|
|
154
162
|
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Preprocessors, rulesConf.preprocessors);
|
|
163
|
+
(0, utils_1.assignConfig)(result.overlay1Preprocessors, rulesConf.overlay1Preprocessors);
|
|
164
|
+
(0, utils_1.assignOnlyExistingConfig)(result.overlay1Preprocessors, rulesConf.preprocessors);
|
|
155
165
|
(0, utils_1.assignConfig)(result.decorators, rulesConf.decorators);
|
|
156
166
|
(0, utils_1.assignConfig)(result.oas2Decorators, rulesConf.oas2Decorators);
|
|
157
167
|
(0, utils_1.assignOnlyExistingConfig)(result.oas2Decorators, rulesConf.decorators);
|
|
@@ -165,6 +175,8 @@ function mergeExtends(rulesConfList) {
|
|
|
165
175
|
(0, utils_1.assignOnlyExistingConfig)(result.async3Decorators, rulesConf.decorators);
|
|
166
176
|
(0, utils_1.assignConfig)(result.arazzo1Decorators, rulesConf.arazzo1Decorators);
|
|
167
177
|
(0, utils_1.assignOnlyExistingConfig)(result.arazzo1Decorators, rulesConf.decorators);
|
|
178
|
+
(0, utils_1.assignConfig)(result.overlay1Decorators, rulesConf.overlay1Decorators);
|
|
179
|
+
(0, utils_1.assignOnlyExistingConfig)(result.overlay1Decorators, rulesConf.decorators);
|
|
168
180
|
result.plugins.push(...(rulesConf.plugins || []));
|
|
169
181
|
result.pluginPaths.push(...(rulesConf.pluginPaths || []));
|
|
170
182
|
result.extendPaths.push(...new Set(rulesConf.extendPaths));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decorators: {};
|
package/lib/oas-types.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import type { BuiltInAsync2RuleId, BuiltInAsync3RuleId, BuiltInArazzo1RuleId, BuiltInOAS2RuleId, BuiltInOAS3RuleId } from './types/redocly-yaml';
|
|
2
|
-
import type { Oas3Rule, Oas3Preprocessor, Oas2Rule, Oas2Preprocessor, Async2Preprocessor, Async2Rule, Async3Preprocessor, Async3Rule, Arazzo1Preprocessor, Arazzo1Rule } from './visitors';
|
|
1
|
+
import type { BuiltInAsync2RuleId, BuiltInAsync3RuleId, BuiltInArazzo1RuleId, BuiltInOAS2RuleId, BuiltInOAS3RuleId, BuiltInOverlay1RuleId } from './types/redocly-yaml';
|
|
2
|
+
import type { Oas3Rule, Oas3Preprocessor, Oas2Rule, Oas2Preprocessor, Async2Preprocessor, Async2Rule, Async3Preprocessor, Async3Rule, Arazzo1Preprocessor, Arazzo1Rule, Overlay1Preprocessor, Overlay1Rule } from './visitors';
|
|
3
3
|
export declare enum SpecVersion {
|
|
4
4
|
OAS2 = "oas2",
|
|
5
5
|
OAS3_0 = "oas3_0",
|
|
6
6
|
OAS3_1 = "oas3_1",
|
|
7
7
|
Async2 = "async2",
|
|
8
8
|
Async3 = "async3",
|
|
9
|
-
Arazzo1 = "arazzo1"
|
|
9
|
+
Arazzo1 = "arazzo1",
|
|
10
|
+
Overlay1 = "overlay1"
|
|
10
11
|
}
|
|
11
12
|
export declare enum SpecMajorVersion {
|
|
12
13
|
OAS2 = "oas2",
|
|
13
14
|
OAS3 = "oas3",
|
|
14
15
|
Async2 = "async2",
|
|
15
16
|
Async3 = "async3",
|
|
16
|
-
Arazzo1 = "arazzo1"
|
|
17
|
+
Arazzo1 = "arazzo1",
|
|
18
|
+
Overlay1 = "overlay1"
|
|
17
19
|
}
|
|
18
20
|
export type RuleMap<Key extends string, RuleConfig, T> = Record<T extends 'built-in' ? Key : string, RuleConfig>;
|
|
19
21
|
export type Oas3RuleSet<T = undefined> = RuleMap<BuiltInOAS3RuleId | 'struct' | 'assertions', Oas3Rule, T>;
|
|
@@ -21,16 +23,19 @@ export type Oas2RuleSet<T = undefined> = RuleMap<BuiltInOAS2RuleId | 'struct' |
|
|
|
21
23
|
export type Async2RuleSet<T = undefined> = RuleMap<BuiltInAsync2RuleId | 'struct' | 'assertions', Async2Rule, T>;
|
|
22
24
|
export type Async3RuleSet<T = undefined> = RuleMap<BuiltInAsync3RuleId | 'struct' | 'assertions', Async3Rule, T>;
|
|
23
25
|
export type Arazzo1RuleSet<T = undefined> = RuleMap<BuiltInArazzo1RuleId | 'struct' | 'assertions', Arazzo1Rule, T>;
|
|
26
|
+
export type Overlay1RuleSet<T = undefined> = RuleMap<BuiltInOverlay1RuleId | 'struct' | 'assertions', Overlay1Rule, T>;
|
|
24
27
|
export type Oas3PreprocessorsSet = Record<string, Oas3Preprocessor>;
|
|
25
28
|
export type Oas2PreprocessorsSet = Record<string, Oas2Preprocessor>;
|
|
26
29
|
export type Async2PreprocessorsSet = Record<string, Async2Preprocessor>;
|
|
27
30
|
export type Async3PreprocessorsSet = Record<string, Async3Preprocessor>;
|
|
28
31
|
export type Arazzo1PreprocessorsSet = Record<string, Arazzo1Preprocessor>;
|
|
32
|
+
export type Overlay1PreprocessorsSet = Record<string, Overlay1Preprocessor>;
|
|
29
33
|
export type Oas3DecoratorsSet = Record<string, Oas3Preprocessor>;
|
|
30
34
|
export type Oas2DecoratorsSet = Record<string, Oas2Preprocessor>;
|
|
31
35
|
export type Async2DecoratorsSet = Record<string, Async2Preprocessor>;
|
|
32
36
|
export type Async3DecoratorsSet = Record<string, Async3Preprocessor>;
|
|
33
37
|
export type Arazzo1DecoratorsSet = Record<string, Arazzo1Preprocessor>;
|
|
38
|
+
export type Overlay1DecoratorsSet = Record<string, Overlay1Preprocessor>;
|
|
34
39
|
export declare function detectSpec(root: unknown): SpecVersion;
|
|
35
40
|
export declare function getMajorSpecVersion(version: SpecVersion): SpecMajorVersion;
|
|
36
41
|
export declare function getTypes(spec: SpecVersion): Record<string, import("./types").NodeType> | Record<"Root" | "Tag" | "TagList" | "ExternalDocs" | "SecurityRequirement" | "SecurityRequirementList" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "ParameterList" | "ParameterItems" | "Operation" | "Example" | "ExamplesMap" | "Examples" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "XServer" | "XServerList", import("./types").NodeType> | Record<"Root" | "Tag" | "TagList" | "ExternalDocs" | "SecurityRequirement" | "SecurityRequirementList" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "ParameterList" | "Operation" | "Example" | "ExamplesMap" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "Server" | "ServerList" | "ServerVariable" | "ServerVariablesMap" | "Callback" | "CallbacksMap" | "RequestBody" | "MediaTypesMap" | "MediaType" | "Encoding" | "EncodingMap" | "HeadersMap" | "Link" | "LinksMap" | "DiscriminatorMapping" | "Discriminator" | "Components" | "NamedExamples" | "NamedRequestBodies" | "NamedHeaders" | "NamedLinks" | "NamedCallbacks" | "ImplicitFlow" | "PasswordFlow" | "ClientCredentials" | "AuthorizationCode" | "OAuth2Flows" | "XUsePkce" | "WebhooksMap", import("./types").NodeType> | Record<"Root" | "Info" | "License" | "Operation" | "Schema" | "SchemaProperties" | "SecurityScheme" | "Components" | "PatternProperties" | "NamedPathItems" | "DependentRequired", import("./types").NodeType>;
|
package/lib/oas-types.js
CHANGED
|
@@ -10,6 +10,7 @@ const oas3_1_1 = require("./types/oas3_1");
|
|
|
10
10
|
const asyncapi2_1 = require("./types/asyncapi2");
|
|
11
11
|
const asyncapi3_1 = require("./types/asyncapi3");
|
|
12
12
|
const arazzo_1 = require("./types/arazzo");
|
|
13
|
+
const overlay_1 = require("./types/overlay");
|
|
13
14
|
const utils_1 = require("./utils");
|
|
14
15
|
const arazzo_2 = require("./typings/arazzo");
|
|
15
16
|
var SpecVersion;
|
|
@@ -20,6 +21,7 @@ var SpecVersion;
|
|
|
20
21
|
SpecVersion["Async2"] = "async2";
|
|
21
22
|
SpecVersion["Async3"] = "async3";
|
|
22
23
|
SpecVersion["Arazzo1"] = "arazzo1";
|
|
24
|
+
SpecVersion["Overlay1"] = "overlay1";
|
|
23
25
|
})(SpecVersion || (exports.SpecVersion = SpecVersion = {}));
|
|
24
26
|
var SpecMajorVersion;
|
|
25
27
|
(function (SpecMajorVersion) {
|
|
@@ -28,6 +30,7 @@ var SpecMajorVersion;
|
|
|
28
30
|
SpecMajorVersion["Async2"] = "async2";
|
|
29
31
|
SpecMajorVersion["Async3"] = "async3";
|
|
30
32
|
SpecMajorVersion["Arazzo1"] = "arazzo1";
|
|
33
|
+
SpecMajorVersion["Overlay1"] = "overlay1";
|
|
31
34
|
})(SpecMajorVersion || (exports.SpecMajorVersion = SpecMajorVersion = {}));
|
|
32
35
|
const typesMap = {
|
|
33
36
|
[SpecVersion.OAS2]: oas2_1.Oas2Types,
|
|
@@ -36,6 +39,7 @@ const typesMap = {
|
|
|
36
39
|
[SpecVersion.Async2]: asyncapi2_1.AsyncApi2Types,
|
|
37
40
|
[SpecVersion.Async3]: asyncapi3_1.AsyncApi3Types,
|
|
38
41
|
[SpecVersion.Arazzo1]: arazzo_1.Arazzo1Types,
|
|
42
|
+
[SpecVersion.Overlay1]: overlay_1.Overlay1Types,
|
|
39
43
|
};
|
|
40
44
|
function detectSpec(root) {
|
|
41
45
|
if (!(0, utils_1.isPlainObject)(root)) {
|
|
@@ -68,6 +72,9 @@ function detectSpec(root) {
|
|
|
68
72
|
if (typeof root.arazzo === 'string' && arazzo_2.VERSION_PATTERN.test(root.arazzo)) {
|
|
69
73
|
return SpecVersion.Arazzo1;
|
|
70
74
|
}
|
|
75
|
+
if (typeof root.overlay === 'string' && arazzo_2.VERSION_PATTERN.test(root.overlay)) {
|
|
76
|
+
return SpecVersion.Overlay1;
|
|
77
|
+
}
|
|
71
78
|
throw new Error(`Unsupported specification`);
|
|
72
79
|
}
|
|
73
80
|
function getMajorSpecVersion(version) {
|
|
@@ -83,6 +90,9 @@ function getMajorSpecVersion(version) {
|
|
|
83
90
|
else if (version === SpecVersion.Arazzo1) {
|
|
84
91
|
return SpecMajorVersion.Arazzo1;
|
|
85
92
|
}
|
|
93
|
+
else if (version === SpecVersion.Overlay1) {
|
|
94
|
+
return SpecMajorVersion.Overlay1;
|
|
95
|
+
}
|
|
86
96
|
else {
|
|
87
97
|
return SpecMajorVersion.OAS3;
|
|
88
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { asserts, AssertionFn } from './asserts';
|
|
2
|
-
import type { Arazzo1Visitor, Async2Visitor, Async3Visitor, Oas2Visitor, Oas3Visitor } from '../../../visitors';
|
|
2
|
+
import type { Arazzo1Visitor, Async2Visitor, Async3Visitor, Oas2Visitor, Oas3Visitor, Overlay1Visitor } from '../../../visitors';
|
|
3
3
|
import type { RuleSeverity } from '../../../config';
|
|
4
4
|
export type AssertionLocators = {
|
|
5
5
|
filterInParentKeys?: (string | number)[];
|
|
@@ -24,4 +24,4 @@ export type RawAssertion = AssertionDefinition & {
|
|
|
24
24
|
export type Assertion = RawAssertion & {
|
|
25
25
|
assertionId: string;
|
|
26
26
|
};
|
|
27
|
-
export declare const Assertions: (opts: Record<string, Assertion>) => (Oas3Visitor | Oas2Visitor | Async2Visitor | Async3Visitor | Arazzo1Visitor)[];
|
|
27
|
+
export declare const Assertions: (opts: Record<string, Assertion>) => (Oas3Visitor | Oas2Visitor | Async2Visitor | Async3Visitor | Arazzo1Visitor | Overlay1Visitor)[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, Arazzo1Rule } from '../../visitors';
|
|
2
|
-
export declare const Struct: Oas3Rule | Oas2Rule | Async2Rule | Async3Rule | Arazzo1Rule;
|
|
1
|
+
import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, Arazzo1Rule, Overlay1Rule } from '../../visitors';
|
|
2
|
+
export declare const Struct: Oas3Rule | Oas2Rule | Async2Rule | Async3Rule | Arazzo1Rule | Overlay1Rule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.preprocessors = exports.rules = void 0;
|
|
4
|
+
const assertions_1 = require("../common/assertions");
|
|
5
|
+
const info_contact_1 = require("../common/info-contact");
|
|
6
|
+
const struct_1 = require("../common/struct");
|
|
7
|
+
exports.rules = {
|
|
8
|
+
'info-contact': info_contact_1.InfoContact,
|
|
9
|
+
struct: struct_1.Struct,
|
|
10
|
+
assertions: assertions_1.Assertions,
|
|
11
|
+
};
|
|
12
|
+
exports.preprocessors = {};
|
package/lib/types/oas2.js
CHANGED
package/lib/types/oas3.js
CHANGED
|
@@ -301,7 +301,7 @@ const Schema = {
|
|
|
301
301
|
required: { type: 'array', items: { type: 'string' } },
|
|
302
302
|
enum: { type: 'array' },
|
|
303
303
|
type: {
|
|
304
|
-
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean'
|
|
304
|
+
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean'],
|
|
305
305
|
},
|
|
306
306
|
allOf: (0, _1.listOf)('Schema'),
|
|
307
307
|
anyOf: (0, _1.listOf)('Schema'),
|