@redocly/openapi-core 1.17.1 → 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 +10 -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 +12 -7
- 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/redocly-yaml.d.ts +4 -4
- package/lib/types/redocly-yaml.js +15 -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 +2 -1
- 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/redocly-yaml.ts +18 -8
- package/src/typings/arazzo.ts +4 -0
- package/src/visitors.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import type { NodeType } from '.';
|
|
2
|
+
|
|
3
|
+
import { getNodeTypesFromJSONSchema } from './json-schema-adapter';
|
|
4
|
+
|
|
5
|
+
export const ARAZZO_ROOT_TYPE = 'Root';
|
|
6
|
+
|
|
7
|
+
const operationMethod = {
|
|
8
|
+
type: 'string',
|
|
9
|
+
enum: ['get', 'post', 'put', 'delete', 'patch'],
|
|
10
|
+
} as const;
|
|
11
|
+
const expectSchema = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
statusCode: { type: 'number' },
|
|
15
|
+
mimeType: { type: 'string' },
|
|
16
|
+
body: {},
|
|
17
|
+
schema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
additionalProperties: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
oneOf: [
|
|
24
|
+
{ required: ['statusCode'] },
|
|
25
|
+
{ required: ['mimeType'] },
|
|
26
|
+
{ required: ['body'] },
|
|
27
|
+
{ required: ['schema'] },
|
|
28
|
+
],
|
|
29
|
+
} as const;
|
|
30
|
+
const openAPISourceDescriptionSchema = {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
name: { type: 'string' },
|
|
34
|
+
type: { type: 'string', enum: ['openapi'] },
|
|
35
|
+
url: { type: 'string' },
|
|
36
|
+
'x-serverUrl': { type: 'string' },
|
|
37
|
+
},
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
required: ['name', 'type', 'url'],
|
|
40
|
+
} as const;
|
|
41
|
+
const noneSourceDescriptionSchema = {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
name: { type: 'string' },
|
|
45
|
+
type: { type: 'string', enum: ['none'] },
|
|
46
|
+
'x-serverUrl': { type: 'string' },
|
|
47
|
+
},
|
|
48
|
+
additionalProperties: false,
|
|
49
|
+
required: ['name', 'type', 'x-serverUrl'],
|
|
50
|
+
} as const;
|
|
51
|
+
const arazzoSourceDescriptionSchema = {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
name: { type: 'string' },
|
|
55
|
+
type: { type: 'string', enum: ['arazzo'] },
|
|
56
|
+
url: { type: 'string' },
|
|
57
|
+
},
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
required: ['name', 'type', 'url'],
|
|
60
|
+
} as const;
|
|
61
|
+
const sourceDescriptionSchema = {
|
|
62
|
+
type: 'object',
|
|
63
|
+
oneOf: [
|
|
64
|
+
openAPISourceDescriptionSchema,
|
|
65
|
+
noneSourceDescriptionSchema,
|
|
66
|
+
arazzoSourceDescriptionSchema,
|
|
67
|
+
],
|
|
68
|
+
} as const;
|
|
69
|
+
const sourceDescriptionsSchema = {
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: sourceDescriptionSchema,
|
|
72
|
+
} as const;
|
|
73
|
+
const extendedOperation = {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
path: { type: 'string' },
|
|
77
|
+
method: operationMethod,
|
|
78
|
+
sourceDescriptionName: { type: 'string' },
|
|
79
|
+
serverUrl: { type: 'string' },
|
|
80
|
+
},
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
required: ['path', 'method'],
|
|
83
|
+
} as const;
|
|
84
|
+
const parameter = {
|
|
85
|
+
type: 'object',
|
|
86
|
+
oneOf: [
|
|
87
|
+
{
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
in: { type: 'string', enum: ['header', 'query', 'path', 'cookie', 'body'] },
|
|
91
|
+
name: { type: 'string' },
|
|
92
|
+
value: {
|
|
93
|
+
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ['name', 'value'],
|
|
97
|
+
additionalProperties: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
$ref: { type: 'string' },
|
|
103
|
+
value: {
|
|
104
|
+
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
required: ['$ref'],
|
|
108
|
+
additionalProperties: false,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
reference: { type: 'string' },
|
|
114
|
+
value: {
|
|
115
|
+
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
required: ['reference'],
|
|
119
|
+
additionalProperties: false,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
} as const;
|
|
123
|
+
const parameters = {
|
|
124
|
+
type: 'array',
|
|
125
|
+
items: parameter,
|
|
126
|
+
} as const;
|
|
127
|
+
const infoObject = {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
title: { type: 'string' },
|
|
131
|
+
description: { type: 'string' },
|
|
132
|
+
summary: { type: 'string' },
|
|
133
|
+
version: { type: 'string' },
|
|
134
|
+
},
|
|
135
|
+
additionalProperties: false,
|
|
136
|
+
required: ['title', 'version'],
|
|
137
|
+
} as const;
|
|
138
|
+
const replacement = {
|
|
139
|
+
type: 'object',
|
|
140
|
+
properties: {
|
|
141
|
+
target: { type: 'string' },
|
|
142
|
+
value: {
|
|
143
|
+
oneOf: [
|
|
144
|
+
{ type: 'string' },
|
|
145
|
+
{ type: 'object' },
|
|
146
|
+
{ type: 'array' },
|
|
147
|
+
{ type: 'number' },
|
|
148
|
+
{ type: 'boolean' },
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
} as const;
|
|
153
|
+
const requestBody = {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: {
|
|
156
|
+
contentType: { type: 'string' },
|
|
157
|
+
payload: {
|
|
158
|
+
oneOf: [
|
|
159
|
+
{ type: 'string' },
|
|
160
|
+
{ type: 'object', additionalProperties: true },
|
|
161
|
+
{ type: 'array' },
|
|
162
|
+
{ type: 'number' },
|
|
163
|
+
{ type: 'boolean' },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
encoding: { type: 'string' },
|
|
167
|
+
replacements: {
|
|
168
|
+
type: 'array',
|
|
169
|
+
items: replacement,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
additionalProperties: false,
|
|
173
|
+
required: ['payload'],
|
|
174
|
+
} as const;
|
|
175
|
+
const criteriaObject = {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
condition: { type: 'string' },
|
|
179
|
+
context: { type: 'string' },
|
|
180
|
+
type: {
|
|
181
|
+
oneOf: [
|
|
182
|
+
{ type: 'string', enum: ['regex', 'jsonpath', 'simple', 'xpath'] },
|
|
183
|
+
{
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {
|
|
186
|
+
type: { type: 'string', enum: ['jsonpath'] },
|
|
187
|
+
version: { type: 'string', enum: ['draft-goessner-dispatch-jsonpath-00'] },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
type: { type: 'string', enum: ['xpath'] },
|
|
194
|
+
version: { type: 'string', enum: ['xpath-30', 'xpath-20', 'xpath-10'] },
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
required: ['condition'],
|
|
201
|
+
additionalProperties: false,
|
|
202
|
+
} as const;
|
|
203
|
+
const criteriaObjects = {
|
|
204
|
+
type: 'array',
|
|
205
|
+
items: criteriaObject,
|
|
206
|
+
} as const;
|
|
207
|
+
const inherit = {
|
|
208
|
+
type: 'string',
|
|
209
|
+
enum: ['auto', 'none'],
|
|
210
|
+
} as const;
|
|
211
|
+
const onSuccessObject = {
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {
|
|
214
|
+
name: { type: 'string' },
|
|
215
|
+
type: { type: 'string', enum: ['goto', 'end'] },
|
|
216
|
+
stepId: { type: 'string' },
|
|
217
|
+
workflowId: { type: 'string' },
|
|
218
|
+
criteria: criteriaObjects,
|
|
219
|
+
},
|
|
220
|
+
additionalProperties: false,
|
|
221
|
+
required: ['type', 'name'],
|
|
222
|
+
} as const;
|
|
223
|
+
const onSuccessList = {
|
|
224
|
+
type: 'array',
|
|
225
|
+
items: onSuccessObject,
|
|
226
|
+
} as const;
|
|
227
|
+
const onFailureObject = {
|
|
228
|
+
type: 'object',
|
|
229
|
+
properties: {
|
|
230
|
+
name: { type: 'string' },
|
|
231
|
+
type: { type: 'string', enum: ['goto', 'retry', 'end'] },
|
|
232
|
+
workflowId: { type: 'string' },
|
|
233
|
+
stepId: { type: 'string' },
|
|
234
|
+
retryAfter: { type: 'number' },
|
|
235
|
+
retryLimit: { type: 'number' },
|
|
236
|
+
criteria: criteriaObjects,
|
|
237
|
+
},
|
|
238
|
+
additionalProperties: false,
|
|
239
|
+
required: ['type', 'name'],
|
|
240
|
+
} as const;
|
|
241
|
+
const onFailureList = {
|
|
242
|
+
type: 'array',
|
|
243
|
+
items: onFailureObject,
|
|
244
|
+
} as const;
|
|
245
|
+
const step = {
|
|
246
|
+
type: 'object',
|
|
247
|
+
properties: {
|
|
248
|
+
stepId: { type: 'string' },
|
|
249
|
+
description: { type: 'string' },
|
|
250
|
+
operationId: { type: 'string' },
|
|
251
|
+
operationPath: { type: 'string' },
|
|
252
|
+
workflowId: { type: 'string' },
|
|
253
|
+
parameters: parameters,
|
|
254
|
+
successCriteria: criteriaObjects,
|
|
255
|
+
onSuccess: onSuccessList,
|
|
256
|
+
onFailure: onFailureList,
|
|
257
|
+
outputs: {
|
|
258
|
+
type: 'object',
|
|
259
|
+
additionalProperties: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
'x-inherit': inherit,
|
|
264
|
+
'x-expect': expectSchema,
|
|
265
|
+
'x-assert': { type: 'string' },
|
|
266
|
+
'x-operation': extendedOperation,
|
|
267
|
+
requestBody: requestBody,
|
|
268
|
+
},
|
|
269
|
+
required: ['stepId'],
|
|
270
|
+
oneOf: [
|
|
271
|
+
{ required: ['x-operation'] },
|
|
272
|
+
{ required: ['operationId'] },
|
|
273
|
+
{ required: ['operationPath'] },
|
|
274
|
+
{ required: ['workflowId'] },
|
|
275
|
+
],
|
|
276
|
+
} as const;
|
|
277
|
+
const steps = {
|
|
278
|
+
type: 'array',
|
|
279
|
+
items: step,
|
|
280
|
+
} as const;
|
|
281
|
+
const JSONSchema = {
|
|
282
|
+
type: 'object',
|
|
283
|
+
properties: {
|
|
284
|
+
type: {
|
|
285
|
+
type: 'string',
|
|
286
|
+
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
|
|
287
|
+
},
|
|
288
|
+
properties: {
|
|
289
|
+
type: 'object',
|
|
290
|
+
additionalProperties: true,
|
|
291
|
+
},
|
|
292
|
+
required: {
|
|
293
|
+
type: 'array',
|
|
294
|
+
items: { type: 'string' },
|
|
295
|
+
},
|
|
296
|
+
items: {
|
|
297
|
+
type: 'object',
|
|
298
|
+
additionalProperties: true,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
required: ['type'],
|
|
302
|
+
additionalProperties: true,
|
|
303
|
+
} as const;
|
|
304
|
+
const workflow = {
|
|
305
|
+
type: 'object',
|
|
306
|
+
properties: {
|
|
307
|
+
workflowId: { type: 'string' },
|
|
308
|
+
summary: { type: 'string' },
|
|
309
|
+
description: { type: 'string' },
|
|
310
|
+
parameters: parameters,
|
|
311
|
+
dependsOn: { type: 'array', items: { type: 'string' } },
|
|
312
|
+
inputs: JSONSchema,
|
|
313
|
+
outputs: {
|
|
314
|
+
type: 'object',
|
|
315
|
+
additionalProperties: {
|
|
316
|
+
type: 'string',
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
steps: steps,
|
|
320
|
+
successActions: {
|
|
321
|
+
type: 'array',
|
|
322
|
+
items: onSuccessObject,
|
|
323
|
+
},
|
|
324
|
+
failureActions: {
|
|
325
|
+
type: 'array',
|
|
326
|
+
items: onFailureObject,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
additionalProperties: false,
|
|
330
|
+
required: ['workflowId', 'steps'],
|
|
331
|
+
} as const;
|
|
332
|
+
const workflows = {
|
|
333
|
+
type: 'array',
|
|
334
|
+
items: workflow,
|
|
335
|
+
} as const;
|
|
336
|
+
export const arazzoSchema = {
|
|
337
|
+
type: 'object',
|
|
338
|
+
properties: {
|
|
339
|
+
arazzo: { type: 'string', enum: ['1.0.0'] },
|
|
340
|
+
info: infoObject,
|
|
341
|
+
sourceDescriptions: sourceDescriptionsSchema,
|
|
342
|
+
'x-parameters': parameters,
|
|
343
|
+
workflows: workflows,
|
|
344
|
+
components: {
|
|
345
|
+
type: 'object',
|
|
346
|
+
properties: {
|
|
347
|
+
inputs: {
|
|
348
|
+
type: 'object',
|
|
349
|
+
additionalProperties: {
|
|
350
|
+
type: 'object',
|
|
351
|
+
additionalProperties: true,
|
|
352
|
+
properties: {
|
|
353
|
+
type: {
|
|
354
|
+
type: 'string',
|
|
355
|
+
},
|
|
356
|
+
properties: {
|
|
357
|
+
type: 'object',
|
|
358
|
+
additionalProperties: true,
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
required: ['type'],
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
parameters: {
|
|
365
|
+
type: 'object',
|
|
366
|
+
additionalProperties: parameter,
|
|
367
|
+
},
|
|
368
|
+
successActions: {
|
|
369
|
+
type: 'object',
|
|
370
|
+
additionalProperties: onSuccessObject,
|
|
371
|
+
},
|
|
372
|
+
failureActions: {
|
|
373
|
+
type: 'object',
|
|
374
|
+
additionalProperties: onFailureObject,
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
additionalProperties: false,
|
|
380
|
+
required: ['arazzo', 'info', 'sourceDescriptions', 'workflows'],
|
|
381
|
+
} as const;
|
|
382
|
+
|
|
383
|
+
export const ArazzoTypes: Record<string, NodeType> = getNodeTypesFromJSONSchema(
|
|
384
|
+
ARAZZO_ROOT_TYPE,
|
|
385
|
+
arazzoSchema
|
|
386
|
+
);
|
package/src/types/oas3.ts
CHANGED
|
@@ -346,13 +346,6 @@ const Schema: NodeType = {
|
|
|
346
346
|
return 'Schema';
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
|
-
additionalItems: (value: any) => {
|
|
350
|
-
if (typeof value === 'boolean') {
|
|
351
|
-
return { type: 'boolean' };
|
|
352
|
-
} else {
|
|
353
|
-
return 'Schema';
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
349
|
additionalProperties: (value: any) => {
|
|
357
350
|
if (typeof value === 'boolean') {
|
|
358
351
|
return { type: 'boolean' };
|
|
@@ -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];
|
|
@@ -238,16 +245,19 @@ const ConfigStyleguide: NodeType = {
|
|
|
238
245
|
oas3_0Rules: 'Rules',
|
|
239
246
|
oas3_1Rules: 'Rules',
|
|
240
247
|
async2Rules: 'Rules',
|
|
248
|
+
arazzoRules: 'Rules',
|
|
241
249
|
preprocessors: { type: 'object' },
|
|
242
250
|
oas2Preprocessors: { type: 'object' },
|
|
243
251
|
oas3_0Preprocessors: { type: 'object' },
|
|
244
252
|
oas3_1Preprocessors: { type: 'object' },
|
|
245
253
|
async2Preprocessors: { type: 'object' },
|
|
254
|
+
arazzoPreprocessors: { type: 'object' },
|
|
246
255
|
decorators: { type: 'object' },
|
|
247
256
|
oas2Decorators: { type: 'object' },
|
|
248
257
|
oas3_0Decorators: { type: 'object' },
|
|
249
258
|
oas3_1Decorators: { type: 'object' },
|
|
250
259
|
async2Decorators: { type: 'object' },
|
|
260
|
+
arazzoDecorators: { type: 'object' },
|
|
251
261
|
},
|
|
252
262
|
};
|
|
253
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
|