@redocly/openapi-core 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +15 -0
- package/lib/config/all.js +6 -0
- package/lib/config/builtIn.js +10 -2
- package/lib/config/config-resolvers.js +15 -4
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +15 -0
- package/lib/config/minimal.js +8 -0
- package/lib/config/recommended-strict.js +8 -0
- package/lib/config/recommended.js +8 -0
- package/lib/config/types.d.ts +10 -4
- package/lib/config/utils.js +13 -1
- package/lib/decorators/arazzo/index.d.ts +1 -0
- package/lib/decorators/arazzo/index.js +4 -0
- package/lib/decorators/async2/index.d.ts +1 -0
- package/lib/decorators/async2/index.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -2
- package/lib/oas-types.d.ts +13 -8
- package/lib/oas-types.js +10 -0
- package/lib/rules/arazzo/index.d.ts +3 -0
- package/lib/rules/arazzo/index.js +10 -0
- package/lib/rules/common/spec.d.ts +2 -2
- package/lib/types/arazzo.d.ts +1050 -0
- package/lib/types/arazzo.js +381 -0
- package/lib/types/oas3.js +0 -8
- package/lib/types/oas3_1.js +7 -1
- package/lib/types/redocly-yaml.d.ts +5 -5
- package/lib/types/redocly-yaml.js +16 -5
- package/lib/typings/arazzo.d.ts +3 -0
- package/lib/typings/arazzo.js +2 -0
- package/lib/visitors.d.ts +11 -0
- package/package.json +3 -2
- package/src/__tests__/lint.test.ts +124 -0
- package/src/bundle.ts +13 -0
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +20 -0
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +3 -0
- package/src/config/__tests__/config.test.ts +6 -0
- package/src/config/all.ts +6 -0
- package/src/config/builtIn.ts +10 -2
- package/src/config/config-resolvers.ts +17 -3
- package/src/config/config.ts +17 -0
- package/src/config/minimal.ts +8 -0
- package/src/config/recommended-strict.ts +8 -0
- package/src/config/recommended.ts +8 -0
- package/src/config/types.ts +15 -2
- package/src/config/utils.ts +15 -0
- package/src/decorators/arazzo/index.ts +1 -0
- package/src/decorators/async2/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/oas-types.ts +25 -4
- package/src/rules/arazzo/index.ts +11 -0
- package/src/rules/common/spec.ts +2 -2
- package/src/types/arazzo.ts +386 -0
- package/src/types/oas3.ts +0 -7
- package/src/types/oas3_1.ts +7 -0
- package/src/types/redocly-yaml.ts +19 -8
- package/src/typings/arazzo.ts +4 -0
- package/src/visitors.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -8,17 +8,12 @@ import type { JSONSchema } from 'json-schema-to-ts';
|
|
|
8
8
|
import { SpecVersion, getTypes } from '../oas-types';
|
|
9
9
|
import { Config } from '../config';
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const builtInCommonOASRules = [
|
|
12
12
|
'spec',
|
|
13
13
|
'info-contact',
|
|
14
14
|
'operation-operationId',
|
|
15
15
|
'tag-description',
|
|
16
16
|
'tags-alphabetical',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
export type BuiltInCommonRuleId = typeof builtInCommonRules[number];
|
|
20
|
-
|
|
21
|
-
const builtInCommonOASRules = [
|
|
22
17
|
'info-license-url',
|
|
23
18
|
'info-license',
|
|
24
19
|
'no-ambiguous-paths',
|
|
@@ -87,16 +82,28 @@ const builtInOAS3Rules = [
|
|
|
87
82
|
|
|
88
83
|
export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
|
|
89
84
|
|
|
90
|
-
const builtInAsync2Rules = [
|
|
85
|
+
const builtInAsync2Rules = [
|
|
86
|
+
'spec',
|
|
87
|
+
'info-contact',
|
|
88
|
+
'operation-operationId',
|
|
89
|
+
'tag-description',
|
|
90
|
+
'tags-alphabetical',
|
|
91
|
+
'channels-kebab-case',
|
|
92
|
+
'no-channel-trailing-slash',
|
|
93
|
+
] as const;
|
|
91
94
|
|
|
92
95
|
export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
|
|
93
96
|
|
|
97
|
+
const builtInArazzoRules = ['spec'] as const;
|
|
98
|
+
|
|
99
|
+
export type BuiltInArazzoRuleId = typeof builtInArazzoRules[number];
|
|
100
|
+
|
|
94
101
|
const builtInRules = [
|
|
95
|
-
...builtInCommonRules,
|
|
96
102
|
...builtInCommonOASRules,
|
|
97
103
|
...builtInOAS2Rules,
|
|
98
104
|
...builtInOAS3Rules,
|
|
99
105
|
...builtInAsync2Rules,
|
|
106
|
+
...builtInArazzoRules,
|
|
100
107
|
] as const;
|
|
101
108
|
|
|
102
109
|
type BuiltInRuleId = typeof builtInRules[number];
|
|
@@ -220,6 +227,7 @@ const oas3_1NodeTypesList = [
|
|
|
220
227
|
'NamedPathItems',
|
|
221
228
|
'SecurityScheme',
|
|
222
229
|
'Operation',
|
|
230
|
+
'DependentRequired',
|
|
223
231
|
] as const;
|
|
224
232
|
|
|
225
233
|
export type Oas3_1NodeType = typeof oas3_1NodeTypesList[number];
|
|
@@ -237,16 +245,19 @@ const ConfigStyleguide: NodeType = {
|
|
|
237
245
|
oas3_0Rules: 'Rules',
|
|
238
246
|
oas3_1Rules: 'Rules',
|
|
239
247
|
async2Rules: 'Rules',
|
|
248
|
+
arazzoRules: 'Rules',
|
|
240
249
|
preprocessors: { type: 'object' },
|
|
241
250
|
oas2Preprocessors: { type: 'object' },
|
|
242
251
|
oas3_0Preprocessors: { type: 'object' },
|
|
243
252
|
oas3_1Preprocessors: { type: 'object' },
|
|
244
253
|
async2Preprocessors: { type: 'object' },
|
|
254
|
+
arazzoPreprocessors: { type: 'object' },
|
|
245
255
|
decorators: { type: 'object' },
|
|
246
256
|
oas2Decorators: { type: 'object' },
|
|
247
257
|
oas3_0Decorators: { type: 'object' },
|
|
248
258
|
oas3_1Decorators: { type: 'object' },
|
|
249
259
|
async2Decorators: { type: 'object' },
|
|
260
|
+
arazzoDecorators: { type: 'object' },
|
|
250
261
|
},
|
|
251
262
|
};
|
|
252
263
|
|
package/src/visitors.ts
CHANGED
|
@@ -50,6 +50,7 @@ import type {
|
|
|
50
50
|
Oas2SecurityScheme,
|
|
51
51
|
} from './typings/swagger';
|
|
52
52
|
import type { Async2Definition } from './typings/asyncapi';
|
|
53
|
+
import type { ArazzoDefinition } from './typings/arazzo';
|
|
53
54
|
|
|
54
55
|
export type SkipFunctionContext = Pick<
|
|
55
56
|
UserContext,
|
|
@@ -212,6 +213,10 @@ type Async2FlatVisitor = {
|
|
|
212
213
|
Root?: VisitFunctionOrObject<Async2Definition>;
|
|
213
214
|
};
|
|
214
215
|
|
|
216
|
+
type ArazzoFlatVisitor = {
|
|
217
|
+
Root?: VisitFunctionOrObject<ArazzoDefinition>;
|
|
218
|
+
};
|
|
219
|
+
|
|
215
220
|
const legacyTypesMap = {
|
|
216
221
|
Root: 'DefinitionRoot',
|
|
217
222
|
ServerVariablesMap: 'ServerVariableMap',
|
|
@@ -244,6 +249,12 @@ type Async2NestedVisitor = {
|
|
|
244
249
|
: Async2FlatVisitor[T] & NestedVisitor<Async2NestedVisitor>;
|
|
245
250
|
};
|
|
246
251
|
|
|
252
|
+
type ArazzoNestedVisitor = {
|
|
253
|
+
[T in keyof ArazzoFlatVisitor]: ArazzoFlatVisitor[T] extends Function
|
|
254
|
+
? ArazzoFlatVisitor[T]
|
|
255
|
+
: ArazzoFlatVisitor[T] & NestedVisitor<ArazzoNestedVisitor>;
|
|
256
|
+
};
|
|
257
|
+
|
|
247
258
|
export type Oas3Visitor = BaseVisitor &
|
|
248
259
|
Oas3NestedVisitor &
|
|
249
260
|
Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
|
|
@@ -256,6 +267,10 @@ export type Async2Visitor = BaseVisitor &
|
|
|
256
267
|
Async2NestedVisitor &
|
|
257
268
|
Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
|
|
258
269
|
|
|
270
|
+
export type ArazzoVisitor = BaseVisitor &
|
|
271
|
+
ArazzoNestedVisitor &
|
|
272
|
+
Record<string, VisitFunction<any> | NestedVisitObject<any, ArazzoNestedVisitor>>;
|
|
273
|
+
|
|
259
274
|
export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
|
|
260
275
|
|
|
261
276
|
export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
|
@@ -278,12 +293,15 @@ export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
|
|
278
293
|
export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
|
|
279
294
|
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
|
280
295
|
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
|
296
|
+
export type ArazzoRule = (options: Record<string, any>) => ArazzoVisitor | ArazzoVisitor[];
|
|
281
297
|
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
|
282
298
|
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
|
283
299
|
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
|
300
|
+
export type ArazzoPreprocessor = (options: Record<string, any>) => ArazzoVisitor;
|
|
284
301
|
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
|
285
302
|
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
|
286
303
|
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
|
304
|
+
export type ArazzoDecorator = (options: Record<string, any>) => ArazzoVisitor;
|
|
287
305
|
|
|
288
306
|
// alias for the latest version supported
|
|
289
307
|
// every time we update it - consider semver
|