@redocly/openapi-core 1.0.0-beta.80 → 1.0.0-beta.81
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/lib/redocly/registry-api.js +4 -1
- package/lib/rules/common/operation-security-defined.js +1 -4
- package/lib/rules/common/spec.js +18 -3
- package/lib/rules/oas3/no-invalid-media-type-examples.js +12 -11
- 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/package.json +1 -1
- package/src/redocly/registry-api.ts +7 -1
- package/src/rules/common/operation-security-defined.ts +4 -5
- package/src/rules/common/spec.ts +18 -0
- package/src/rules/oas3/no-invalid-media-type-examples.ts +17 -21
- 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/tsconfig.tsbuildinfo +1 -1
|
@@ -14,6 +14,7 @@ const node_fetch_1 = require("node-fetch");
|
|
|
14
14
|
const config_1 = require("../config/config");
|
|
15
15
|
const utils_1 = require("../utils");
|
|
16
16
|
const version = require('../../package.json').version;
|
|
17
|
+
const HttpsProxyAgent = require('https-proxy-agent');
|
|
17
18
|
class RegistryApi {
|
|
18
19
|
constructor(accessTokens, region) {
|
|
19
20
|
this.accessTokens = accessTokens;
|
|
@@ -35,7 +36,9 @@ class RegistryApi {
|
|
|
35
36
|
if (!headers.hasOwnProperty('authorization')) {
|
|
36
37
|
throw new Error('Unauthorized');
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
+
const proxy = process.env.REDOCLY_PROXY;
|
|
40
|
+
const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
|
|
41
|
+
const response = yield node_fetch_1.default(`${this.getBaseUrl(region)}${path}`, Object.assign({}, options, { headers, agent }));
|
|
39
42
|
if (response.status === 401) {
|
|
40
43
|
throw new Error('Unauthorized');
|
|
41
44
|
}
|
|
@@ -19,10 +19,7 @@ const OperationSecurityDefined = () => {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
SecurityScheme(_securityScheme, { key }) {
|
|
22
|
-
referencedSchemes.set(key.toString(), {
|
|
23
|
-
defined: true,
|
|
24
|
-
from: [],
|
|
25
|
-
});
|
|
22
|
+
referencedSchemes.set(key.toString(), { defined: true, from: [] });
|
|
26
23
|
},
|
|
27
24
|
SecurityRequirement(requirements, { location }) {
|
|
28
25
|
for (const requirement of Object.keys(requirements)) {
|
package/lib/rules/common/spec.js
CHANGED
|
@@ -4,10 +4,11 @@ exports.OasSpec = void 0;
|
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const ref_utils_1 = require("../../ref-utils");
|
|
7
|
+
const utils_2 = require("../../utils");
|
|
7
8
|
const OasSpec = () => {
|
|
8
9
|
return {
|
|
9
10
|
any(node, { report, type, location, key, resolve, ignoreNextVisitorsOnNode }) {
|
|
10
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
11
12
|
const nodeType = utils_1.oasTypeOf(node);
|
|
12
13
|
if (type.items) {
|
|
13
14
|
if (nodeType !== 'array') {
|
|
@@ -34,6 +35,20 @@ const OasSpec = () => {
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
const allowed = (_a = type.allowed) === null || _a === void 0 ? void 0 : _a.call(type, node);
|
|
39
|
+
if (allowed && utils_2.isPlainObject(node)) {
|
|
40
|
+
for (const propName in node) {
|
|
41
|
+
if (allowed.includes(propName) ||
|
|
42
|
+
(type.extensionsPrefix && propName.startsWith(type.extensionsPrefix)) ||
|
|
43
|
+
!Object.keys(type.properties).includes(propName)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
report({
|
|
47
|
+
message: `The field \`${propName}\` is not allowed here.`,
|
|
48
|
+
location: location.child([propName]).key()
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
37
52
|
const requiredOneOf = type.requiredOneOf || null;
|
|
38
53
|
if (requiredOneOf) {
|
|
39
54
|
let hasProperty = false;
|
|
@@ -94,8 +109,8 @@ const OasSpec = () => {
|
|
|
94
109
|
location: propLocation,
|
|
95
110
|
});
|
|
96
111
|
}
|
|
97
|
-
else if (propValueType === 'array' && ((
|
|
98
|
-
const itemsType = (
|
|
112
|
+
else if (propValueType === 'array' && ((_b = propSchema.items) === null || _b === void 0 ? void 0 : _b.type)) {
|
|
113
|
+
const itemsType = (_c = propSchema.items) === null || _c === void 0 ? void 0 : _c.type;
|
|
99
114
|
for (let i = 0; i < propValue.length; i++) {
|
|
100
115
|
const item = propValue[i];
|
|
101
116
|
if (!utils_1.matchesJsonSchemaType(item, itemsType, false)) {
|
|
@@ -13,22 +13,23 @@ const ValidContentExamples = (opts) => {
|
|
|
13
13
|
if (!mediaType.schema)
|
|
14
14
|
return;
|
|
15
15
|
if (mediaType.example) {
|
|
16
|
-
|
|
16
|
+
resolveAndValidateExample(mediaType.example, location.child('example'));
|
|
17
17
|
}
|
|
18
18
|
else if (mediaType.examples) {
|
|
19
19
|
for (const exampleName of Object.keys(mediaType.examples)) {
|
|
20
|
-
|
|
21
|
-
let dataLoc = location.child(['examples', exampleName, 'value']);
|
|
22
|
-
if (ref_utils_1.isRef(example)) {
|
|
23
|
-
const resolved = resolve(example);
|
|
24
|
-
if (!resolved.location)
|
|
25
|
-
continue;
|
|
26
|
-
dataLoc = resolved.location.child('value');
|
|
27
|
-
example = resolved.node;
|
|
28
|
-
}
|
|
29
|
-
utils_1.validateExample(example.value, mediaType.schema, dataLoc, ctx, disallowAdditionalProperties);
|
|
20
|
+
resolveAndValidateExample(mediaType.examples[exampleName], location.child(['examples', exampleName, 'value']), true);
|
|
30
21
|
}
|
|
31
22
|
}
|
|
23
|
+
function resolveAndValidateExample(example, location, isMultiple) {
|
|
24
|
+
if (ref_utils_1.isRef(example)) {
|
|
25
|
+
const resolved = resolve(example);
|
|
26
|
+
if (!resolved.location)
|
|
27
|
+
return;
|
|
28
|
+
location = isMultiple ? resolved.location.child('value') : resolved.location;
|
|
29
|
+
example = resolved.node;
|
|
30
|
+
}
|
|
31
|
+
utils_1.validateExample(isMultiple ? example.value : example, mediaType.schema, location, ctx, disallowAdditionalProperties);
|
|
32
|
+
}
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare type NodeType = {
|
|
|
22
22
|
items?: string;
|
|
23
23
|
required?: string[] | ((value: any, key: string | number | undefined) => string[]);
|
|
24
24
|
requiredOneOf?: string[];
|
|
25
|
+
allowed?: ((value: any) => string[] | undefined);
|
|
26
|
+
extensionsPrefix?: string;
|
|
25
27
|
};
|
|
26
28
|
declare type PropType = string | NodeType | ScalarSchema | undefined | null;
|
|
27
29
|
declare type ResolveTypeFn = (value: any, key: string) => string | PropType;
|
|
@@ -32,6 +34,8 @@ export declare type NormalizedNodeType = {
|
|
|
32
34
|
items?: NormalizedNodeType;
|
|
33
35
|
required?: string[] | ((value: any, key: string | number | undefined) => string[]);
|
|
34
36
|
requiredOneOf?: string[];
|
|
37
|
+
allowed?: ((value: any) => string[] | undefined);
|
|
38
|
+
extensionsPrefix?: string;
|
|
35
39
|
};
|
|
36
40
|
declare type NormalizedPropType = NormalizedNodeType | NormalizedScalarSchema | undefined | null;
|
|
37
41
|
declare type NormalizedResolveTypeFn = (value: any, key: string) => NormalizedNodeType | NormalizedScalarSchema | undefined | null;
|
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,
|