@redocly/openapi-core 1.0.0-beta.78 → 1.0.0-beta.82
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/__tests__/utils.ts +11 -1
- package/lib/bundle.js +18 -7
- package/lib/config/builtIn.js +18 -4
- package/lib/{rules → decorators}/common/info-description-override.d.ts +0 -0
- package/lib/{rules → decorators}/common/info-description-override.js +0 -0
- package/lib/{rules → decorators}/common/operation-description-override.d.ts +0 -0
- package/lib/{rules → decorators}/common/operation-description-override.js +0 -0
- package/lib/{rules → decorators}/common/registry-dependencies.d.ts +0 -0
- package/lib/{rules → decorators}/common/registry-dependencies.js +0 -0
- package/lib/{rules → decorators}/common/remove-x-internal.d.ts +0 -0
- package/lib/{rules → decorators}/common/remove-x-internal.js +20 -2
- package/lib/{rules → decorators}/common/tag-description-override.d.ts +0 -0
- package/lib/{rules → decorators}/common/tag-description-override.js +0 -0
- package/lib/decorators/oas2/index.d.ts +8 -0
- package/lib/decorators/oas2/index.js +15 -0
- package/lib/decorators/oas3/index.d.ts +8 -0
- package/lib/decorators/oas3/index.js +15 -0
- package/lib/js-yaml/index.js +1 -1
- package/lib/resolve.d.ts +1 -0
- package/lib/resolve.js +7 -3
- package/lib/rules/common/operation-security-defined.js +1 -4
- package/lib/rules/common/spec.js +18 -3
- package/lib/rules/oas2/index.d.ts +1 -8
- package/lib/rules/oas2/index.js +1 -13
- package/lib/rules/oas2/remove-unused-components.js +11 -9
- package/lib/rules/oas3/index.d.ts +0 -8
- package/lib/rules/oas3/index.js +1 -13
- package/lib/rules/oas3/no-invalid-media-type-examples.js +12 -11
- package/lib/rules/oas3/remove-unused-components.js +11 -9
- package/lib/types/index.d.ts +4 -0
- package/lib/types/oas2.js +42 -35
- package/lib/types/oas3.js +68 -139
- package/lib/types/oas3_1.js +52 -49
- package/lib/utils.js +1 -1
- package/lib/walk.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/js-yaml.test.ts +29 -5
- package/src/__tests__/lint.test.ts +1 -3
- package/src/bundle.ts +21 -8
- package/src/config/builtIn.ts +20 -7
- package/src/{rules/__tests__/hide-internals.test.ts → decorators/__tests__/remove-x-internal.test.ts} +124 -42
- package/src/{rules → decorators}/common/info-description-override.ts +0 -0
- package/src/{rules → decorators}/common/operation-description-override.ts +0 -0
- package/src/{rules → decorators}/common/registry-dependencies.ts +0 -0
- package/src/{rules → decorators}/common/remove-x-internal.ts +20 -3
- package/src/{rules → decorators}/common/tag-description-override.ts +0 -0
- package/src/decorators/oas2/index.ts +14 -0
- package/src/decorators/oas3/index.ts +14 -0
- package/src/js-yaml/index.ts +1 -2
- package/src/redocly/registry-api.ts +4 -1
- package/src/resolve.ts +6 -6
- package/src/rules/__tests__/no-unresolved-refs.test.ts +1 -4
- package/src/rules/common/__tests__/info-description.test.ts +1 -3
- package/src/rules/common/__tests__/info-license.test.ts +1 -2
- package/src/rules/common/__tests__/license-url.test.ts +1 -2
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -2
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -2
- package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -2
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +1 -2
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +1 -2
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +1 -2
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +1 -2
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -2
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +1 -2
- package/src/rules/common/__tests__/operation-security-defined.test.ts +1 -2
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +1 -2
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +1 -2
- package/src/rules/common/__tests__/path-not-include-query.test.ts +1 -2
- package/src/rules/common/__tests__/path-params-defined.test.ts +1 -2
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +1 -2
- package/src/rules/common/__tests__/tag-description.test.ts +1 -2
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +1 -2
- package/src/rules/common/operation-security-defined.ts +4 -5
- package/src/rules/common/spec.ts +18 -0
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +1 -2
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -2
- package/src/rules/oas2/index.ts +1 -13
- package/src/rules/oas2/remove-unused-components.ts +12 -10
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +1 -2
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -2
- package/src/rules/oas3/index.ts +0 -14
- package/src/rules/oas3/no-invalid-media-type-examples.ts +17 -21
- package/src/rules/oas3/remove-unused-components.ts +12 -10
- package/src/types/index.ts +4 -0
- package/src/types/oas2.ts +42 -40
- package/src/types/oas3.ts +68 -141
- package/src/types/oas3_1.ts +51 -50
- package/src/utils.ts +1 -1
- package/src/walk.ts +2 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/builtin.d.ts +0 -22
- package/lib/rules/builtin.js +0 -17
- package/src/rules/__tests__/config.ts +0 -11
- package/src/rules/builtin.ts +0 -18
package/lib/types/oas2.js
CHANGED
|
@@ -68,9 +68,7 @@ const PathItem = {
|
|
|
68
68
|
const Operation = {
|
|
69
69
|
properties: {
|
|
70
70
|
tags: { type: 'array', items: { type: 'string' } },
|
|
71
|
-
summary: {
|
|
72
|
-
type: 'string',
|
|
73
|
-
},
|
|
71
|
+
summary: { type: 'string' },
|
|
74
72
|
description: { type: 'string' },
|
|
75
73
|
externalDocs: 'ExternalDocs',
|
|
76
74
|
operationId: { type: 'string' },
|
|
@@ -180,9 +178,7 @@ const ResponsesMap = {
|
|
|
180
178
|
};
|
|
181
179
|
const Response = {
|
|
182
180
|
properties: {
|
|
183
|
-
description: {
|
|
184
|
-
type: 'string',
|
|
185
|
-
},
|
|
181
|
+
description: { type: 'string' },
|
|
186
182
|
schema: 'Schema',
|
|
187
183
|
headers: _1.mapOf('Header'),
|
|
188
184
|
examples: 'Examples',
|
|
@@ -299,44 +295,55 @@ const SecurityScheme = {
|
|
|
299
295
|
type: { enum: ['basic', 'apiKey', 'oauth2'] },
|
|
300
296
|
description: { type: 'string' },
|
|
301
297
|
name: { type: 'string' },
|
|
302
|
-
in: { type: 'string', enum: ['query', 'header'
|
|
298
|
+
in: { type: 'string', enum: ['query', 'header'] },
|
|
303
299
|
flow: { enum: ['implicit', 'password', 'application', 'accessCode'] },
|
|
304
300
|
authorizationUrl: { type: 'string' },
|
|
305
301
|
tokenUrl: { type: 'string' },
|
|
306
302
|
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
307
303
|
},
|
|
308
304
|
required(value) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
305
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
306
|
+
case 'apiKey':
|
|
307
|
+
return ['type', 'name', 'in'];
|
|
308
|
+
case 'oauth2':
|
|
309
|
+
switch (value === null || value === void 0 ? void 0 : value.flow) {
|
|
310
|
+
case 'implicit':
|
|
311
|
+
return ['type', 'flow', 'authorizationUrl', 'scopes'];
|
|
312
|
+
case 'accessCode':
|
|
313
|
+
return ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'];
|
|
314
|
+
case 'application':
|
|
315
|
+
case 'password':
|
|
316
|
+
return ['type', 'flow', 'tokenUrl', 'scopes'];
|
|
317
|
+
default:
|
|
318
|
+
return ['type', 'flow', 'scopes'];
|
|
319
|
+
}
|
|
320
|
+
default:
|
|
321
|
+
return ['type'];
|
|
317
322
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
323
|
+
},
|
|
324
|
+
allowed(value) {
|
|
325
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
326
|
+
case 'basic':
|
|
327
|
+
return ['type', 'description'];
|
|
328
|
+
case 'apiKey':
|
|
329
|
+
return ['type', 'name', 'in', 'description'];
|
|
330
|
+
case 'oauth2':
|
|
331
|
+
switch (value === null || value === void 0 ? void 0 : value.flow) {
|
|
332
|
+
case 'implicit':
|
|
333
|
+
return ['type', 'flow', 'authorizationUrl', 'description', 'scopes'];
|
|
334
|
+
case 'accessCode':
|
|
335
|
+
return ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'description', 'scopes'];
|
|
336
|
+
case 'application':
|
|
337
|
+
case 'password':
|
|
338
|
+
return ['type', 'flow', 'tokenUrl', 'description', 'scopes'];
|
|
339
|
+
default:
|
|
340
|
+
return ['type', 'flow', 'tokenUrl', 'authorizationUrl', 'description', 'scopes'];
|
|
341
|
+
}
|
|
342
|
+
default:
|
|
343
|
+
return ['type', 'description'];
|
|
337
344
|
}
|
|
338
|
-
return ['type'];
|
|
339
345
|
},
|
|
346
|
+
extensionsPrefix: 'x-',
|
|
340
347
|
};
|
|
341
348
|
const SecurityRequirement = {
|
|
342
349
|
properties: {},
|
package/lib/types/oas3.js
CHANGED
|
@@ -28,23 +28,15 @@ const Tag = {
|
|
|
28
28
|
};
|
|
29
29
|
const ExternalDocs = {
|
|
30
30
|
properties: {
|
|
31
|
-
description: {
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
url: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
},
|
|
31
|
+
description: { type: 'string' },
|
|
32
|
+
url: { type: 'string' },
|
|
37
33
|
},
|
|
38
34
|
required: ['url'],
|
|
39
35
|
};
|
|
40
36
|
const Server = {
|
|
41
37
|
properties: {
|
|
42
|
-
url: {
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
description: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
},
|
|
38
|
+
url: { type: 'string' },
|
|
39
|
+
description: { type: 'string' },
|
|
48
40
|
variables: _1.mapOf('ServerVariable'),
|
|
49
41
|
},
|
|
50
42
|
required: ['url'],
|
|
@@ -55,9 +47,7 @@ const ServerVariable = {
|
|
|
55
47
|
type: 'array',
|
|
56
48
|
items: { type: 'string' },
|
|
57
49
|
},
|
|
58
|
-
default: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
},
|
|
50
|
+
default: { type: 'string' },
|
|
61
51
|
description: null,
|
|
62
52
|
},
|
|
63
53
|
required: ['default'],
|
|
@@ -68,18 +58,10 @@ const SecurityRequirement = {
|
|
|
68
58
|
};
|
|
69
59
|
const Info = {
|
|
70
60
|
properties: {
|
|
71
|
-
title: {
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
type: 'string',
|
|
76
|
-
},
|
|
77
|
-
description: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
},
|
|
80
|
-
termsOfService: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
},
|
|
61
|
+
title: { type: 'string' },
|
|
62
|
+
version: { type: 'string' },
|
|
63
|
+
description: { type: 'string' },
|
|
64
|
+
termsOfService: { type: 'string' },
|
|
83
65
|
contact: 'Contact',
|
|
84
66
|
license: 'License',
|
|
85
67
|
},
|
|
@@ -87,25 +69,15 @@ const Info = {
|
|
|
87
69
|
};
|
|
88
70
|
const Contact = {
|
|
89
71
|
properties: {
|
|
90
|
-
name: {
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
url: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
},
|
|
96
|
-
email: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
},
|
|
72
|
+
name: { type: 'string' },
|
|
73
|
+
url: { type: 'string' },
|
|
74
|
+
email: { type: 'string' },
|
|
99
75
|
},
|
|
100
76
|
};
|
|
101
77
|
const License = {
|
|
102
78
|
properties: {
|
|
103
|
-
name: {
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
url: {
|
|
107
|
-
type: 'string',
|
|
108
|
-
},
|
|
79
|
+
name: { type: 'string' },
|
|
80
|
+
url: { type: 'string' },
|
|
109
81
|
},
|
|
110
82
|
required: ['name'],
|
|
111
83
|
};
|
|
@@ -122,12 +94,8 @@ const PathItem = {
|
|
|
122
94
|
$ref: { type: 'string' },
|
|
123
95
|
servers: _1.listOf('Server'),
|
|
124
96
|
parameters: _1.listOf('Parameter'),
|
|
125
|
-
summary: {
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
description: {
|
|
129
|
-
type: 'string',
|
|
130
|
-
},
|
|
97
|
+
summary: { type: 'string' },
|
|
98
|
+
description: { type: 'string' },
|
|
131
99
|
get: 'Operation',
|
|
132
100
|
put: 'Operation',
|
|
133
101
|
post: 'Operation',
|
|
@@ -140,33 +108,17 @@ const PathItem = {
|
|
|
140
108
|
};
|
|
141
109
|
const Parameter = {
|
|
142
110
|
properties: {
|
|
143
|
-
name: {
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
description: {
|
|
150
|
-
type: 'string',
|
|
151
|
-
},
|
|
152
|
-
required: {
|
|
153
|
-
type: 'boolean',
|
|
154
|
-
},
|
|
155
|
-
deprecated: {
|
|
156
|
-
type: 'boolean',
|
|
157
|
-
},
|
|
158
|
-
allowEmptyValue: {
|
|
159
|
-
type: 'boolean',
|
|
160
|
-
},
|
|
111
|
+
name: { type: 'string' },
|
|
112
|
+
in: { enum: ['query', 'header', 'path', 'cookie'] },
|
|
113
|
+
description: { type: 'string' },
|
|
114
|
+
required: { type: 'boolean' },
|
|
115
|
+
deprecated: { type: 'boolean' },
|
|
116
|
+
allowEmptyValue: { type: 'boolean' },
|
|
161
117
|
style: {
|
|
162
118
|
enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
|
|
163
119
|
},
|
|
164
|
-
explode: {
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
allowReserved: {
|
|
168
|
-
type: 'boolean',
|
|
169
|
-
},
|
|
120
|
+
explode: { type: 'boolean' },
|
|
121
|
+
allowReserved: { type: 'boolean' },
|
|
170
122
|
schema: 'Schema',
|
|
171
123
|
example: { isExample: true },
|
|
172
124
|
examples: _1.mapOf('Example'),
|
|
@@ -193,9 +145,7 @@ const Operation = {
|
|
|
193
145
|
servers: _1.listOf('Server'),
|
|
194
146
|
requestBody: 'RequestBody',
|
|
195
147
|
responses: 'ResponsesMap',
|
|
196
|
-
deprecated: {
|
|
197
|
-
type: 'boolean',
|
|
198
|
-
},
|
|
148
|
+
deprecated: { type: 'boolean' },
|
|
199
149
|
callbacks: _1.mapOf('Callback'),
|
|
200
150
|
'x-codeSamples': _1.listOf('XCodeSample'),
|
|
201
151
|
'x-code-samples': _1.listOf('XCodeSample'), // deprecated
|
|
@@ -211,12 +161,8 @@ const XCodeSample = {
|
|
|
211
161
|
};
|
|
212
162
|
const RequestBody = {
|
|
213
163
|
properties: {
|
|
214
|
-
description: {
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
required: {
|
|
218
|
-
type: 'boolean',
|
|
219
|
-
},
|
|
164
|
+
description: { type: 'string' },
|
|
165
|
+
required: { type: 'boolean' },
|
|
220
166
|
content: 'MediaTypeMap',
|
|
221
167
|
},
|
|
222
168
|
required: ['content'],
|
|
@@ -236,57 +182,33 @@ const MediaType = {
|
|
|
236
182
|
const Example = {
|
|
237
183
|
properties: {
|
|
238
184
|
value: { isExample: true },
|
|
239
|
-
summary: {
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
description: {
|
|
243
|
-
type: 'string',
|
|
244
|
-
},
|
|
245
|
-
externalValue: {
|
|
246
|
-
type: 'string',
|
|
247
|
-
},
|
|
185
|
+
summary: { type: 'string' },
|
|
186
|
+
description: { type: 'string' },
|
|
187
|
+
externalValue: { type: 'string' },
|
|
248
188
|
},
|
|
249
189
|
};
|
|
250
190
|
const Encoding = {
|
|
251
191
|
properties: {
|
|
252
|
-
contentType: {
|
|
253
|
-
type: 'string',
|
|
254
|
-
},
|
|
192
|
+
contentType: { type: 'string' },
|
|
255
193
|
headers: _1.mapOf('Header'),
|
|
256
194
|
style: {
|
|
257
195
|
enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
|
|
258
196
|
},
|
|
259
|
-
explode: {
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
allowReserved: {
|
|
263
|
-
type: 'boolean',
|
|
264
|
-
},
|
|
197
|
+
explode: { type: 'boolean' },
|
|
198
|
+
allowReserved: { type: 'boolean' },
|
|
265
199
|
},
|
|
266
200
|
};
|
|
267
201
|
const Header = {
|
|
268
202
|
properties: {
|
|
269
|
-
description: {
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
type: 'boolean',
|
|
274
|
-
},
|
|
275
|
-
deprecated: {
|
|
276
|
-
type: 'boolean',
|
|
277
|
-
},
|
|
278
|
-
allowEmptyValue: {
|
|
279
|
-
type: 'boolean',
|
|
280
|
-
},
|
|
203
|
+
description: { type: 'string' },
|
|
204
|
+
required: { type: 'boolean' },
|
|
205
|
+
deprecated: { type: 'boolean' },
|
|
206
|
+
allowEmptyValue: { type: 'boolean' },
|
|
281
207
|
style: {
|
|
282
208
|
enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
|
|
283
209
|
},
|
|
284
|
-
explode: {
|
|
285
|
-
|
|
286
|
-
},
|
|
287
|
-
allowReserved: {
|
|
288
|
-
type: 'boolean',
|
|
289
|
-
},
|
|
210
|
+
explode: { type: 'boolean' },
|
|
211
|
+
allowReserved: { type: 'boolean' },
|
|
290
212
|
schema: 'Schema',
|
|
291
213
|
example: { isExample: true },
|
|
292
214
|
examples: _1.mapOf('Example'),
|
|
@@ -294,16 +216,12 @@ const Header = {
|
|
|
294
216
|
},
|
|
295
217
|
};
|
|
296
218
|
const ResponsesMap = {
|
|
297
|
-
properties: {
|
|
298
|
-
default: 'Response',
|
|
299
|
-
},
|
|
219
|
+
properties: { default: 'Response' },
|
|
300
220
|
additionalProperties: (_v, key) => responseCodeRegexp.test(key) ? 'Response' : undefined,
|
|
301
221
|
};
|
|
302
222
|
const Response = {
|
|
303
223
|
properties: {
|
|
304
|
-
description: {
|
|
305
|
-
type: 'string',
|
|
306
|
-
},
|
|
224
|
+
description: { type: 'string' },
|
|
307
225
|
headers: _1.mapOf('Header'),
|
|
308
226
|
content: 'MediaTypeMap',
|
|
309
227
|
links: _1.mapOf('Link'),
|
|
@@ -425,7 +343,7 @@ const ImplicitFlow = {
|
|
|
425
343
|
scopes: { type: 'object', additionalProperties: { type: 'string' } },
|
|
426
344
|
authorizationUrl: { type: 'string' },
|
|
427
345
|
},
|
|
428
|
-
required: ['authorizationUrl', 'scopes']
|
|
346
|
+
required: ['authorizationUrl', 'scopes']
|
|
429
347
|
};
|
|
430
348
|
const PasswordFlow = {
|
|
431
349
|
properties: {
|
|
@@ -465,30 +383,41 @@ const SecurityScheme = {
|
|
|
465
383
|
type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect'] },
|
|
466
384
|
description: { type: 'string' },
|
|
467
385
|
name: { type: 'string' },
|
|
468
|
-
in: { type: 'string' },
|
|
386
|
+
in: { type: 'string', enum: ['query', 'header', 'cookie'] },
|
|
469
387
|
scheme: { type: 'string' },
|
|
470
388
|
bearerFormat: { type: 'string' },
|
|
471
389
|
flows: 'SecuritySchemeFlows',
|
|
472
390
|
openIdConnectUrl: { type: 'string' },
|
|
473
391
|
},
|
|
474
392
|
required(value) {
|
|
475
|
-
|
|
476
|
-
|
|
393
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
394
|
+
case 'apiKey':
|
|
395
|
+
return ['type', 'name', 'in'];
|
|
396
|
+
case 'http':
|
|
397
|
+
return ['type', 'scheme'];
|
|
398
|
+
case 'oauth2':
|
|
399
|
+
return ['type', 'flows'];
|
|
400
|
+
case 'openIdConnect':
|
|
401
|
+
return ['type', 'openIdConnectUrl'];
|
|
402
|
+
default:
|
|
403
|
+
return ['type'];
|
|
477
404
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
405
|
+
},
|
|
406
|
+
allowed(value) {
|
|
407
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
408
|
+
case 'apiKey':
|
|
409
|
+
return ['type', 'name', 'in', 'description'];
|
|
410
|
+
case 'http':
|
|
411
|
+
return ['type', 'scheme', 'bearerFormat', 'description'];
|
|
412
|
+
case 'oauth2':
|
|
413
|
+
return ['type', 'flows', 'description'];
|
|
414
|
+
case 'openIdConnect':
|
|
415
|
+
return ['type', 'openIdConnectUrl', 'description'];
|
|
416
|
+
default:
|
|
417
|
+
return ['type', 'description'];
|
|
489
418
|
}
|
|
490
|
-
return ['type'];
|
|
491
419
|
},
|
|
420
|
+
extensionsPrefix: 'x-',
|
|
492
421
|
};
|
|
493
422
|
exports.Oas3Types = {
|
|
494
423
|
DefinitionRoot,
|
package/lib/types/oas3_1.js
CHANGED
|
@@ -21,35 +21,19 @@ const DefinitionRoot = {
|
|
|
21
21
|
};
|
|
22
22
|
const License = {
|
|
23
23
|
properties: {
|
|
24
|
-
name: {
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
url: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
},
|
|
30
|
-
identifier: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
},
|
|
24
|
+
name: { type: 'string' },
|
|
25
|
+
url: { type: 'string' },
|
|
26
|
+
identifier: { type: 'string' },
|
|
33
27
|
},
|
|
34
28
|
required: ['name'],
|
|
35
29
|
};
|
|
36
30
|
const Info = {
|
|
37
31
|
properties: {
|
|
38
|
-
title: {
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
description: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
},
|
|
47
|
-
termsOfService: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
},
|
|
50
|
-
summary: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
},
|
|
32
|
+
title: { type: 'string' },
|
|
33
|
+
version: { type: 'string' },
|
|
34
|
+
description: { type: 'string' },
|
|
35
|
+
termsOfService: { type: 'string' },
|
|
36
|
+
summary: { type: 'string' },
|
|
53
37
|
contact: 'Contact',
|
|
54
38
|
license: 'License',
|
|
55
39
|
},
|
|
@@ -84,9 +68,7 @@ const Operation = {
|
|
|
84
68
|
servers: _1.listOf('Server'),
|
|
85
69
|
requestBody: 'RequestBody',
|
|
86
70
|
responses: 'ResponsesMap',
|
|
87
|
-
deprecated: {
|
|
88
|
-
type: 'boolean',
|
|
89
|
-
},
|
|
71
|
+
deprecated: { type: 'boolean' },
|
|
90
72
|
callbacks: _1.mapOf('Callback'),
|
|
91
73
|
'x-codeSamples': _1.listOf('XCodeSample'),
|
|
92
74
|
'x-code-samples': _1.listOf('XCodeSample'), // deprecated
|
|
@@ -137,7 +119,7 @@ const Schema = {
|
|
|
137
119
|
then: 'Schema',
|
|
138
120
|
else: 'Schema',
|
|
139
121
|
dependentSchemas: _1.listOf('Schema'),
|
|
140
|
-
prefixItems:
|
|
122
|
+
prefixItems: _1.listOf('Schema'),
|
|
141
123
|
contains: 'Schema',
|
|
142
124
|
patternProperties: { type: 'object' },
|
|
143
125
|
propertyNames: 'Schema',
|
|
@@ -149,18 +131,16 @@ const Schema = {
|
|
|
149
131
|
if (Array.isArray(value)) {
|
|
150
132
|
return _1.listOf('Schema');
|
|
151
133
|
}
|
|
152
|
-
else {
|
|
153
|
-
return 'Schema';
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
additionalProperties: (value) => {
|
|
157
|
-
if (typeof value === 'boolean') {
|
|
134
|
+
else if (typeof value === 'boolean') {
|
|
158
135
|
return { type: 'boolean' };
|
|
159
136
|
}
|
|
160
137
|
else {
|
|
161
138
|
return 'Schema';
|
|
162
139
|
}
|
|
163
140
|
},
|
|
141
|
+
additionalProperties: (value) => {
|
|
142
|
+
return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
|
|
143
|
+
},
|
|
164
144
|
description: { type: 'string' },
|
|
165
145
|
format: { type: 'string' },
|
|
166
146
|
contentEncoding: { type: 'string' },
|
|
@@ -181,30 +161,53 @@ const SecurityScheme = {
|
|
|
181
161
|
type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect', 'mutualTLS'] },
|
|
182
162
|
description: { type: 'string' },
|
|
183
163
|
name: { type: 'string' },
|
|
184
|
-
in: { type: 'string' },
|
|
164
|
+
in: { type: 'string', enum: ['query', 'header', 'cookie'] },
|
|
185
165
|
scheme: { type: 'string' },
|
|
186
166
|
bearerFormat: { type: 'string' },
|
|
187
167
|
flows: 'SecuritySchemeFlows',
|
|
188
168
|
openIdConnectUrl: { type: 'string' },
|
|
189
169
|
},
|
|
190
170
|
required(value) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
171
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
172
|
+
case 'apiKey':
|
|
173
|
+
return ['type', 'name', 'in'];
|
|
174
|
+
case 'http':
|
|
175
|
+
return ['type', 'scheme'];
|
|
176
|
+
case 'oauth2':
|
|
177
|
+
return ['type', 'flows'];
|
|
178
|
+
case 'openIdConnect':
|
|
179
|
+
return ['type', 'openIdConnectUrl'];
|
|
180
|
+
default:
|
|
181
|
+
return ['type'];
|
|
196
182
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
183
|
+
},
|
|
184
|
+
allowed(value) {
|
|
185
|
+
switch (value === null || value === void 0 ? void 0 : value.type) {
|
|
186
|
+
case 'apiKey':
|
|
187
|
+
return ['type', 'name', 'in', 'description'];
|
|
188
|
+
case 'http':
|
|
189
|
+
return ['type', 'scheme', 'bearerFormat', 'description'];
|
|
190
|
+
case 'oauth2':
|
|
191
|
+
switch (value === null || value === void 0 ? void 0 : value.flows) {
|
|
192
|
+
case 'implicit':
|
|
193
|
+
return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'description', 'scopes'];
|
|
194
|
+
case 'password':
|
|
195
|
+
case 'clientCredentials':
|
|
196
|
+
return ['type', 'flows', 'tokenUrl', 'refreshUrl', 'description', 'scopes'];
|
|
197
|
+
case 'authorizationCode':
|
|
198
|
+
return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'tokenUrl', 'description', 'scopes'];
|
|
199
|
+
default:
|
|
200
|
+
return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'tokenUrl', 'description', 'scopes'];
|
|
201
|
+
}
|
|
202
|
+
case 'openIdConnect':
|
|
203
|
+
return ['type', 'openIdConnectUrl', 'description'];
|
|
204
|
+
case 'mutualTLS':
|
|
205
|
+
return ['type', 'description'];
|
|
206
|
+
default:
|
|
207
|
+
return ['type', 'description'];
|
|
205
208
|
}
|
|
206
|
-
return ['type'];
|
|
207
209
|
},
|
|
210
|
+
extensionsPrefix: 'x-',
|
|
208
211
|
};
|
|
209
212
|
exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info,
|
|
210
213
|
DefinitionRoot,
|
package/lib/utils.js
CHANGED
|
@@ -138,7 +138,7 @@ function readFileAsStringSync(filePath) {
|
|
|
138
138
|
}
|
|
139
139
|
exports.readFileAsStringSync = readFileAsStringSync;
|
|
140
140
|
function isPathParameter(pathSegment) {
|
|
141
|
-
return pathSegment.startsWith('{') && pathSegment.endsWith('
|
|
141
|
+
return pathSegment.startsWith('{') && pathSegment.endsWith('}');
|
|
142
142
|
}
|
|
143
143
|
exports.isPathParameter = isPathParameter;
|
|
144
144
|
/**
|
package/lib/walk.js
CHANGED
|
@@ -218,7 +218,7 @@ function walkDocument(opts) {
|
|
|
218
218
|
function resolve(ref, from = currentLocation.source.absoluteRef) {
|
|
219
219
|
if (!ref_utils_1.isRef(ref))
|
|
220
220
|
return { location, node: ref };
|
|
221
|
-
const refId = from
|
|
221
|
+
const refId = resolve_1.makeRefId(from, ref.$ref);
|
|
222
222
|
const resolvedRef = resolvedRefMap.get(refId);
|
|
223
223
|
if (!resolvedRef) {
|
|
224
224
|
return {
|