oas 36.0.2 → 37.0.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/README.md +0 -5
- package/dist/analyzer/index.cjs +83 -28
- package/dist/analyzer/index.cjs.map +1 -1
- package/dist/analyzer/index.d.cts +3 -10
- package/dist/analyzer/index.d.ts +3 -10
- package/dist/analyzer/index.js +81 -26
- package/dist/analyzer/index.js.map +1 -1
- package/dist/analyzer/types.d.cts +0 -1
- package/dist/analyzer/types.d.ts +0 -1
- package/dist/{chunk-UDN4U5TL.cjs → chunk-GS43VKJH.cjs} +320 -274
- package/dist/chunk-GS43VKJH.cjs.map +1 -0
- package/dist/{chunk-6MDVLJ3A.js → chunk-IEN4GZPF.js} +9 -23
- package/dist/chunk-IEN4GZPF.js.map +1 -0
- package/dist/{chunk-SCWW2SNX.cjs → chunk-UKD63LKG.cjs} +10 -24
- package/dist/chunk-UKD63LKG.cjs.map +1 -0
- package/dist/{chunk-35LEYZEY.js → chunk-WIVQX3DA.js} +199 -153
- package/dist/chunk-WIVQX3DA.js.map +1 -0
- package/dist/index.cjs +634 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -135
- package/dist/index.d.ts +38 -135
- package/dist/index.js +633 -6
- package/dist/index.js.map +1 -1
- package/dist/operation/index.cjs +3 -3
- package/dist/operation/index.js +2 -2
- package/dist/reducer/index.cjs +7 -7
- package/dist/reducer/index.js +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +1 -1
- package/package.json +1 -4
- package/dist/chunk-35LEYZEY.js.map +0 -1
- package/dist/chunk-6MDVLJ3A.js.map +0 -1
- package/dist/chunk-IXQKQM3K.js +0 -866
- package/dist/chunk-IXQKQM3K.js.map +0 -1
- package/dist/chunk-SCWW2SNX.cjs.map +0 -1
- package/dist/chunk-UDN4U5TL.cjs.map +0 -1
- package/dist/chunk-YKV73CBG.cjs +0 -866
- package/dist/chunk-YKV73CBG.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkUKD63LKGcjs = require('./chunk-UKD63LKG.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkAYA3UT4Lcjs = require('./chunk-AYA3UT4L.cjs');
|
|
@@ -23,8 +23,159 @@ var _chunkAYA3UT4Lcjs = require('./chunk-AYA3UT4L.cjs');
|
|
|
23
23
|
|
|
24
24
|
var _chunk7PWF3F2Wcjs = require('./chunk-7PWF3F2W.cjs');
|
|
25
25
|
|
|
26
|
-
// src/
|
|
27
|
-
var
|
|
26
|
+
// src/lib/urls.ts
|
|
27
|
+
var _pathtoregexp = require('path-to-regexp');
|
|
28
|
+
|
|
29
|
+
// src/lib/get-user-variable.ts
|
|
30
|
+
function getUserVariable(user, property, selectedApp) {
|
|
31
|
+
let key = user;
|
|
32
|
+
if ("keys" in user && Array.isArray(user.keys) && user.keys.length) {
|
|
33
|
+
if (selectedApp) {
|
|
34
|
+
key = user.keys.find((k) => k.name === selectedApp);
|
|
35
|
+
} else {
|
|
36
|
+
key = user.keys[0];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return _optionalChain([key, 'optionalAccess', _2 => _2[property]]) || user[property] || null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/lib/urls.ts
|
|
43
|
+
function stripTrailingSlash(url) {
|
|
44
|
+
if (url[url.length - 1] === "/") {
|
|
45
|
+
return url.slice(0, -1);
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
function ensureProtocol(url) {
|
|
50
|
+
if (url.match(/^\/\//)) {
|
|
51
|
+
return `https:${url}`;
|
|
52
|
+
}
|
|
53
|
+
if (!url.match(/\/\//)) {
|
|
54
|
+
return `https://${url}`;
|
|
55
|
+
}
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
function normalizedURLFromServers(servers, selected) {
|
|
59
|
+
const exampleDotCom = "https://example.com";
|
|
60
|
+
let url;
|
|
61
|
+
try {
|
|
62
|
+
url = _optionalChain([servers, 'optionalAccess', _3 => _3[selected], 'optionalAccess', _4 => _4.url]);
|
|
63
|
+
if (!url) throw new Error("no url");
|
|
64
|
+
url = stripTrailingSlash(url);
|
|
65
|
+
if (url.startsWith("/") && !url.startsWith("//")) {
|
|
66
|
+
const urlWithOrigin = new URL(exampleDotCom);
|
|
67
|
+
urlWithOrigin.pathname = url;
|
|
68
|
+
url = urlWithOrigin.href;
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
url = exampleDotCom;
|
|
72
|
+
}
|
|
73
|
+
return ensureProtocol(url);
|
|
74
|
+
}
|
|
75
|
+
function variablesFromServers(servers, selected = 0) {
|
|
76
|
+
return _optionalChain([servers, 'optionalAccess', _5 => _5[selected], 'optionalAccess', _6 => _6.variables]) || {};
|
|
77
|
+
}
|
|
78
|
+
function defaultVariablesFromServers(servers, selected = 0, user = {}) {
|
|
79
|
+
const variables = variablesFromServers(servers, selected);
|
|
80
|
+
const defaults = {};
|
|
81
|
+
Object.keys(variables).forEach((key) => {
|
|
82
|
+
defaults[key] = getUserVariable(user, key) || variables[key].default || "";
|
|
83
|
+
});
|
|
84
|
+
return defaults;
|
|
85
|
+
}
|
|
86
|
+
function splitUrlFromServers(servers, selected = 0) {
|
|
87
|
+
const url = normalizedURLFromServers(servers, selected);
|
|
88
|
+
const variables = variablesFromServers(servers, selected);
|
|
89
|
+
return url.split(/({.+?})/).filter(Boolean).map((part, i) => {
|
|
90
|
+
const isVariable = part.match(/[{}]/);
|
|
91
|
+
const value = part.replace(/[{}]/g, "");
|
|
92
|
+
const key = `${value}-${i}`;
|
|
93
|
+
if (!isVariable) {
|
|
94
|
+
return {
|
|
95
|
+
type: "text",
|
|
96
|
+
value,
|
|
97
|
+
key
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const variable = _optionalChain([variables, 'optionalAccess', _7 => _7[value]]);
|
|
101
|
+
return {
|
|
102
|
+
type: "variable",
|
|
103
|
+
value,
|
|
104
|
+
key,
|
|
105
|
+
description: _optionalChain([variable, 'optionalAccess', _8 => _8.description]),
|
|
106
|
+
enum: _optionalChain([variable, 'optionalAccess', _9 => _9.enum])
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function transformURLIntoRegex(url) {
|
|
111
|
+
return stripTrailingSlash(url.replace(_chunkUKD63LKGcjs.SERVER_VARIABLE_REGEX, "([-_a-zA-Z0-9:.[\\]]+)"));
|
|
112
|
+
}
|
|
113
|
+
function normalizePath(path) {
|
|
114
|
+
return path.replace(/({?){(.*?)}(}?)/g, (str, ...args) => {
|
|
115
|
+
return `:${args[1].replace("-", "")}`;
|
|
116
|
+
}).replace(/::/, "\\::").split("?")[0];
|
|
117
|
+
}
|
|
118
|
+
function generatePathMatches(paths, pathName, origin) {
|
|
119
|
+
const prunedPathName = pathName.split("?")[0];
|
|
120
|
+
const matches = Object.keys(paths).map((path) => {
|
|
121
|
+
const cleanedPath = normalizePath(path);
|
|
122
|
+
let matchResult;
|
|
123
|
+
try {
|
|
124
|
+
const matchStatement = _pathtoregexp.match.call(void 0, cleanedPath, { decode: decodeURIComponent });
|
|
125
|
+
matchResult = matchStatement(prunedPathName);
|
|
126
|
+
} catch (e2) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
const slugs = {};
|
|
130
|
+
if (matchResult && Object.keys(matchResult.params).length) {
|
|
131
|
+
Object.keys(matchResult.params).forEach((param) => {
|
|
132
|
+
slugs[`:${param}`] = matchResult.params[param];
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
url: {
|
|
137
|
+
origin,
|
|
138
|
+
path: cleanedPath.replace(/\\::/, "::"),
|
|
139
|
+
nonNormalizedPath: path,
|
|
140
|
+
slugs
|
|
141
|
+
},
|
|
142
|
+
operation: paths[path],
|
|
143
|
+
match: matchResult
|
|
144
|
+
};
|
|
145
|
+
}).filter((item) => item !== false);
|
|
146
|
+
return matches.filter((p) => p.match);
|
|
147
|
+
}
|
|
148
|
+
function filterPathMethods(pathMatches, targetMethod) {
|
|
149
|
+
const regExp = _pathtoregexp.pathToRegexp.call(void 0, targetMethod);
|
|
150
|
+
return pathMatches.map((p) => {
|
|
151
|
+
const captures = Object.keys(p.operation).filter((r) => regExp.regexp.exec(r));
|
|
152
|
+
if (captures.length) {
|
|
153
|
+
const method = captures[0];
|
|
154
|
+
p.url.method = method.toUpperCase();
|
|
155
|
+
return {
|
|
156
|
+
url: p.url,
|
|
157
|
+
operation: p.operation[method]
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}).filter((item) => Boolean(item));
|
|
162
|
+
}
|
|
163
|
+
function findTargetPath(pathMatches) {
|
|
164
|
+
if (!pathMatches.length) {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
let minCount = Object.keys(pathMatches[0].url.slugs).length;
|
|
168
|
+
let found;
|
|
169
|
+
for (let m = 0; m < pathMatches.length; m += 1) {
|
|
170
|
+
const selection = pathMatches[m];
|
|
171
|
+
const paramCount = Object.keys(selection.url.slugs).length;
|
|
172
|
+
if (paramCount <= minCount) {
|
|
173
|
+
minCount = paramCount;
|
|
174
|
+
found = selection;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return found;
|
|
178
|
+
}
|
|
28
179
|
|
|
29
180
|
// src/operation/lib/dedupe-common-parameters.ts
|
|
30
181
|
function dedupeCommonParameters(parameters, commonParameters) {
|
|
@@ -42,7 +193,6 @@ function dedupeCommonParameters(parameters, commonParameters) {
|
|
|
42
193
|
|
|
43
194
|
// src/samples/index.ts
|
|
44
195
|
var _jsonschemamergeallof = require('json-schema-merge-allof'); var _jsonschemamergeallof2 = _interopRequireDefault(_jsonschemamergeallof);
|
|
45
|
-
var _memoizee = require('memoizee'); var _memoizee2 = _interopRequireDefault(_memoizee);
|
|
46
196
|
|
|
47
197
|
// src/samples/utils.ts
|
|
48
198
|
function usesPolymorphism(schema) {
|
|
@@ -56,7 +206,7 @@ function usesPolymorphism(schema) {
|
|
|
56
206
|
return false;
|
|
57
207
|
}
|
|
58
208
|
function objectify(thing) {
|
|
59
|
-
if (!
|
|
209
|
+
if (!_chunkUKD63LKGcjs.isObject.call(void 0, thing)) {
|
|
60
210
|
return {};
|
|
61
211
|
}
|
|
62
212
|
return thing;
|
|
@@ -121,7 +271,7 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
121
271
|
if (seenRefs.has(refToRelease)) {
|
|
122
272
|
return void 0;
|
|
123
273
|
}
|
|
124
|
-
objectifySchema =
|
|
274
|
+
objectifySchema = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, objectifySchema, opts.definition, seenRefs);
|
|
125
275
|
if (!objectifySchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, objectifySchema)) {
|
|
126
276
|
return void 0;
|
|
127
277
|
}
|
|
@@ -139,7 +289,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
139
289
|
const { example, additionalProperties, properties, items } = schema;
|
|
140
290
|
const { includeReadOnly, includeWriteOnly } = opts;
|
|
141
291
|
if (example !== void 0) {
|
|
142
|
-
return
|
|
292
|
+
return _chunkUKD63LKGcjs.dereferenceRefDeep.call(void 0, example, opts.definition, seenRefs);
|
|
143
293
|
}
|
|
144
294
|
const hasPolymorphism = usesPolymorphism(schema);
|
|
145
295
|
if (hasPolymorphism === "allOf") {
|
|
@@ -148,7 +298,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
148
298
|
const resolvedAllOf = schema.allOf.map((subSchema) => {
|
|
149
299
|
let sub = objectify(subSchema);
|
|
150
300
|
if (definition && _chunk7PWF3F2Wcjs.isRef.call(void 0, sub)) {
|
|
151
|
-
const resolved =
|
|
301
|
+
const resolved = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, sub, definition, /* @__PURE__ */ new Set());
|
|
152
302
|
if (resolved && !_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) {
|
|
153
303
|
sub = resolved;
|
|
154
304
|
}
|
|
@@ -171,7 +321,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
171
321
|
seenRefs
|
|
172
322
|
}
|
|
173
323
|
);
|
|
174
|
-
} catch (
|
|
324
|
+
} catch (e3) {
|
|
175
325
|
return;
|
|
176
326
|
}
|
|
177
327
|
} else if (hasPolymorphism) {
|
|
@@ -198,16 +348,16 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
198
348
|
const props = objectify(properties);
|
|
199
349
|
const obj = {};
|
|
200
350
|
for (const name in props) {
|
|
201
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
351
|
+
if (_optionalChain([props, 'optionalAccess', _10 => _10[name], 'access', _11 => _11.deprecated])) {
|
|
202
352
|
continue;
|
|
203
353
|
}
|
|
204
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
354
|
+
if (_optionalChain([props, 'optionalAccess', _12 => _12[name], 'access', _13 => _13.readOnly]) && !includeReadOnly) {
|
|
205
355
|
continue;
|
|
206
356
|
}
|
|
207
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
357
|
+
if (_optionalChain([props, 'optionalAccess', _14 => _14[name], 'access', _15 => _15.writeOnly]) && !includeWriteOnly) {
|
|
208
358
|
continue;
|
|
209
359
|
}
|
|
210
|
-
if (_optionalChain([props, 'access',
|
|
360
|
+
if (_optionalChain([props, 'access', _16 => _16[name], 'access', _17 => _17.examples, 'optionalAccess', _18 => _18.length])) {
|
|
211
361
|
obj[name] = props[name].examples[0];
|
|
212
362
|
continue;
|
|
213
363
|
}
|
|
@@ -255,14 +405,12 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
255
405
|
}
|
|
256
406
|
return primitive(schema);
|
|
257
407
|
}
|
|
258
|
-
var memo = _memoizee2.default.call(void 0, sampleFromSchema);
|
|
259
|
-
var samples_default = memo;
|
|
260
408
|
|
|
261
409
|
// src/operation/lib/get-mediatype-examples.ts
|
|
262
410
|
function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {}) {
|
|
263
411
|
if (mediaTypeObject.example) {
|
|
264
|
-
mediaTypeObject.example =
|
|
265
|
-
if (mediaTypeObject.example === void 0 ||
|
|
412
|
+
mediaTypeObject.example = _chunkUKD63LKGcjs.dereferenceRefDeep.call(void 0, mediaTypeObject.example, definition);
|
|
413
|
+
if (mediaTypeObject.example === void 0 || _chunkUKD63LKGcjs.collectRefsInSchema.call(void 0, mediaTypeObject.example).size > 0) {
|
|
266
414
|
return [];
|
|
267
415
|
}
|
|
268
416
|
return [
|
|
@@ -278,7 +426,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
278
426
|
let example = examples[key];
|
|
279
427
|
if (example !== null && typeof example === "object") {
|
|
280
428
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
281
|
-
example =
|
|
429
|
+
example = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, example, definition);
|
|
282
430
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
283
431
|
return false;
|
|
284
432
|
}
|
|
@@ -290,8 +438,8 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
290
438
|
description = example.description;
|
|
291
439
|
}
|
|
292
440
|
if ("value" in example) {
|
|
293
|
-
example.value =
|
|
294
|
-
if (example.value === void 0 ||
|
|
441
|
+
example.value = _chunkUKD63LKGcjs.dereferenceRefDeep.call(void 0, example.value, definition);
|
|
442
|
+
if (example.value === void 0 || _chunkUKD63LKGcjs.collectRefsInSchema.call(void 0, example.value).size > 0) {
|
|
295
443
|
return false;
|
|
296
444
|
}
|
|
297
445
|
example = example.value;
|
|
@@ -308,10 +456,10 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
308
456
|
}
|
|
309
457
|
}
|
|
310
458
|
if (mediaTypeObject.schema) {
|
|
311
|
-
if (!
|
|
459
|
+
if (!_chunkUKD63LKGcjs.matches_mimetype_default.xml(mediaType)) {
|
|
312
460
|
return [
|
|
313
461
|
{
|
|
314
|
-
value:
|
|
462
|
+
value: sampleFromSchema(structuredClone(mediaTypeObject.schema), {
|
|
315
463
|
...opts,
|
|
316
464
|
definition
|
|
317
465
|
})
|
|
@@ -325,17 +473,17 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
325
473
|
// src/operation/lib/get-response-examples.ts
|
|
326
474
|
function getResponseExamples(operation, definition) {
|
|
327
475
|
return Object.keys(operation.responses || {}).map((status) => {
|
|
328
|
-
let response = _optionalChain([operation, 'access',
|
|
476
|
+
let response = _optionalChain([operation, 'access', _19 => _19.responses, 'optionalAccess', _20 => _20[status]]);
|
|
329
477
|
let onlyHeaders = false;
|
|
330
478
|
if (!response) return false;
|
|
331
479
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
332
|
-
response =
|
|
480
|
+
response = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, definition);
|
|
333
481
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) return false;
|
|
334
482
|
}
|
|
335
483
|
const mediaTypes = {};
|
|
336
|
-
(_optionalChain([response, 'optionalAccess',
|
|
484
|
+
(_optionalChain([response, 'optionalAccess', _21 => _21.content]) ? Object.keys(response.content) : []).forEach((mediaType) => {
|
|
337
485
|
if (!mediaType) return;
|
|
338
|
-
const mediaTypeObject = _optionalChain([response, 'access',
|
|
486
|
+
const mediaTypeObject = _optionalChain([response, 'access', _22 => _22.content, 'optionalAccess', _23 => _23[mediaType]]);
|
|
339
487
|
if (!mediaTypeObject) return;
|
|
340
488
|
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, definition, {
|
|
341
489
|
includeReadOnly: true,
|
|
@@ -366,17 +514,17 @@ function getCallbackExamples(operation, definition) {
|
|
|
366
514
|
return [];
|
|
367
515
|
}
|
|
368
516
|
const examples = Object.keys(operation.callbacks).map((identifier) => {
|
|
369
|
-
let callback = _optionalChain([operation, 'access',
|
|
517
|
+
let callback = _optionalChain([operation, 'access', _24 => _24.callbacks, 'optionalAccess', _25 => _25[identifier]]);
|
|
370
518
|
if (!callback) return [];
|
|
371
519
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
372
|
-
callback =
|
|
520
|
+
callback = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callback, definition);
|
|
373
521
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) return [];
|
|
374
522
|
}
|
|
375
523
|
const items = Object.keys(callback).map((expression) => {
|
|
376
524
|
let callbackPath = callback[expression];
|
|
377
525
|
if (!callbackPath) return [];
|
|
378
526
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
379
|
-
callbackPath =
|
|
527
|
+
callbackPath = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackPath, definition);
|
|
380
528
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) return [];
|
|
381
529
|
}
|
|
382
530
|
return Object.keys(callbackPath).map((method) => {
|
|
@@ -426,7 +574,7 @@ function getExampleGroups(operation) {
|
|
|
426
574
|
const namelessCodeSampleCounts = {};
|
|
427
575
|
const groups = {};
|
|
428
576
|
const codeSamples = _chunkAYA3UT4Lcjs.getExtension.call(void 0, "code-samples", operation.api, operation);
|
|
429
|
-
_optionalChain([codeSamples, 'optionalAccess',
|
|
577
|
+
_optionalChain([codeSamples, 'optionalAccess', _26 => _26.forEach, 'call', _27 => _27((sample, i) => {
|
|
430
578
|
if (namelessCodeSampleCounts[sample.language]) {
|
|
431
579
|
namelessCodeSampleCounts[sample.language] += 1;
|
|
432
580
|
} else {
|
|
@@ -434,7 +582,7 @@ function getExampleGroups(operation) {
|
|
|
434
582
|
}
|
|
435
583
|
const name = getDefaultName(sample, namelessCodeSampleCounts);
|
|
436
584
|
if (sample.correspondingExample) {
|
|
437
|
-
if (_optionalChain([groups, 'access',
|
|
585
|
+
if (_optionalChain([groups, 'access', _28 => _28[sample.correspondingExample], 'optionalAccess', _29 => _29.customCodeSamples, 'optionalAccess', _30 => _30.length])) {
|
|
438
586
|
groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
439
587
|
} else if (sample.correspondingExample) {
|
|
440
588
|
groups[sample.correspondingExample] = {
|
|
@@ -442,7 +590,7 @@ function getExampleGroups(operation) {
|
|
|
442
590
|
customCodeSamples: [{ ...sample, name, originalIndex: i }]
|
|
443
591
|
};
|
|
444
592
|
}
|
|
445
|
-
} else if (_optionalChain([groups, 'access',
|
|
593
|
+
} else if (_optionalChain([groups, 'access', _31 => _31[noCorrespondingResponseKey], 'optionalAccess', _32 => _32.customCodeSamples, 'optionalAccess', _33 => _33.length])) {
|
|
446
594
|
groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
447
595
|
} else {
|
|
448
596
|
groups[noCorrespondingResponseKey] = {
|
|
@@ -459,16 +607,16 @@ function getExampleGroups(operation) {
|
|
|
459
607
|
Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]) => {
|
|
460
608
|
let example = paramExample;
|
|
461
609
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
462
|
-
example =
|
|
610
|
+
example = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, example, operation.api);
|
|
463
611
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) return;
|
|
464
612
|
}
|
|
465
613
|
groups[exampleKey] = {
|
|
466
614
|
...groups[exampleKey],
|
|
467
|
-
name: _optionalChain([groups, 'access',
|
|
615
|
+
name: _optionalChain([groups, 'access', _34 => _34[exampleKey], 'optionalAccess', _35 => _35.name]) || example.summary || exampleKey,
|
|
468
616
|
request: {
|
|
469
|
-
..._optionalChain([groups, 'access',
|
|
617
|
+
..._optionalChain([groups, 'access', _36 => _36[exampleKey], 'optionalAccess', _37 => _37.request]),
|
|
470
618
|
[param.in]: {
|
|
471
|
-
..._optionalChain([groups, 'access',
|
|
619
|
+
..._optionalChain([groups, 'access', _38 => _38[exampleKey], 'optionalAccess', _39 => _39.request, 'optionalAccess', _40 => _40[param.in]]),
|
|
472
620
|
[param.name]: example.value
|
|
473
621
|
}
|
|
474
622
|
}
|
|
@@ -481,9 +629,9 @@ function getExampleGroups(operation) {
|
|
|
481
629
|
const mediaType = requestExample.mediaType === "application/x-www-form-urlencoded" ? "formData" : "body";
|
|
482
630
|
groups[mediaTypeExample.title] = {
|
|
483
631
|
...groups[mediaTypeExample.title],
|
|
484
|
-
name: _optionalChain([groups, 'access',
|
|
632
|
+
name: _optionalChain([groups, 'access', _41 => _41[mediaTypeExample.title], 'optionalAccess', _42 => _42.name]) || mediaTypeExample.summary || mediaTypeExample.title,
|
|
485
633
|
request: {
|
|
486
|
-
..._optionalChain([groups, 'access',
|
|
634
|
+
..._optionalChain([groups, 'access', _43 => _43[mediaTypeExample.title], 'optionalAccess', _44 => _44.request]),
|
|
487
635
|
[mediaType]: mediaTypeExample.value
|
|
488
636
|
}
|
|
489
637
|
};
|
|
@@ -507,7 +655,7 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
507
655
|
if (!requestBody) {
|
|
508
656
|
return [];
|
|
509
657
|
} else if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
510
|
-
requestBody =
|
|
658
|
+
requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, definition);
|
|
511
659
|
}
|
|
512
660
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) || !requestBody.content) {
|
|
513
661
|
return [];
|
|
@@ -530,11 +678,11 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
530
678
|
|
|
531
679
|
// src/operation/lib/operationId.ts
|
|
532
680
|
function hasOperationId(operation) {
|
|
533
|
-
return Boolean("operationId" in operation && _optionalChain([operation, 'access',
|
|
681
|
+
return Boolean("operationId" in operation && _optionalChain([operation, 'access', _45 => _45.operationId, 'optionalAccess', _46 => _46.length]));
|
|
534
682
|
}
|
|
535
683
|
function getOperationId(path, method, operation, opts = {}) {
|
|
536
684
|
function sanitize(id) {
|
|
537
|
-
return id.replace(_optionalChain([opts, 'optionalAccess',
|
|
685
|
+
return id.replace(_optionalChain([opts, 'optionalAccess', _47 => _47.camelCase]) || _optionalChain([opts, 'optionalAccess', _48 => _48.friendlyCase]) ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, "-").replace(/--+/g, "-").replace(/^-|-$/g, "");
|
|
538
686
|
}
|
|
539
687
|
const operationIdExists = hasOperationId(operation);
|
|
540
688
|
let operationId;
|
|
@@ -544,8 +692,8 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
544
692
|
operationId = sanitize(path).toLowerCase();
|
|
545
693
|
}
|
|
546
694
|
const currMethod = method.toLowerCase();
|
|
547
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
548
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
695
|
+
if (_optionalChain([opts, 'optionalAccess', _49 => _49.camelCase]) || _optionalChain([opts, 'optionalAccess', _50 => _50.friendlyCase])) {
|
|
696
|
+
if (_optionalChain([opts, 'optionalAccess', _51 => _51.friendlyCase])) {
|
|
549
697
|
operationId = operationId.replaceAll("_", " ");
|
|
550
698
|
if (!operationIdExists) {
|
|
551
699
|
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`).split(" ").filter((word, i, arr) => word !== arr[i - 1]).join(" ");
|
|
@@ -555,7 +703,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
555
703
|
if (operationIdExists) {
|
|
556
704
|
operationId = sanitize(operationId);
|
|
557
705
|
}
|
|
558
|
-
operationId = operationId.replace(/^[0-9]/g, (
|
|
706
|
+
operationId = operationId.replace(/^[0-9]/g, (match2) => `_${match2}`);
|
|
559
707
|
operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);
|
|
560
708
|
if (operationId.startsWith(currMethod)) {
|
|
561
709
|
return operationId;
|
|
@@ -572,7 +720,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
572
720
|
}
|
|
573
721
|
|
|
574
722
|
// src/operation/transformers/get-response-as-json-schema.ts
|
|
575
|
-
var isJSON =
|
|
723
|
+
var isJSON = _chunkUKD63LKGcjs.matches_mimetype_default.json;
|
|
576
724
|
function buildHeadersSchema(response, schemaOptions) {
|
|
577
725
|
const headersSchema = {
|
|
578
726
|
type: "object",
|
|
@@ -582,10 +730,10 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
582
730
|
const seenRefs = _nullishCoalesce(schemaOptions.seenRefs, () => ( /* @__PURE__ */ new Set()));
|
|
583
731
|
if (response.headers) {
|
|
584
732
|
Object.keys(response.headers).forEach((key) => {
|
|
585
|
-
let headerEntry = _optionalChain([response, 'access',
|
|
733
|
+
let headerEntry = _optionalChain([response, 'access', _52 => _52.headers, 'optionalAccess', _53 => _53[key]]);
|
|
586
734
|
if (!headerEntry) return;
|
|
587
735
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) {
|
|
588
|
-
headerEntry =
|
|
736
|
+
headerEntry = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, headerEntry, api, seenRefs);
|
|
589
737
|
if (!headerEntry || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) return;
|
|
590
738
|
}
|
|
591
739
|
if (headerEntry.schema) {
|
|
@@ -593,10 +741,10 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
593
741
|
let headerSchema = header.schema;
|
|
594
742
|
if (!headerSchema) return;
|
|
595
743
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) {
|
|
596
|
-
headerSchema =
|
|
744
|
+
headerSchema = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, headerSchema, api, seenRefs);
|
|
597
745
|
if (!headerSchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) return;
|
|
598
746
|
}
|
|
599
|
-
headersSchema.properties[key] =
|
|
747
|
+
headersSchema.properties[key] = _chunkUKD63LKGcjs.toJSONSchema.call(void 0, _chunkUKD63LKGcjs.cloneObject.call(void 0, headerSchema), {
|
|
600
748
|
addEnumsToDescriptions: true,
|
|
601
749
|
...schemaOptions
|
|
602
750
|
});
|
|
@@ -650,35 +798,35 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
650
798
|
}
|
|
651
799
|
if (preferredContentType) {
|
|
652
800
|
if (contentTypes.includes(preferredContentType)) {
|
|
653
|
-
const schema2 =
|
|
801
|
+
const schema2 = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[preferredContentType].schema);
|
|
654
802
|
if (!schema2) {
|
|
655
803
|
return null;
|
|
656
804
|
}
|
|
657
|
-
return
|
|
805
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
658
806
|
}
|
|
659
807
|
return null;
|
|
660
808
|
}
|
|
661
809
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
662
810
|
if (isJSON(contentTypes[i])) {
|
|
663
|
-
const schema2 =
|
|
811
|
+
const schema2 = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[contentTypes[i]].schema);
|
|
664
812
|
if (!schema2) {
|
|
665
813
|
return {};
|
|
666
814
|
}
|
|
667
|
-
return
|
|
815
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
668
816
|
}
|
|
669
817
|
}
|
|
670
818
|
const contentType = contentTypes.shift();
|
|
671
819
|
if (!contentType) {
|
|
672
820
|
return {};
|
|
673
821
|
}
|
|
674
|
-
const schema =
|
|
822
|
+
const schema = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[contentType].schema);
|
|
675
823
|
if (!schema) {
|
|
676
824
|
return {};
|
|
677
825
|
}
|
|
678
|
-
return
|
|
826
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema, baseSchemaOptions);
|
|
679
827
|
}
|
|
680
|
-
const foundSchema = getPreferredSchema(response.content, _optionalChain([opts, 'optionalAccess',
|
|
681
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
828
|
+
const foundSchema = getPreferredSchema(response.content, _optionalChain([opts, 'optionalAccess', _54 => _54.contentType]));
|
|
829
|
+
if (_optionalChain([opts, 'optionalAccess', _55 => _55.contentType]) && !foundSchema) {
|
|
682
830
|
return null;
|
|
683
831
|
}
|
|
684
832
|
if (foundSchema) {
|
|
@@ -694,37 +842,37 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
694
842
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
695
843
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
696
844
|
type: _nullishCoalesce(schemaType, () => ( "string")),
|
|
697
|
-
schema:
|
|
845
|
+
schema: _chunkUKD63LKGcjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
698
846
|
...schema,
|
|
699
|
-
$schema:
|
|
847
|
+
$schema: _chunkUKD63LKGcjs.getSchemaVersionString.call(void 0, schema, api)
|
|
700
848
|
},
|
|
701
849
|
label: "Response body"
|
|
702
850
|
};
|
|
703
851
|
if (response.description && schemaWrapper.schema) {
|
|
704
852
|
schemaWrapper.description = response.description;
|
|
705
853
|
}
|
|
706
|
-
|
|
854
|
+
_chunkUKD63LKGcjs.applyDiscriminatorOneOfToUsedSchemas.call(void 0, api, usedSchemas, (ref) => {
|
|
707
855
|
if (usedSchemas.has(ref)) {
|
|
708
856
|
return usedSchemas.get(ref);
|
|
709
857
|
}
|
|
710
858
|
try {
|
|
711
|
-
const resolved =
|
|
859
|
+
const resolved = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, { $ref: ref }, api, seenRefs);
|
|
712
860
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) return;
|
|
713
|
-
const converted =
|
|
861
|
+
const converted = _chunkUKD63LKGcjs.toJSONSchema.call(void 0, structuredClone(resolved), {
|
|
714
862
|
...baseSchemaOptions,
|
|
715
863
|
seenRefs
|
|
716
864
|
});
|
|
717
865
|
usedSchemas.set(ref, converted);
|
|
718
866
|
return converted;
|
|
719
|
-
} catch (
|
|
867
|
+
} catch (e4) {
|
|
720
868
|
}
|
|
721
869
|
});
|
|
722
870
|
if (schemaWrapper.schema && usedSchemas.size > 0) {
|
|
723
|
-
const refsInOutput =
|
|
871
|
+
const refsInOutput = _chunkUKD63LKGcjs.collectRefsInSchema.call(void 0, schemaWrapper.schema);
|
|
724
872
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("body"), () => ( /* @__PURE__ */ new Set()));
|
|
725
|
-
const referencedSchemas =
|
|
873
|
+
const referencedSchemas = _chunkUKD63LKGcjs.filterRequiredRefsToReferenced.call(void 0, /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]), usedSchemas);
|
|
726
874
|
if (referencedSchemas.size > 0) {
|
|
727
|
-
|
|
875
|
+
_chunkUKD63LKGcjs.mergeReferencedSchemasIntoRoot.call(void 0, schemaWrapper.schema, referencedSchemas);
|
|
728
876
|
}
|
|
729
877
|
}
|
|
730
878
|
jsonSchema.push(schemaWrapper);
|
|
@@ -736,10 +884,10 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
736
884
|
});
|
|
737
885
|
if (headersWrapper.schema && usedSchemas.size > 0) {
|
|
738
886
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("headers"), () => ( /* @__PURE__ */ new Set()));
|
|
739
|
-
const refsInOutput =
|
|
740
|
-
const referencedSchemas =
|
|
887
|
+
const refsInOutput = _chunkUKD63LKGcjs.collectRefsInSchema.call(void 0, headersWrapper.schema);
|
|
888
|
+
const referencedSchemas = _chunkUKD63LKGcjs.filterRequiredRefsToReferenced.call(void 0, /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]), usedSchemas);
|
|
741
889
|
if (referencedSchemas.size > 0) {
|
|
742
|
-
|
|
890
|
+
_chunkUKD63LKGcjs.mergeReferencedSchemasIntoRoot.call(void 0, headersWrapper.schema, referencedSchemas);
|
|
743
891
|
}
|
|
744
892
|
}
|
|
745
893
|
jsonSchema.push(headersWrapper);
|
|
@@ -748,7 +896,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
748
896
|
}
|
|
749
897
|
|
|
750
898
|
// src/operation/index.ts
|
|
751
|
-
var Operation =
|
|
899
|
+
var Operation = class {
|
|
752
900
|
/**
|
|
753
901
|
* The `Oas` instance that this operation belongs to.
|
|
754
902
|
*/
|
|
@@ -793,25 +941,7 @@ var Operation = (_class = class {
|
|
|
793
941
|
* Flattened out arrays of both request and response headers that are utilized on this operation.
|
|
794
942
|
*/
|
|
795
943
|
|
|
796
|
-
|
|
797
|
-
* Internal storage array that the library utilizes to keep track of the times the
|
|
798
|
-
* {@see Operation.dereference} has been called so that if you initiate multiple promises they'll
|
|
799
|
-
* all end up returning the same data set once the initial dereference call completed.
|
|
800
|
-
*/
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Internal storage array that the library utilizes to keep track of its `dereferencing` state so
|
|
804
|
-
* it doesn't initiate multiple dereferencing processes.
|
|
805
|
-
*/
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* Have the component schemas within this API definition been decorated with our
|
|
809
|
-
* `x-readme-ref-name` extension?
|
|
810
|
-
*
|
|
811
|
-
* @see {@link decorateComponentSchemas}
|
|
812
|
-
*/
|
|
813
|
-
__init() {this.schemasDecorated = false}
|
|
814
|
-
constructor(oas, path, method, operation) {;_class.prototype.__init.call(this);
|
|
944
|
+
constructor(oas, path, method, operation) {
|
|
815
945
|
this.oas = oas;
|
|
816
946
|
this.schema = operation;
|
|
817
947
|
this.api = oas.api;
|
|
@@ -826,12 +956,6 @@ var Operation = (_class = class {
|
|
|
826
956
|
request: [],
|
|
827
957
|
response: []
|
|
828
958
|
};
|
|
829
|
-
this.promises = [];
|
|
830
|
-
this.dereferencing = {
|
|
831
|
-
processing: false,
|
|
832
|
-
complete: false,
|
|
833
|
-
circularRefs: []
|
|
834
|
-
};
|
|
835
959
|
}
|
|
836
960
|
/**
|
|
837
961
|
* Retrieve the `summary` for this operation.
|
|
@@ -840,11 +964,11 @@ var Operation = (_class = class {
|
|
|
840
964
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
841
965
|
*/
|
|
842
966
|
getSummary() {
|
|
843
|
-
if (_optionalChain([this, 'access',
|
|
967
|
+
if (_optionalChain([this, 'access', _56 => _56.schema, 'optionalAccess', _57 => _57.summary]) && typeof this.schema.summary === "string") {
|
|
844
968
|
return this.schema.summary;
|
|
845
969
|
}
|
|
846
|
-
const pathItem = _optionalChain([this, 'access',
|
|
847
|
-
if (_optionalChain([pathItem, 'optionalAccess',
|
|
970
|
+
const pathItem = _optionalChain([this, 'access', _58 => _58.api, 'access', _59 => _59.paths, 'optionalAccess', _60 => _60[this.path]]);
|
|
971
|
+
if (_optionalChain([pathItem, 'optionalAccess', _61 => _61.summary]) && typeof pathItem.summary === "string") {
|
|
848
972
|
return pathItem.summary;
|
|
849
973
|
}
|
|
850
974
|
return void 0;
|
|
@@ -856,15 +980,44 @@ var Operation = (_class = class {
|
|
|
856
980
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
857
981
|
*/
|
|
858
982
|
getDescription() {
|
|
859
|
-
if (_optionalChain([this, 'access',
|
|
983
|
+
if (_optionalChain([this, 'access', _62 => _62.schema, 'optionalAccess', _63 => _63.description]) && typeof this.schema.description === "string") {
|
|
860
984
|
return this.schema.description;
|
|
861
985
|
}
|
|
862
|
-
const pathItem = _optionalChain([this, 'access',
|
|
863
|
-
if (_optionalChain([pathItem, 'optionalAccess',
|
|
986
|
+
const pathItem = _optionalChain([this, 'access', _64 => _64.api, 'access', _65 => _65.paths, 'optionalAccess', _66 => _66[this.path]]);
|
|
987
|
+
if (_optionalChain([pathItem, 'optionalAccess', _67 => _67.description]) && typeof pathItem.description === "string") {
|
|
864
988
|
return pathItem.description;
|
|
865
989
|
}
|
|
866
990
|
return void 0;
|
|
867
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* Retrieve the server objects that apply to this operation, using OpenAPI server precedence:
|
|
994
|
+
* operation-level servers, then path-item servers, then root-level servers.
|
|
995
|
+
*/
|
|
996
|
+
getServers() {
|
|
997
|
+
if (_optionalChain([this, 'access', _68 => _68.schema, 'access', _69 => _69.servers, 'optionalAccess', _70 => _70.length])) {
|
|
998
|
+
return this.schema.servers;
|
|
999
|
+
}
|
|
1000
|
+
if (_optionalChain([this, 'access', _71 => _71.api, 'access', _72 => _72.paths, 'optionalAccess', _73 => _73[this.path]])) {
|
|
1001
|
+
const pathItem = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, this.api.paths[this.path], this.api);
|
|
1002
|
+
if (pathItem && !_chunk7PWF3F2Wcjs.isRef.call(void 0, pathItem) && _optionalChain([pathItem, 'access', _74 => _74.servers, 'optionalAccess', _75 => _75.length])) {
|
|
1003
|
+
return pathItem.servers;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return this.api.servers || [];
|
|
1007
|
+
}
|
|
1008
|
+
url(selected = 0, variables) {
|
|
1009
|
+
const url = normalizedURLFromServers(this.getServers(), selected);
|
|
1010
|
+
return this.oas.replaceUrl(url, variables || this.defaultVariables(selected)).trim();
|
|
1011
|
+
}
|
|
1012
|
+
variables(selected = 0) {
|
|
1013
|
+
return variablesFromServers(this.getServers(), selected);
|
|
1014
|
+
}
|
|
1015
|
+
defaultVariables(selected = 0) {
|
|
1016
|
+
return defaultVariablesFromServers(this.getServers(), selected, this.oas.user);
|
|
1017
|
+
}
|
|
1018
|
+
splitUrl(selected = 0) {
|
|
1019
|
+
return splitUrlFromServers(this.getServers(), selected);
|
|
1020
|
+
}
|
|
868
1021
|
/**
|
|
869
1022
|
* Retrieve the primary content type for this operation. If multiple exist, the first JSON-like
|
|
870
1023
|
* type will be returned.
|
|
@@ -879,18 +1032,18 @@ var Operation = (_class = class {
|
|
|
879
1032
|
let types = [];
|
|
880
1033
|
if (this.schema.requestBody) {
|
|
881
1034
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.requestBody)) {
|
|
882
|
-
this.schema.requestBody =
|
|
1035
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, this.schema.requestBody, this.api);
|
|
883
1036
|
}
|
|
884
1037
|
if (this.schema.requestBody && "content" in this.schema.requestBody) {
|
|
885
1038
|
types = Object.keys(this.schema.requestBody.content);
|
|
886
1039
|
}
|
|
887
1040
|
}
|
|
888
1041
|
this.contentType = "application/json";
|
|
889
|
-
if (_optionalChain([types, 'optionalAccess',
|
|
1042
|
+
if (_optionalChain([types, 'optionalAccess', _76 => _76.length])) {
|
|
890
1043
|
this.contentType = types[0];
|
|
891
1044
|
}
|
|
892
1045
|
types.forEach((t) => {
|
|
893
|
-
if (
|
|
1046
|
+
if (_chunkUKD63LKGcjs.matches_mimetype_default.json(t)) {
|
|
894
1047
|
this.contentType = t;
|
|
895
1048
|
}
|
|
896
1049
|
});
|
|
@@ -903,7 +1056,7 @@ var Operation = (_class = class {
|
|
|
903
1056
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
904
1057
|
*/
|
|
905
1058
|
isFormUrlEncoded() {
|
|
906
|
-
return
|
|
1059
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
907
1060
|
}
|
|
908
1061
|
/**
|
|
909
1062
|
* Checks if the current operation has a mutipart content type payload.
|
|
@@ -912,7 +1065,7 @@ var Operation = (_class = class {
|
|
|
912
1065
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
913
1066
|
*/
|
|
914
1067
|
isMultipart() {
|
|
915
|
-
return
|
|
1068
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.multipart(this.getContentType());
|
|
916
1069
|
}
|
|
917
1070
|
/**
|
|
918
1071
|
* Checks if the current operation has a JSON-like content type payload.
|
|
@@ -921,7 +1074,7 @@ var Operation = (_class = class {
|
|
|
921
1074
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
922
1075
|
*/
|
|
923
1076
|
isJson() {
|
|
924
|
-
return
|
|
1077
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.json(this.getContentType());
|
|
925
1078
|
}
|
|
926
1079
|
/**
|
|
927
1080
|
* Checks if the current operation has an XML content type payload.
|
|
@@ -930,7 +1083,7 @@ var Operation = (_class = class {
|
|
|
930
1083
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
931
1084
|
*/
|
|
932
1085
|
isXml() {
|
|
933
|
-
return
|
|
1086
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.xml(this.getContentType());
|
|
934
1087
|
}
|
|
935
1088
|
/**
|
|
936
1089
|
* Checks if the current operation is a webhook or not.
|
|
@@ -949,7 +1102,7 @@ var Operation = (_class = class {
|
|
|
949
1102
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#security-requirement-object}
|
|
950
1103
|
*/
|
|
951
1104
|
getSecurity() {
|
|
952
|
-
if (!_optionalChain([this, 'access',
|
|
1105
|
+
if (!_optionalChain([this, 'access', _77 => _77.api, 'optionalAccess', _78 => _78.components, 'optionalAccess', _79 => _79.securitySchemes]) || !Object.keys(this.api.components.securitySchemes).length) {
|
|
953
1106
|
return [];
|
|
954
1107
|
}
|
|
955
1108
|
return this.schema.security || this.api.security || [];
|
|
@@ -969,19 +1122,19 @@ var Operation = (_class = class {
|
|
|
969
1122
|
let keys;
|
|
970
1123
|
try {
|
|
971
1124
|
keys = Object.keys(requirement);
|
|
972
|
-
} catch (
|
|
1125
|
+
} catch (e5) {
|
|
973
1126
|
return false;
|
|
974
1127
|
}
|
|
975
1128
|
const keysWithTypes = keys.map((key) => {
|
|
976
1129
|
let security;
|
|
977
1130
|
try {
|
|
978
|
-
security = _optionalChain([this, 'access',
|
|
1131
|
+
security = _optionalChain([this, 'access', _80 => _80.api, 'optionalAccess', _81 => _81.components, 'optionalAccess', _82 => _82.securitySchemes, 'optionalAccess', _83 => _83[key]]);
|
|
979
1132
|
if (!security) return false;
|
|
980
1133
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, security)) {
|
|
981
|
-
security =
|
|
1134
|
+
security = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, security, this.api);
|
|
982
1135
|
if (!security || _chunk7PWF3F2Wcjs.isRef.call(void 0, security)) return false;
|
|
983
1136
|
}
|
|
984
|
-
} catch (
|
|
1137
|
+
} catch (e6) {
|
|
985
1138
|
return false;
|
|
986
1139
|
}
|
|
987
1140
|
if (!security || _chunk7PWF3F2Wcjs.isRef.call(void 0, security)) return false;
|
|
@@ -1027,7 +1180,7 @@ var Operation = (_class = class {
|
|
|
1027
1180
|
if (!prev[security.type]) prev[security.type] = [];
|
|
1028
1181
|
const exists = prev[security.type].some((sec) => sec._key === security.security._key);
|
|
1029
1182
|
if (!exists) {
|
|
1030
|
-
if (_optionalChain([security, 'access',
|
|
1183
|
+
if (_optionalChain([security, 'access', _84 => _84.security, 'optionalAccess', _85 => _85._requirements])) delete security.security._requirements;
|
|
1031
1184
|
prev[security.type].push(security.security);
|
|
1032
1185
|
}
|
|
1033
1186
|
});
|
|
@@ -1059,7 +1212,7 @@ var Operation = (_class = class {
|
|
|
1059
1212
|
this.schema.parameters.map((p) => {
|
|
1060
1213
|
let param = p;
|
|
1061
1214
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1062
|
-
param =
|
|
1215
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1063
1216
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1064
1217
|
}
|
|
1065
1218
|
if (param.in && param.in === "header") return param.name;
|
|
@@ -1072,20 +1225,20 @@ var Operation = (_class = class {
|
|
|
1072
1225
|
let response = this.schema.responses[r];
|
|
1073
1226
|
if (!response) return [];
|
|
1074
1227
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1075
|
-
this.schema.responses[r] =
|
|
1228
|
+
this.schema.responses[r] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1076
1229
|
response = this.schema.responses[r];
|
|
1077
1230
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1078
1231
|
return [];
|
|
1079
1232
|
}
|
|
1080
1233
|
}
|
|
1081
|
-
return _optionalChain([response, 'optionalAccess',
|
|
1234
|
+
return _optionalChain([response, 'optionalAccess', _86 => _86.headers]) ? Object.keys(response.headers) : [];
|
|
1082
1235
|
}).reduce((a, b) => a.concat(b), []);
|
|
1083
1236
|
}
|
|
1084
1237
|
if (!this.headers.request.includes("Content-Type") && this.schema.requestBody) {
|
|
1085
1238
|
let requestBody = this.schema.requestBody;
|
|
1086
1239
|
if (requestBody) {
|
|
1087
1240
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1088
|
-
this.schema.requestBody =
|
|
1241
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1089
1242
|
requestBody = this.schema.requestBody;
|
|
1090
1243
|
}
|
|
1091
1244
|
if (requestBody && !_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) && "content" in requestBody && Object.keys(requestBody.content)) {
|
|
@@ -1095,10 +1248,10 @@ var Operation = (_class = class {
|
|
|
1095
1248
|
}
|
|
1096
1249
|
if (this.schema.responses) {
|
|
1097
1250
|
const hasResponseContent = Object.keys(this.schema.responses).some((r) => {
|
|
1098
|
-
let response = _optionalChain([this, 'access',
|
|
1251
|
+
let response = _optionalChain([this, 'access', _87 => _87.schema, 'access', _88 => _88.responses, 'optionalAccess', _89 => _89[r]]);
|
|
1099
1252
|
if (!response) return false;
|
|
1100
1253
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1101
|
-
this.schema.responses[r] =
|
|
1254
|
+
this.schema.responses[r] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1102
1255
|
response = this.schema.responses[r];
|
|
1103
1256
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1104
1257
|
return false;
|
|
@@ -1162,7 +1315,7 @@ var Operation = (_class = class {
|
|
|
1162
1315
|
return [];
|
|
1163
1316
|
}
|
|
1164
1317
|
const oasTagMap = /* @__PURE__ */ new Map();
|
|
1165
|
-
if (Array.isArray(_optionalChain([this, 'access',
|
|
1318
|
+
if (Array.isArray(_optionalChain([this, 'access', _90 => _90.api, 'optionalAccess', _91 => _91.tags]))) {
|
|
1166
1319
|
this.api.tags.forEach((tag) => {
|
|
1167
1320
|
oasTagMap.set(tag.name, tag);
|
|
1168
1321
|
});
|
|
@@ -1205,18 +1358,18 @@ var Operation = (_class = class {
|
|
|
1205
1358
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
1206
1359
|
*/
|
|
1207
1360
|
getParameters() {
|
|
1208
|
-
let parameters = (_optionalChain([this, 'access',
|
|
1361
|
+
let parameters = (_optionalChain([this, 'access', _92 => _92.schema, 'optionalAccess', _93 => _93.parameters]) || []).map((p) => {
|
|
1209
1362
|
let param = p;
|
|
1210
1363
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1211
|
-
param =
|
|
1364
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1212
1365
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1213
1366
|
}
|
|
1214
1367
|
return param;
|
|
1215
1368
|
}).filter((param) => param !== void 0);
|
|
1216
|
-
const commonParams = (_optionalChain([this, 'access',
|
|
1369
|
+
const commonParams = (_optionalChain([this, 'access', _94 => _94.api, 'optionalAccess', _95 => _95.paths, 'optionalAccess', _96 => _96[this.path], 'optionalAccess', _97 => _97.parameters]) || []).map((p) => {
|
|
1217
1370
|
let param = p;
|
|
1218
1371
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1219
|
-
param =
|
|
1372
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1220
1373
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1221
1374
|
}
|
|
1222
1375
|
return param;
|
|
@@ -1248,16 +1401,8 @@ var Operation = (_class = class {
|
|
|
1248
1401
|
*
|
|
1249
1402
|
*/
|
|
1250
1403
|
getParametersAsJSONSchema(opts = {}) {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
"`.getParametersAsJSONSchema()` is not compatible with an operation or OpenAPI definition that has been run through `.dereference().`"
|
|
1254
|
-
);
|
|
1255
|
-
}
|
|
1256
|
-
if (!this.schemasDecorated) {
|
|
1257
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1258
|
-
this.schemasDecorated = true;
|
|
1259
|
-
}
|
|
1260
|
-
return _chunkSCWW2SNXcjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
1404
|
+
_chunkUKD63LKGcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1405
|
+
return _chunkUKD63LKGcjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
1261
1406
|
includeDiscriminatorMappingRefs: true,
|
|
1262
1407
|
...opts
|
|
1263
1408
|
});
|
|
@@ -1276,15 +1421,7 @@ var Operation = (_class = class {
|
|
|
1276
1421
|
* this content-type, the function will return null.
|
|
1277
1422
|
*/
|
|
1278
1423
|
getResponseAsJSONSchema(statusCode, opts = {}) {
|
|
1279
|
-
|
|
1280
|
-
throw new Error(
|
|
1281
|
-
"`.getResponseAsJSONSchema()` is not compatible with an operation or OpenAPI definition that has been run through `.dereference().`"
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
|
-
if (!this.schemasDecorated) {
|
|
1285
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1286
|
-
this.schemasDecorated = true;
|
|
1287
|
-
}
|
|
1424
|
+
_chunkUKD63LKGcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1288
1425
|
return getResponseAsJSONSchema(this, this.api, statusCode, {
|
|
1289
1426
|
includeDiscriminatorMappingRefs: true,
|
|
1290
1427
|
...opts
|
|
@@ -1297,7 +1434,7 @@ var Operation = (_class = class {
|
|
|
1297
1434
|
getResponseStatusCodes() {
|
|
1298
1435
|
if (!this.schema.responses) return [];
|
|
1299
1436
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1300
|
-
this.schema.responses =
|
|
1437
|
+
this.schema.responses = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, this.schema.responses, this.api);
|
|
1301
1438
|
if (!this.schema.responses || _chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1302
1439
|
return [];
|
|
1303
1440
|
}
|
|
@@ -1306,7 +1443,7 @@ var Operation = (_class = class {
|
|
|
1306
1443
|
if (key.startsWith("x-")) {
|
|
1307
1444
|
return false;
|
|
1308
1445
|
}
|
|
1309
|
-
const response = _optionalChain([this, 'access',
|
|
1446
|
+
const response = _optionalChain([this, 'access', _98 => _98.schema, 'access', _99 => _99.responses, 'optionalAccess', _100 => _100[key]]);
|
|
1310
1447
|
return response && typeof response === "object";
|
|
1311
1448
|
});
|
|
1312
1449
|
}
|
|
@@ -1323,7 +1460,7 @@ var Operation = (_class = class {
|
|
|
1323
1460
|
let resp = response;
|
|
1324
1461
|
if (!resp) return;
|
|
1325
1462
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1326
|
-
resp =
|
|
1463
|
+
resp = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, resp, this.api);
|
|
1327
1464
|
if (!resp || _chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1328
1465
|
return;
|
|
1329
1466
|
}
|
|
@@ -1352,7 +1489,7 @@ var Operation = (_class = class {
|
|
|
1352
1489
|
let requestBody = this.schema.requestBody;
|
|
1353
1490
|
if (!requestBody) return false;
|
|
1354
1491
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1355
|
-
this.schema.requestBody =
|
|
1492
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1356
1493
|
requestBody = this.schema.requestBody;
|
|
1357
1494
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1358
1495
|
return false;
|
|
@@ -1426,7 +1563,7 @@ var Operation = (_class = class {
|
|
|
1426
1563
|
let availableMediaType;
|
|
1427
1564
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1428
1565
|
mediaTypes.forEach((mt) => {
|
|
1429
|
-
if (!availableMediaType &&
|
|
1566
|
+
if (!availableMediaType && _chunkUKD63LKGcjs.matches_mimetype_default.json(mt)) {
|
|
1430
1567
|
availableMediaType = mt;
|
|
1431
1568
|
}
|
|
1432
1569
|
});
|
|
@@ -1453,7 +1590,7 @@ var Operation = (_class = class {
|
|
|
1453
1590
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#request-body-examples}
|
|
1454
1591
|
*/
|
|
1455
1592
|
getRequestBodyExamples() {
|
|
1456
|
-
const isRequestExampleValueDefined = typeof _optionalChain([this, 'access',
|
|
1593
|
+
const isRequestExampleValueDefined = typeof _optionalChain([this, 'access', _101 => _101.requestBodyExamples, 'optionalAccess', _102 => _102[0], 'optionalAccess', _103 => _103.examples, 'optionalAccess', _104 => _104[0], 'access', _105 => _105.value]) !== "undefined";
|
|
1457
1594
|
if (this.requestBodyExamples && isRequestExampleValueDefined) {
|
|
1458
1595
|
return this.requestBodyExamples;
|
|
1459
1596
|
}
|
|
@@ -1474,7 +1611,7 @@ var Operation = (_class = class {
|
|
|
1474
1611
|
let response = this.schema.responses[statusCode];
|
|
1475
1612
|
if (!response) return false;
|
|
1476
1613
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1477
|
-
this.schema.responses[statusCode] =
|
|
1614
|
+
this.schema.responses[statusCode] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1478
1615
|
response = this.schema.responses[statusCode];
|
|
1479
1616
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1480
1617
|
return false;
|
|
@@ -1518,7 +1655,7 @@ var Operation = (_class = class {
|
|
|
1518
1655
|
let callbackObj = this.schema.callbacks[identifier];
|
|
1519
1656
|
if (!callbackObj) return false;
|
|
1520
1657
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1521
|
-
this.schema.callbacks[identifier] =
|
|
1658
|
+
this.schema.callbacks[identifier] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackObj, this.api);
|
|
1522
1659
|
callbackObj = this.schema.callbacks[identifier];
|
|
1523
1660
|
if (!callbackObj || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1524
1661
|
return false;
|
|
@@ -1527,7 +1664,7 @@ var Operation = (_class = class {
|
|
|
1527
1664
|
let callback = callbackObj[expression];
|
|
1528
1665
|
if (!callback) return false;
|
|
1529
1666
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1530
|
-
callbackObj[expression] =
|
|
1667
|
+
callbackObj[expression] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callback, this.api);
|
|
1531
1668
|
callback = callbackObj[expression];
|
|
1532
1669
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1533
1670
|
return false;
|
|
@@ -1548,10 +1685,10 @@ var Operation = (_class = class {
|
|
|
1548
1685
|
if (!this.hasCallbacks()) return [];
|
|
1549
1686
|
const callbacks = [];
|
|
1550
1687
|
Object.keys(this.schema.callbacks).forEach((callback) => {
|
|
1551
|
-
let cb = _optionalChain([this, 'access',
|
|
1688
|
+
let cb = _optionalChain([this, 'access', _106 => _106.schema, 'access', _107 => _107.callbacks, 'optionalAccess', _108 => _108[callback]]);
|
|
1552
1689
|
if (!cb) return;
|
|
1553
1690
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1554
|
-
this.schema.callbacks[callback] =
|
|
1691
|
+
this.schema.callbacks[callback] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, cb, this.api);
|
|
1555
1692
|
cb = this.schema.callbacks[callback];
|
|
1556
1693
|
if (!cb || _chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1557
1694
|
return;
|
|
@@ -1561,14 +1698,14 @@ var Operation = (_class = class {
|
|
|
1561
1698
|
let callbackPath = cb[expression];
|
|
1562
1699
|
if (!callbackPath) return;
|
|
1563
1700
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1564
|
-
cb[expression] =
|
|
1701
|
+
cb[expression] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackPath, this.api);
|
|
1565
1702
|
callbackPath = cb[expression];
|
|
1566
1703
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1567
1704
|
return;
|
|
1568
1705
|
}
|
|
1569
1706
|
}
|
|
1570
1707
|
Object.keys(callbackPath).forEach((method) => {
|
|
1571
|
-
if (!
|
|
1708
|
+
if (!_chunkUKD63LKGcjs.supportedMethods.includes(method)) return;
|
|
1572
1709
|
const found = this.getCallback(callback, expression, method);
|
|
1573
1710
|
if (found) {
|
|
1574
1711
|
callbacks.push(found);
|
|
@@ -1611,7 +1748,7 @@ var Operation = (_class = class {
|
|
|
1611
1748
|
* @deprecated Use `oas.getExtension(extension, operation)` instead.
|
|
1612
1749
|
*/
|
|
1613
1750
|
getExtension(extension) {
|
|
1614
|
-
return _optionalChain([this, 'access',
|
|
1751
|
+
return _optionalChain([this, 'access', _109 => _109.schema, 'optionalAccess', _110 => _110[extension]]);
|
|
1615
1752
|
}
|
|
1616
1753
|
/**
|
|
1617
1754
|
* Returns an object with groups of all example definitions (body/header/query/path/response/etc.).
|
|
@@ -1630,108 +1767,7 @@ var Operation = (_class = class {
|
|
|
1630
1767
|
this.exampleGroups = groups;
|
|
1631
1768
|
return groups;
|
|
1632
1769
|
}
|
|
1633
|
-
|
|
1634
|
-
* Dereference the current operation schema so it can be parsed free of worries of `$ref` schemas
|
|
1635
|
-
* and circular structures.
|
|
1636
|
-
*
|
|
1637
|
-
*/
|
|
1638
|
-
async dereference(opts) {
|
|
1639
|
-
if (this.dereferencing.complete) {
|
|
1640
|
-
return Promise.resolve(true);
|
|
1641
|
-
}
|
|
1642
|
-
if (this.dereferencing.processing) {
|
|
1643
|
-
return new Promise((resolve, reject) => {
|
|
1644
|
-
this.promises.push({ resolve, reject });
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
this.dereferencing.processing = true;
|
|
1648
|
-
if (!this.schemasDecorated) {
|
|
1649
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1650
|
-
this.schemasDecorated = true;
|
|
1651
|
-
}
|
|
1652
|
-
const { api, schema, promises } = this;
|
|
1653
|
-
const circularRefs = /* @__PURE__ */ new Set();
|
|
1654
|
-
const dereferencingOptions = _chunkSCWW2SNXcjs.getDereferencingOptions.call(void 0, circularRefs);
|
|
1655
|
-
const parser = new (0, _jsonschemarefparser.$RefParser)();
|
|
1656
|
-
return parser.dereference(
|
|
1657
|
-
"#/__INTERNAL__",
|
|
1658
|
-
{
|
|
1659
|
-
// Because `json-schema-ref-parser` will dereference this entire object as we only want
|
|
1660
|
-
// to dereference this operation schema we're attaching it to the `__INTERNAL__` key, and
|
|
1661
|
-
// later using that to extract our dereferenced schema. If we didn't do this then we run
|
|
1662
|
-
// the risk of any keyword in `schema` being overriden by `paths` and `components`.
|
|
1663
|
-
//
|
|
1664
|
-
// This solution isn't the best and still requires us to send `json-schema-ref-parser`
|
|
1665
|
-
// basically the entire API defintiion but because we don't know what `$ref` pointers in
|
|
1666
|
-
// `schema` reference, we can't know which parts of full API definition we could safely
|
|
1667
|
-
// exclude from this process.
|
|
1668
|
-
__INTERNAL__: structuredClone(schema),
|
|
1669
|
-
paths: _nullishCoalesce(api.paths, () => ( void 0)),
|
|
1670
|
-
components: _nullishCoalesce(api.components, () => ( void 0))
|
|
1671
|
-
},
|
|
1672
|
-
{
|
|
1673
|
-
...dereferencingOptions,
|
|
1674
|
-
dereference: {
|
|
1675
|
-
...dereferencingOptions.dereference,
|
|
1676
|
-
/**
|
|
1677
|
-
* Because we only want to dereference our `__INTERNAL__` schema, not the **entire**
|
|
1678
|
-
* API definition if the parser attemps to dereference anything but that then we
|
|
1679
|
-
* should bail out of that crawler.
|
|
1680
|
-
*
|
|
1681
|
-
* @fixme this may cause issues where a path references a schema within itself to be ignored.
|
|
1682
|
-
*/
|
|
1683
|
-
excludedPathMatcher: (path) => {
|
|
1684
|
-
if (path === "#/paths" || path.startsWith("#/paths/")) {
|
|
1685
|
-
return true;
|
|
1686
|
-
}
|
|
1687
|
-
return path === "#/components" || path.startsWith("#/components/");
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
).then((res) => {
|
|
1692
|
-
const dereferenced = res;
|
|
1693
|
-
this.schema = dereferenced.__INTERNAL__;
|
|
1694
|
-
this.promises = promises;
|
|
1695
|
-
this.dereferencing = {
|
|
1696
|
-
processing: false,
|
|
1697
|
-
complete: true,
|
|
1698
|
-
// We need to convert our `Set` to an array in order to match the typings.
|
|
1699
|
-
circularRefs: [...circularRefs]
|
|
1700
|
-
};
|
|
1701
|
-
if (_optionalChain([opts, 'optionalAccess', _95 => _95.cb])) {
|
|
1702
|
-
opts.cb();
|
|
1703
|
-
}
|
|
1704
|
-
}).then(() => {
|
|
1705
|
-
return this.promises.map((deferred) => deferred.resolve());
|
|
1706
|
-
}).catch((err) => {
|
|
1707
|
-
this.dereferencing.processing = false;
|
|
1708
|
-
this.promises.map((deferred) => deferred.reject(err));
|
|
1709
|
-
throw err;
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
/**
|
|
1713
|
-
* Determine if the current operation schema, or the OpenAPI definition it's part of, has been
|
|
1714
|
-
* dereferenced or not with `.dereference()`.
|
|
1715
|
-
*
|
|
1716
|
-
* @see Operation.dereference
|
|
1717
|
-
*/
|
|
1718
|
-
isDereferenced() {
|
|
1719
|
-
return this.oas.isDereferenced() || this.dereferencing.processing || this.dereferencing.complete;
|
|
1720
|
-
}
|
|
1721
|
-
/**
|
|
1722
|
-
* Retrieve any circular `$ref` pointers that maybe present within operation schema.
|
|
1723
|
-
*
|
|
1724
|
-
* This method requires that you first dereference the definition.
|
|
1725
|
-
*
|
|
1726
|
-
* @see Operation.dereference
|
|
1727
|
-
*/
|
|
1728
|
-
getCircularReferences() {
|
|
1729
|
-
if (!this.dereferencing.complete) {
|
|
1730
|
-
throw new Error(".dereference() must be called first in order for this method to obtain circular references.");
|
|
1731
|
-
}
|
|
1732
|
-
return this.dereferencing.circularRefs;
|
|
1733
|
-
}
|
|
1734
|
-
}, _class);
|
|
1770
|
+
};
|
|
1735
1771
|
var Callback = class extends Operation {
|
|
1736
1772
|
/**
|
|
1737
1773
|
* The identifier that this callback is set to.
|
|
@@ -1762,7 +1798,7 @@ var Callback = class extends Operation {
|
|
|
1762
1798
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
1763
1799
|
*/
|
|
1764
1800
|
getSummary() {
|
|
1765
|
-
if (_optionalChain([this, 'access',
|
|
1801
|
+
if (_optionalChain([this, 'access', _111 => _111.schema, 'optionalAccess', _112 => _112.summary]) && typeof this.schema.summary === "string") {
|
|
1766
1802
|
return this.schema.summary;
|
|
1767
1803
|
} else if (this.parentSchema.summary && typeof this.parentSchema.summary === "string") {
|
|
1768
1804
|
return this.parentSchema.summary;
|
|
@@ -1776,7 +1812,7 @@ var Callback = class extends Operation {
|
|
|
1776
1812
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
1777
1813
|
*/
|
|
1778
1814
|
getDescription() {
|
|
1779
|
-
if (_optionalChain([this, 'access',
|
|
1815
|
+
if (_optionalChain([this, 'access', _113 => _113.schema, 'optionalAccess', _114 => _114.description]) && typeof this.schema.description === "string") {
|
|
1780
1816
|
return this.schema.description;
|
|
1781
1817
|
} else if (this.parentSchema.description && typeof this.parentSchema.description === "string") {
|
|
1782
1818
|
return this.parentSchema.description;
|
|
@@ -1790,10 +1826,10 @@ var Callback = class extends Operation {
|
|
|
1790
1826
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
1791
1827
|
*/
|
|
1792
1828
|
getParameters() {
|
|
1793
|
-
let parameters = (_optionalChain([this, 'access',
|
|
1829
|
+
let parameters = (_optionalChain([this, 'access', _115 => _115.schema, 'optionalAccess', _116 => _116.parameters]) || []).map((p) => {
|
|
1794
1830
|
let param = p;
|
|
1795
1831
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1796
|
-
param =
|
|
1832
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1797
1833
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1798
1834
|
}
|
|
1799
1835
|
return param;
|
|
@@ -1801,7 +1837,7 @@ var Callback = class extends Operation {
|
|
|
1801
1837
|
const commonParams = (this.parentSchema.parameters || []).map((p) => {
|
|
1802
1838
|
let param = p;
|
|
1803
1839
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1804
|
-
param =
|
|
1840
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1805
1841
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1806
1842
|
}
|
|
1807
1843
|
return param;
|
|
@@ -1820,17 +1856,17 @@ var Webhook = class extends Operation {
|
|
|
1820
1856
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
1821
1857
|
*/
|
|
1822
1858
|
getSummary() {
|
|
1823
|
-
if (_optionalChain([this, 'access',
|
|
1859
|
+
if (_optionalChain([this, 'access', _117 => _117.schema, 'optionalAccess', _118 => _118.summary]) && typeof this.schema.summary === "string") {
|
|
1824
1860
|
return this.schema.summary;
|
|
1825
1861
|
} else if (!this.api.webhooks) {
|
|
1826
1862
|
return void 0;
|
|
1827
1863
|
}
|
|
1828
1864
|
let webhookPath = this.api.webhooks[this.path];
|
|
1829
1865
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1830
|
-
this.api.webhooks[this.path] =
|
|
1866
|
+
this.api.webhooks[this.path] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1831
1867
|
webhookPath = this.api.webhooks[this.path];
|
|
1832
1868
|
}
|
|
1833
|
-
return _optionalChain([webhookPath, 'optionalAccess',
|
|
1869
|
+
return _optionalChain([webhookPath, 'optionalAccess', _119 => _119.summary]);
|
|
1834
1870
|
}
|
|
1835
1871
|
/**
|
|
1836
1872
|
* Retrieve the `description` for this operation.
|
|
@@ -1839,17 +1875,17 @@ var Webhook = class extends Operation {
|
|
|
1839
1875
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
1840
1876
|
*/
|
|
1841
1877
|
getDescription() {
|
|
1842
|
-
if (_optionalChain([this, 'access',
|
|
1878
|
+
if (_optionalChain([this, 'access', _120 => _120.schema, 'optionalAccess', _121 => _121.description]) && typeof this.schema.description === "string") {
|
|
1843
1879
|
return this.schema.description;
|
|
1844
1880
|
} else if (!this.api.webhooks) {
|
|
1845
1881
|
return void 0;
|
|
1846
1882
|
}
|
|
1847
1883
|
let webhookPath = this.api.webhooks[this.path];
|
|
1848
1884
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1849
|
-
this.api.webhooks[this.path] =
|
|
1885
|
+
this.api.webhooks[this.path] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1850
1886
|
webhookPath = this.api.webhooks[this.path];
|
|
1851
1887
|
}
|
|
1852
|
-
return _optionalChain([webhookPath, 'optionalAccess',
|
|
1888
|
+
return _optionalChain([webhookPath, 'optionalAccess', _122 => _122.description]);
|
|
1853
1889
|
}
|
|
1854
1890
|
};
|
|
1855
1891
|
|
|
@@ -1857,7 +1893,17 @@ var Webhook = class extends Operation {
|
|
|
1857
1893
|
|
|
1858
1894
|
|
|
1859
1895
|
|
|
1860
|
-
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
exports.getUserVariable = getUserVariable; exports.stripTrailingSlash = stripTrailingSlash; exports.normalizedURLFromServers = normalizedURLFromServers; exports.variablesFromServers = variablesFromServers; exports.defaultVariablesFromServers = defaultVariablesFromServers; exports.splitUrlFromServers = splitUrlFromServers; exports.transformURLIntoRegex = transformURLIntoRegex; exports.generatePathMatches = generatePathMatches; exports.filterPathMethods = filterPathMethods; exports.findTargetPath = findTargetPath; exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = Webhook;
|
|
1861
1907
|
/**
|
|
1862
1908
|
* Portions of this file have been extracted and modified from Swagger UI.
|
|
1863
1909
|
*
|
|
@@ -1870,4 +1916,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1870
1916
|
* @license Apache-2.0
|
|
1871
1917
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1872
1918
|
*/
|
|
1873
|
-
//# sourceMappingURL=chunk-
|
|
1919
|
+
//# sourceMappingURL=chunk-GS43VKJH.cjs.map
|