oas 36.0.3 → 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-BJCTM2ME.cjs → chunk-GS43VKJH.cjs} +319 -270
- 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-RQZ2BPMU.js → chunk-WIVQX3DA.js} +198 -149
- 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 -2
- package/dist/chunk-4WJUHXQH.js +0 -866
- package/dist/chunk-4WJUHXQH.js.map +0 -1
- package/dist/chunk-6MDVLJ3A.js.map +0 -1
- package/dist/chunk-BJCTM2ME.cjs.map +0 -1
- package/dist/chunk-LJWHPW4H.cjs +0 -866
- package/dist/chunk-LJWHPW4H.cjs.map +0 -1
- package/dist/chunk-RQZ2BPMU.js.map +0 -1
- package/dist/chunk-SCWW2SNX.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) {
|
|
@@ -55,7 +206,7 @@ function usesPolymorphism(schema) {
|
|
|
55
206
|
return false;
|
|
56
207
|
}
|
|
57
208
|
function objectify(thing) {
|
|
58
|
-
if (!
|
|
209
|
+
if (!_chunkUKD63LKGcjs.isObject.call(void 0, thing)) {
|
|
59
210
|
return {};
|
|
60
211
|
}
|
|
61
212
|
return thing;
|
|
@@ -120,7 +271,7 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
120
271
|
if (seenRefs.has(refToRelease)) {
|
|
121
272
|
return void 0;
|
|
122
273
|
}
|
|
123
|
-
objectifySchema =
|
|
274
|
+
objectifySchema = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, objectifySchema, opts.definition, seenRefs);
|
|
124
275
|
if (!objectifySchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, objectifySchema)) {
|
|
125
276
|
return void 0;
|
|
126
277
|
}
|
|
@@ -138,7 +289,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
138
289
|
const { example, additionalProperties, properties, items } = schema;
|
|
139
290
|
const { includeReadOnly, includeWriteOnly } = opts;
|
|
140
291
|
if (example !== void 0) {
|
|
141
|
-
return
|
|
292
|
+
return _chunkUKD63LKGcjs.dereferenceRefDeep.call(void 0, example, opts.definition, seenRefs);
|
|
142
293
|
}
|
|
143
294
|
const hasPolymorphism = usesPolymorphism(schema);
|
|
144
295
|
if (hasPolymorphism === "allOf") {
|
|
@@ -147,7 +298,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
147
298
|
const resolvedAllOf = schema.allOf.map((subSchema) => {
|
|
148
299
|
let sub = objectify(subSchema);
|
|
149
300
|
if (definition && _chunk7PWF3F2Wcjs.isRef.call(void 0, sub)) {
|
|
150
|
-
const resolved =
|
|
301
|
+
const resolved = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, sub, definition, /* @__PURE__ */ new Set());
|
|
151
302
|
if (resolved && !_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) {
|
|
152
303
|
sub = resolved;
|
|
153
304
|
}
|
|
@@ -170,7 +321,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
170
321
|
seenRefs
|
|
171
322
|
}
|
|
172
323
|
);
|
|
173
|
-
} catch (
|
|
324
|
+
} catch (e3) {
|
|
174
325
|
return;
|
|
175
326
|
}
|
|
176
327
|
} else if (hasPolymorphism) {
|
|
@@ -197,16 +348,16 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
197
348
|
const props = objectify(properties);
|
|
198
349
|
const obj = {};
|
|
199
350
|
for (const name in props) {
|
|
200
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
351
|
+
if (_optionalChain([props, 'optionalAccess', _10 => _10[name], 'access', _11 => _11.deprecated])) {
|
|
201
352
|
continue;
|
|
202
353
|
}
|
|
203
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
354
|
+
if (_optionalChain([props, 'optionalAccess', _12 => _12[name], 'access', _13 => _13.readOnly]) && !includeReadOnly) {
|
|
204
355
|
continue;
|
|
205
356
|
}
|
|
206
|
-
if (_optionalChain([props, 'optionalAccess',
|
|
357
|
+
if (_optionalChain([props, 'optionalAccess', _14 => _14[name], 'access', _15 => _15.writeOnly]) && !includeWriteOnly) {
|
|
207
358
|
continue;
|
|
208
359
|
}
|
|
209
|
-
if (_optionalChain([props, 'access',
|
|
360
|
+
if (_optionalChain([props, 'access', _16 => _16[name], 'access', _17 => _17.examples, 'optionalAccess', _18 => _18.length])) {
|
|
210
361
|
obj[name] = props[name].examples[0];
|
|
211
362
|
continue;
|
|
212
363
|
}
|
|
@@ -258,8 +409,8 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
258
409
|
// src/operation/lib/get-mediatype-examples.ts
|
|
259
410
|
function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {}) {
|
|
260
411
|
if (mediaTypeObject.example) {
|
|
261
|
-
mediaTypeObject.example =
|
|
262
|
-
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) {
|
|
263
414
|
return [];
|
|
264
415
|
}
|
|
265
416
|
return [
|
|
@@ -275,7 +426,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
275
426
|
let example = examples[key];
|
|
276
427
|
if (example !== null && typeof example === "object") {
|
|
277
428
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
278
|
-
example =
|
|
429
|
+
example = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, example, definition);
|
|
279
430
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
280
431
|
return false;
|
|
281
432
|
}
|
|
@@ -287,8 +438,8 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
287
438
|
description = example.description;
|
|
288
439
|
}
|
|
289
440
|
if ("value" in example) {
|
|
290
|
-
example.value =
|
|
291
|
-
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) {
|
|
292
443
|
return false;
|
|
293
444
|
}
|
|
294
445
|
example = example.value;
|
|
@@ -305,7 +456,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
305
456
|
}
|
|
306
457
|
}
|
|
307
458
|
if (mediaTypeObject.schema) {
|
|
308
|
-
if (!
|
|
459
|
+
if (!_chunkUKD63LKGcjs.matches_mimetype_default.xml(mediaType)) {
|
|
309
460
|
return [
|
|
310
461
|
{
|
|
311
462
|
value: sampleFromSchema(structuredClone(mediaTypeObject.schema), {
|
|
@@ -322,17 +473,17 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
322
473
|
// src/operation/lib/get-response-examples.ts
|
|
323
474
|
function getResponseExamples(operation, definition) {
|
|
324
475
|
return Object.keys(operation.responses || {}).map((status) => {
|
|
325
|
-
let response = _optionalChain([operation, 'access',
|
|
476
|
+
let response = _optionalChain([operation, 'access', _19 => _19.responses, 'optionalAccess', _20 => _20[status]]);
|
|
326
477
|
let onlyHeaders = false;
|
|
327
478
|
if (!response) return false;
|
|
328
479
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
329
|
-
response =
|
|
480
|
+
response = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, definition);
|
|
330
481
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) return false;
|
|
331
482
|
}
|
|
332
483
|
const mediaTypes = {};
|
|
333
|
-
(_optionalChain([response, 'optionalAccess',
|
|
484
|
+
(_optionalChain([response, 'optionalAccess', _21 => _21.content]) ? Object.keys(response.content) : []).forEach((mediaType) => {
|
|
334
485
|
if (!mediaType) return;
|
|
335
|
-
const mediaTypeObject = _optionalChain([response, 'access',
|
|
486
|
+
const mediaTypeObject = _optionalChain([response, 'access', _22 => _22.content, 'optionalAccess', _23 => _23[mediaType]]);
|
|
336
487
|
if (!mediaTypeObject) return;
|
|
337
488
|
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, definition, {
|
|
338
489
|
includeReadOnly: true,
|
|
@@ -363,17 +514,17 @@ function getCallbackExamples(operation, definition) {
|
|
|
363
514
|
return [];
|
|
364
515
|
}
|
|
365
516
|
const examples = Object.keys(operation.callbacks).map((identifier) => {
|
|
366
|
-
let callback = _optionalChain([operation, 'access',
|
|
517
|
+
let callback = _optionalChain([operation, 'access', _24 => _24.callbacks, 'optionalAccess', _25 => _25[identifier]]);
|
|
367
518
|
if (!callback) return [];
|
|
368
519
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
369
|
-
callback =
|
|
520
|
+
callback = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callback, definition);
|
|
370
521
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) return [];
|
|
371
522
|
}
|
|
372
523
|
const items = Object.keys(callback).map((expression) => {
|
|
373
524
|
let callbackPath = callback[expression];
|
|
374
525
|
if (!callbackPath) return [];
|
|
375
526
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
376
|
-
callbackPath =
|
|
527
|
+
callbackPath = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackPath, definition);
|
|
377
528
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) return [];
|
|
378
529
|
}
|
|
379
530
|
return Object.keys(callbackPath).map((method) => {
|
|
@@ -423,7 +574,7 @@ function getExampleGroups(operation) {
|
|
|
423
574
|
const namelessCodeSampleCounts = {};
|
|
424
575
|
const groups = {};
|
|
425
576
|
const codeSamples = _chunkAYA3UT4Lcjs.getExtension.call(void 0, "code-samples", operation.api, operation);
|
|
426
|
-
_optionalChain([codeSamples, 'optionalAccess',
|
|
577
|
+
_optionalChain([codeSamples, 'optionalAccess', _26 => _26.forEach, 'call', _27 => _27((sample, i) => {
|
|
427
578
|
if (namelessCodeSampleCounts[sample.language]) {
|
|
428
579
|
namelessCodeSampleCounts[sample.language] += 1;
|
|
429
580
|
} else {
|
|
@@ -431,7 +582,7 @@ function getExampleGroups(operation) {
|
|
|
431
582
|
}
|
|
432
583
|
const name = getDefaultName(sample, namelessCodeSampleCounts);
|
|
433
584
|
if (sample.correspondingExample) {
|
|
434
|
-
if (_optionalChain([groups, 'access',
|
|
585
|
+
if (_optionalChain([groups, 'access', _28 => _28[sample.correspondingExample], 'optionalAccess', _29 => _29.customCodeSamples, 'optionalAccess', _30 => _30.length])) {
|
|
435
586
|
groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
436
587
|
} else if (sample.correspondingExample) {
|
|
437
588
|
groups[sample.correspondingExample] = {
|
|
@@ -439,7 +590,7 @@ function getExampleGroups(operation) {
|
|
|
439
590
|
customCodeSamples: [{ ...sample, name, originalIndex: i }]
|
|
440
591
|
};
|
|
441
592
|
}
|
|
442
|
-
} else if (_optionalChain([groups, 'access',
|
|
593
|
+
} else if (_optionalChain([groups, 'access', _31 => _31[noCorrespondingResponseKey], 'optionalAccess', _32 => _32.customCodeSamples, 'optionalAccess', _33 => _33.length])) {
|
|
443
594
|
groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
444
595
|
} else {
|
|
445
596
|
groups[noCorrespondingResponseKey] = {
|
|
@@ -456,16 +607,16 @@ function getExampleGroups(operation) {
|
|
|
456
607
|
Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]) => {
|
|
457
608
|
let example = paramExample;
|
|
458
609
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
459
|
-
example =
|
|
610
|
+
example = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, example, operation.api);
|
|
460
611
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) return;
|
|
461
612
|
}
|
|
462
613
|
groups[exampleKey] = {
|
|
463
614
|
...groups[exampleKey],
|
|
464
|
-
name: _optionalChain([groups, 'access',
|
|
615
|
+
name: _optionalChain([groups, 'access', _34 => _34[exampleKey], 'optionalAccess', _35 => _35.name]) || example.summary || exampleKey,
|
|
465
616
|
request: {
|
|
466
|
-
..._optionalChain([groups, 'access',
|
|
617
|
+
..._optionalChain([groups, 'access', _36 => _36[exampleKey], 'optionalAccess', _37 => _37.request]),
|
|
467
618
|
[param.in]: {
|
|
468
|
-
..._optionalChain([groups, 'access',
|
|
619
|
+
..._optionalChain([groups, 'access', _38 => _38[exampleKey], 'optionalAccess', _39 => _39.request, 'optionalAccess', _40 => _40[param.in]]),
|
|
469
620
|
[param.name]: example.value
|
|
470
621
|
}
|
|
471
622
|
}
|
|
@@ -478,9 +629,9 @@ function getExampleGroups(operation) {
|
|
|
478
629
|
const mediaType = requestExample.mediaType === "application/x-www-form-urlencoded" ? "formData" : "body";
|
|
479
630
|
groups[mediaTypeExample.title] = {
|
|
480
631
|
...groups[mediaTypeExample.title],
|
|
481
|
-
name: _optionalChain([groups, 'access',
|
|
632
|
+
name: _optionalChain([groups, 'access', _41 => _41[mediaTypeExample.title], 'optionalAccess', _42 => _42.name]) || mediaTypeExample.summary || mediaTypeExample.title,
|
|
482
633
|
request: {
|
|
483
|
-
..._optionalChain([groups, 'access',
|
|
634
|
+
..._optionalChain([groups, 'access', _43 => _43[mediaTypeExample.title], 'optionalAccess', _44 => _44.request]),
|
|
484
635
|
[mediaType]: mediaTypeExample.value
|
|
485
636
|
}
|
|
486
637
|
};
|
|
@@ -504,7 +655,7 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
504
655
|
if (!requestBody) {
|
|
505
656
|
return [];
|
|
506
657
|
} else if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
507
|
-
requestBody =
|
|
658
|
+
requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, definition);
|
|
508
659
|
}
|
|
509
660
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) || !requestBody.content) {
|
|
510
661
|
return [];
|
|
@@ -527,11 +678,11 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
527
678
|
|
|
528
679
|
// src/operation/lib/operationId.ts
|
|
529
680
|
function hasOperationId(operation) {
|
|
530
|
-
return Boolean("operationId" in operation && _optionalChain([operation, 'access',
|
|
681
|
+
return Boolean("operationId" in operation && _optionalChain([operation, 'access', _45 => _45.operationId, 'optionalAccess', _46 => _46.length]));
|
|
531
682
|
}
|
|
532
683
|
function getOperationId(path, method, operation, opts = {}) {
|
|
533
684
|
function sanitize(id) {
|
|
534
|
-
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, "");
|
|
535
686
|
}
|
|
536
687
|
const operationIdExists = hasOperationId(operation);
|
|
537
688
|
let operationId;
|
|
@@ -541,8 +692,8 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
541
692
|
operationId = sanitize(path).toLowerCase();
|
|
542
693
|
}
|
|
543
694
|
const currMethod = method.toLowerCase();
|
|
544
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
545
|
-
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])) {
|
|
546
697
|
operationId = operationId.replaceAll("_", " ");
|
|
547
698
|
if (!operationIdExists) {
|
|
548
699
|
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`).split(" ").filter((word, i, arr) => word !== arr[i - 1]).join(" ");
|
|
@@ -552,7 +703,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
552
703
|
if (operationIdExists) {
|
|
553
704
|
operationId = sanitize(operationId);
|
|
554
705
|
}
|
|
555
|
-
operationId = operationId.replace(/^[0-9]/g, (
|
|
706
|
+
operationId = operationId.replace(/^[0-9]/g, (match2) => `_${match2}`);
|
|
556
707
|
operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);
|
|
557
708
|
if (operationId.startsWith(currMethod)) {
|
|
558
709
|
return operationId;
|
|
@@ -569,7 +720,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
569
720
|
}
|
|
570
721
|
|
|
571
722
|
// src/operation/transformers/get-response-as-json-schema.ts
|
|
572
|
-
var isJSON =
|
|
723
|
+
var isJSON = _chunkUKD63LKGcjs.matches_mimetype_default.json;
|
|
573
724
|
function buildHeadersSchema(response, schemaOptions) {
|
|
574
725
|
const headersSchema = {
|
|
575
726
|
type: "object",
|
|
@@ -579,10 +730,10 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
579
730
|
const seenRefs = _nullishCoalesce(schemaOptions.seenRefs, () => ( /* @__PURE__ */ new Set()));
|
|
580
731
|
if (response.headers) {
|
|
581
732
|
Object.keys(response.headers).forEach((key) => {
|
|
582
|
-
let headerEntry = _optionalChain([response, 'access',
|
|
733
|
+
let headerEntry = _optionalChain([response, 'access', _52 => _52.headers, 'optionalAccess', _53 => _53[key]]);
|
|
583
734
|
if (!headerEntry) return;
|
|
584
735
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) {
|
|
585
|
-
headerEntry =
|
|
736
|
+
headerEntry = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, headerEntry, api, seenRefs);
|
|
586
737
|
if (!headerEntry || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) return;
|
|
587
738
|
}
|
|
588
739
|
if (headerEntry.schema) {
|
|
@@ -590,10 +741,10 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
590
741
|
let headerSchema = header.schema;
|
|
591
742
|
if (!headerSchema) return;
|
|
592
743
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) {
|
|
593
|
-
headerSchema =
|
|
744
|
+
headerSchema = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, headerSchema, api, seenRefs);
|
|
594
745
|
if (!headerSchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) return;
|
|
595
746
|
}
|
|
596
|
-
headersSchema.properties[key] =
|
|
747
|
+
headersSchema.properties[key] = _chunkUKD63LKGcjs.toJSONSchema.call(void 0, _chunkUKD63LKGcjs.cloneObject.call(void 0, headerSchema), {
|
|
597
748
|
addEnumsToDescriptions: true,
|
|
598
749
|
...schemaOptions
|
|
599
750
|
});
|
|
@@ -647,35 +798,35 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
647
798
|
}
|
|
648
799
|
if (preferredContentType) {
|
|
649
800
|
if (contentTypes.includes(preferredContentType)) {
|
|
650
|
-
const schema2 =
|
|
801
|
+
const schema2 = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[preferredContentType].schema);
|
|
651
802
|
if (!schema2) {
|
|
652
803
|
return null;
|
|
653
804
|
}
|
|
654
|
-
return
|
|
805
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
655
806
|
}
|
|
656
807
|
return null;
|
|
657
808
|
}
|
|
658
809
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
659
810
|
if (isJSON(contentTypes[i])) {
|
|
660
|
-
const schema2 =
|
|
811
|
+
const schema2 = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[contentTypes[i]].schema);
|
|
661
812
|
if (!schema2) {
|
|
662
813
|
return {};
|
|
663
814
|
}
|
|
664
|
-
return
|
|
815
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
665
816
|
}
|
|
666
817
|
}
|
|
667
818
|
const contentType = contentTypes.shift();
|
|
668
819
|
if (!contentType) {
|
|
669
820
|
return {};
|
|
670
821
|
}
|
|
671
|
-
const schema =
|
|
822
|
+
const schema = _chunkUKD63LKGcjs.cloneObject.call(void 0, content[contentType].schema);
|
|
672
823
|
if (!schema) {
|
|
673
824
|
return {};
|
|
674
825
|
}
|
|
675
|
-
return
|
|
826
|
+
return _chunkUKD63LKGcjs.toJSONSchema.call(void 0, schema, baseSchemaOptions);
|
|
676
827
|
}
|
|
677
|
-
const foundSchema = getPreferredSchema(response.content, _optionalChain([opts, 'optionalAccess',
|
|
678
|
-
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) {
|
|
679
830
|
return null;
|
|
680
831
|
}
|
|
681
832
|
if (foundSchema) {
|
|
@@ -691,37 +842,37 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
691
842
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
692
843
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
693
844
|
type: _nullishCoalesce(schemaType, () => ( "string")),
|
|
694
|
-
schema:
|
|
845
|
+
schema: _chunkUKD63LKGcjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
695
846
|
...schema,
|
|
696
|
-
$schema:
|
|
847
|
+
$schema: _chunkUKD63LKGcjs.getSchemaVersionString.call(void 0, schema, api)
|
|
697
848
|
},
|
|
698
849
|
label: "Response body"
|
|
699
850
|
};
|
|
700
851
|
if (response.description && schemaWrapper.schema) {
|
|
701
852
|
schemaWrapper.description = response.description;
|
|
702
853
|
}
|
|
703
|
-
|
|
854
|
+
_chunkUKD63LKGcjs.applyDiscriminatorOneOfToUsedSchemas.call(void 0, api, usedSchemas, (ref) => {
|
|
704
855
|
if (usedSchemas.has(ref)) {
|
|
705
856
|
return usedSchemas.get(ref);
|
|
706
857
|
}
|
|
707
858
|
try {
|
|
708
|
-
const resolved =
|
|
859
|
+
const resolved = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, { $ref: ref }, api, seenRefs);
|
|
709
860
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) return;
|
|
710
|
-
const converted =
|
|
861
|
+
const converted = _chunkUKD63LKGcjs.toJSONSchema.call(void 0, structuredClone(resolved), {
|
|
711
862
|
...baseSchemaOptions,
|
|
712
863
|
seenRefs
|
|
713
864
|
});
|
|
714
865
|
usedSchemas.set(ref, converted);
|
|
715
866
|
return converted;
|
|
716
|
-
} catch (
|
|
867
|
+
} catch (e4) {
|
|
717
868
|
}
|
|
718
869
|
});
|
|
719
870
|
if (schemaWrapper.schema && usedSchemas.size > 0) {
|
|
720
|
-
const refsInOutput =
|
|
871
|
+
const refsInOutput = _chunkUKD63LKGcjs.collectRefsInSchema.call(void 0, schemaWrapper.schema);
|
|
721
872
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("body"), () => ( /* @__PURE__ */ new Set()));
|
|
722
|
-
const referencedSchemas =
|
|
873
|
+
const referencedSchemas = _chunkUKD63LKGcjs.filterRequiredRefsToReferenced.call(void 0, /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]), usedSchemas);
|
|
723
874
|
if (referencedSchemas.size > 0) {
|
|
724
|
-
|
|
875
|
+
_chunkUKD63LKGcjs.mergeReferencedSchemasIntoRoot.call(void 0, schemaWrapper.schema, referencedSchemas);
|
|
725
876
|
}
|
|
726
877
|
}
|
|
727
878
|
jsonSchema.push(schemaWrapper);
|
|
@@ -733,10 +884,10 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
733
884
|
});
|
|
734
885
|
if (headersWrapper.schema && usedSchemas.size > 0) {
|
|
735
886
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("headers"), () => ( /* @__PURE__ */ new Set()));
|
|
736
|
-
const refsInOutput =
|
|
737
|
-
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);
|
|
738
889
|
if (referencedSchemas.size > 0) {
|
|
739
|
-
|
|
890
|
+
_chunkUKD63LKGcjs.mergeReferencedSchemasIntoRoot.call(void 0, headersWrapper.schema, referencedSchemas);
|
|
740
891
|
}
|
|
741
892
|
}
|
|
742
893
|
jsonSchema.push(headersWrapper);
|
|
@@ -745,7 +896,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
745
896
|
}
|
|
746
897
|
|
|
747
898
|
// src/operation/index.ts
|
|
748
|
-
var Operation =
|
|
899
|
+
var Operation = class {
|
|
749
900
|
/**
|
|
750
901
|
* The `Oas` instance that this operation belongs to.
|
|
751
902
|
*/
|
|
@@ -790,25 +941,7 @@ var Operation = (_class = class {
|
|
|
790
941
|
* Flattened out arrays of both request and response headers that are utilized on this operation.
|
|
791
942
|
*/
|
|
792
943
|
|
|
793
|
-
|
|
794
|
-
* Internal storage array that the library utilizes to keep track of the times the
|
|
795
|
-
* {@see Operation.dereference} has been called so that if you initiate multiple promises they'll
|
|
796
|
-
* all end up returning the same data set once the initial dereference call completed.
|
|
797
|
-
*/
|
|
798
|
-
|
|
799
|
-
/**
|
|
800
|
-
* Internal storage array that the library utilizes to keep track of its `dereferencing` state so
|
|
801
|
-
* it doesn't initiate multiple dereferencing processes.
|
|
802
|
-
*/
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Have the component schemas within this API definition been decorated with our
|
|
806
|
-
* `x-readme-ref-name` extension?
|
|
807
|
-
*
|
|
808
|
-
* @see {@link decorateComponentSchemas}
|
|
809
|
-
*/
|
|
810
|
-
__init() {this.schemasDecorated = false}
|
|
811
|
-
constructor(oas, path, method, operation) {;_class.prototype.__init.call(this);
|
|
944
|
+
constructor(oas, path, method, operation) {
|
|
812
945
|
this.oas = oas;
|
|
813
946
|
this.schema = operation;
|
|
814
947
|
this.api = oas.api;
|
|
@@ -823,12 +956,6 @@ var Operation = (_class = class {
|
|
|
823
956
|
request: [],
|
|
824
957
|
response: []
|
|
825
958
|
};
|
|
826
|
-
this.promises = [];
|
|
827
|
-
this.dereferencing = {
|
|
828
|
-
processing: false,
|
|
829
|
-
complete: false,
|
|
830
|
-
circularRefs: []
|
|
831
|
-
};
|
|
832
959
|
}
|
|
833
960
|
/**
|
|
834
961
|
* Retrieve the `summary` for this operation.
|
|
@@ -837,11 +964,11 @@ var Operation = (_class = class {
|
|
|
837
964
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
838
965
|
*/
|
|
839
966
|
getSummary() {
|
|
840
|
-
if (_optionalChain([this, 'access',
|
|
967
|
+
if (_optionalChain([this, 'access', _56 => _56.schema, 'optionalAccess', _57 => _57.summary]) && typeof this.schema.summary === "string") {
|
|
841
968
|
return this.schema.summary;
|
|
842
969
|
}
|
|
843
|
-
const pathItem = _optionalChain([this, 'access',
|
|
844
|
-
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") {
|
|
845
972
|
return pathItem.summary;
|
|
846
973
|
}
|
|
847
974
|
return void 0;
|
|
@@ -853,15 +980,44 @@ var Operation = (_class = class {
|
|
|
853
980
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
854
981
|
*/
|
|
855
982
|
getDescription() {
|
|
856
|
-
if (_optionalChain([this, 'access',
|
|
983
|
+
if (_optionalChain([this, 'access', _62 => _62.schema, 'optionalAccess', _63 => _63.description]) && typeof this.schema.description === "string") {
|
|
857
984
|
return this.schema.description;
|
|
858
985
|
}
|
|
859
|
-
const pathItem = _optionalChain([this, 'access',
|
|
860
|
-
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") {
|
|
861
988
|
return pathItem.description;
|
|
862
989
|
}
|
|
863
990
|
return void 0;
|
|
864
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
|
+
}
|
|
865
1021
|
/**
|
|
866
1022
|
* Retrieve the primary content type for this operation. If multiple exist, the first JSON-like
|
|
867
1023
|
* type will be returned.
|
|
@@ -876,18 +1032,18 @@ var Operation = (_class = class {
|
|
|
876
1032
|
let types = [];
|
|
877
1033
|
if (this.schema.requestBody) {
|
|
878
1034
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.requestBody)) {
|
|
879
|
-
this.schema.requestBody =
|
|
1035
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, this.schema.requestBody, this.api);
|
|
880
1036
|
}
|
|
881
1037
|
if (this.schema.requestBody && "content" in this.schema.requestBody) {
|
|
882
1038
|
types = Object.keys(this.schema.requestBody.content);
|
|
883
1039
|
}
|
|
884
1040
|
}
|
|
885
1041
|
this.contentType = "application/json";
|
|
886
|
-
if (_optionalChain([types, 'optionalAccess',
|
|
1042
|
+
if (_optionalChain([types, 'optionalAccess', _76 => _76.length])) {
|
|
887
1043
|
this.contentType = types[0];
|
|
888
1044
|
}
|
|
889
1045
|
types.forEach((t) => {
|
|
890
|
-
if (
|
|
1046
|
+
if (_chunkUKD63LKGcjs.matches_mimetype_default.json(t)) {
|
|
891
1047
|
this.contentType = t;
|
|
892
1048
|
}
|
|
893
1049
|
});
|
|
@@ -900,7 +1056,7 @@ var Operation = (_class = class {
|
|
|
900
1056
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
901
1057
|
*/
|
|
902
1058
|
isFormUrlEncoded() {
|
|
903
|
-
return
|
|
1059
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
904
1060
|
}
|
|
905
1061
|
/**
|
|
906
1062
|
* Checks if the current operation has a mutipart content type payload.
|
|
@@ -909,7 +1065,7 @@ var Operation = (_class = class {
|
|
|
909
1065
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
910
1066
|
*/
|
|
911
1067
|
isMultipart() {
|
|
912
|
-
return
|
|
1068
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.multipart(this.getContentType());
|
|
913
1069
|
}
|
|
914
1070
|
/**
|
|
915
1071
|
* Checks if the current operation has a JSON-like content type payload.
|
|
@@ -918,7 +1074,7 @@ var Operation = (_class = class {
|
|
|
918
1074
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
919
1075
|
*/
|
|
920
1076
|
isJson() {
|
|
921
|
-
return
|
|
1077
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.json(this.getContentType());
|
|
922
1078
|
}
|
|
923
1079
|
/**
|
|
924
1080
|
* Checks if the current operation has an XML content type payload.
|
|
@@ -927,7 +1083,7 @@ var Operation = (_class = class {
|
|
|
927
1083
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
928
1084
|
*/
|
|
929
1085
|
isXml() {
|
|
930
|
-
return
|
|
1086
|
+
return _chunkUKD63LKGcjs.matches_mimetype_default.xml(this.getContentType());
|
|
931
1087
|
}
|
|
932
1088
|
/**
|
|
933
1089
|
* Checks if the current operation is a webhook or not.
|
|
@@ -946,7 +1102,7 @@ var Operation = (_class = class {
|
|
|
946
1102
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#security-requirement-object}
|
|
947
1103
|
*/
|
|
948
1104
|
getSecurity() {
|
|
949
|
-
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) {
|
|
950
1106
|
return [];
|
|
951
1107
|
}
|
|
952
1108
|
return this.schema.security || this.api.security || [];
|
|
@@ -966,19 +1122,19 @@ var Operation = (_class = class {
|
|
|
966
1122
|
let keys;
|
|
967
1123
|
try {
|
|
968
1124
|
keys = Object.keys(requirement);
|
|
969
|
-
} catch (
|
|
1125
|
+
} catch (e5) {
|
|
970
1126
|
return false;
|
|
971
1127
|
}
|
|
972
1128
|
const keysWithTypes = keys.map((key) => {
|
|
973
1129
|
let security;
|
|
974
1130
|
try {
|
|
975
|
-
security = _optionalChain([this, 'access',
|
|
1131
|
+
security = _optionalChain([this, 'access', _80 => _80.api, 'optionalAccess', _81 => _81.components, 'optionalAccess', _82 => _82.securitySchemes, 'optionalAccess', _83 => _83[key]]);
|
|
976
1132
|
if (!security) return false;
|
|
977
1133
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, security)) {
|
|
978
|
-
security =
|
|
1134
|
+
security = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, security, this.api);
|
|
979
1135
|
if (!security || _chunk7PWF3F2Wcjs.isRef.call(void 0, security)) return false;
|
|
980
1136
|
}
|
|
981
|
-
} catch (
|
|
1137
|
+
} catch (e6) {
|
|
982
1138
|
return false;
|
|
983
1139
|
}
|
|
984
1140
|
if (!security || _chunk7PWF3F2Wcjs.isRef.call(void 0, security)) return false;
|
|
@@ -1024,7 +1180,7 @@ var Operation = (_class = class {
|
|
|
1024
1180
|
if (!prev[security.type]) prev[security.type] = [];
|
|
1025
1181
|
const exists = prev[security.type].some((sec) => sec._key === security.security._key);
|
|
1026
1182
|
if (!exists) {
|
|
1027
|
-
if (_optionalChain([security, 'access',
|
|
1183
|
+
if (_optionalChain([security, 'access', _84 => _84.security, 'optionalAccess', _85 => _85._requirements])) delete security.security._requirements;
|
|
1028
1184
|
prev[security.type].push(security.security);
|
|
1029
1185
|
}
|
|
1030
1186
|
});
|
|
@@ -1056,7 +1212,7 @@ var Operation = (_class = class {
|
|
|
1056
1212
|
this.schema.parameters.map((p) => {
|
|
1057
1213
|
let param = p;
|
|
1058
1214
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1059
|
-
param =
|
|
1215
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1060
1216
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1061
1217
|
}
|
|
1062
1218
|
if (param.in && param.in === "header") return param.name;
|
|
@@ -1069,20 +1225,20 @@ var Operation = (_class = class {
|
|
|
1069
1225
|
let response = this.schema.responses[r];
|
|
1070
1226
|
if (!response) return [];
|
|
1071
1227
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1072
|
-
this.schema.responses[r] =
|
|
1228
|
+
this.schema.responses[r] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1073
1229
|
response = this.schema.responses[r];
|
|
1074
1230
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1075
1231
|
return [];
|
|
1076
1232
|
}
|
|
1077
1233
|
}
|
|
1078
|
-
return _optionalChain([response, 'optionalAccess',
|
|
1234
|
+
return _optionalChain([response, 'optionalAccess', _86 => _86.headers]) ? Object.keys(response.headers) : [];
|
|
1079
1235
|
}).reduce((a, b) => a.concat(b), []);
|
|
1080
1236
|
}
|
|
1081
1237
|
if (!this.headers.request.includes("Content-Type") && this.schema.requestBody) {
|
|
1082
1238
|
let requestBody = this.schema.requestBody;
|
|
1083
1239
|
if (requestBody) {
|
|
1084
1240
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1085
|
-
this.schema.requestBody =
|
|
1241
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1086
1242
|
requestBody = this.schema.requestBody;
|
|
1087
1243
|
}
|
|
1088
1244
|
if (requestBody && !_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) && "content" in requestBody && Object.keys(requestBody.content)) {
|
|
@@ -1092,10 +1248,10 @@ var Operation = (_class = class {
|
|
|
1092
1248
|
}
|
|
1093
1249
|
if (this.schema.responses) {
|
|
1094
1250
|
const hasResponseContent = Object.keys(this.schema.responses).some((r) => {
|
|
1095
|
-
let response = _optionalChain([this, 'access',
|
|
1251
|
+
let response = _optionalChain([this, 'access', _87 => _87.schema, 'access', _88 => _88.responses, 'optionalAccess', _89 => _89[r]]);
|
|
1096
1252
|
if (!response) return false;
|
|
1097
1253
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1098
|
-
this.schema.responses[r] =
|
|
1254
|
+
this.schema.responses[r] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1099
1255
|
response = this.schema.responses[r];
|
|
1100
1256
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1101
1257
|
return false;
|
|
@@ -1159,7 +1315,7 @@ var Operation = (_class = class {
|
|
|
1159
1315
|
return [];
|
|
1160
1316
|
}
|
|
1161
1317
|
const oasTagMap = /* @__PURE__ */ new Map();
|
|
1162
|
-
if (Array.isArray(_optionalChain([this, 'access',
|
|
1318
|
+
if (Array.isArray(_optionalChain([this, 'access', _90 => _90.api, 'optionalAccess', _91 => _91.tags]))) {
|
|
1163
1319
|
this.api.tags.forEach((tag) => {
|
|
1164
1320
|
oasTagMap.set(tag.name, tag);
|
|
1165
1321
|
});
|
|
@@ -1202,18 +1358,18 @@ var Operation = (_class = class {
|
|
|
1202
1358
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
1203
1359
|
*/
|
|
1204
1360
|
getParameters() {
|
|
1205
|
-
let parameters = (_optionalChain([this, 'access',
|
|
1361
|
+
let parameters = (_optionalChain([this, 'access', _92 => _92.schema, 'optionalAccess', _93 => _93.parameters]) || []).map((p) => {
|
|
1206
1362
|
let param = p;
|
|
1207
1363
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1208
|
-
param =
|
|
1364
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1209
1365
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1210
1366
|
}
|
|
1211
1367
|
return param;
|
|
1212
1368
|
}).filter((param) => param !== void 0);
|
|
1213
|
-
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) => {
|
|
1214
1370
|
let param = p;
|
|
1215
1371
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1216
|
-
param =
|
|
1372
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1217
1373
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1218
1374
|
}
|
|
1219
1375
|
return param;
|
|
@@ -1245,16 +1401,8 @@ var Operation = (_class = class {
|
|
|
1245
1401
|
*
|
|
1246
1402
|
*/
|
|
1247
1403
|
getParametersAsJSONSchema(opts = {}) {
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
"`.getParametersAsJSONSchema()` is not compatible with an operation or OpenAPI definition that has been run through `.dereference().`"
|
|
1251
|
-
);
|
|
1252
|
-
}
|
|
1253
|
-
if (!this.schemasDecorated) {
|
|
1254
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1255
|
-
this.schemasDecorated = true;
|
|
1256
|
-
}
|
|
1257
|
-
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, {
|
|
1258
1406
|
includeDiscriminatorMappingRefs: true,
|
|
1259
1407
|
...opts
|
|
1260
1408
|
});
|
|
@@ -1273,15 +1421,7 @@ var Operation = (_class = class {
|
|
|
1273
1421
|
* this content-type, the function will return null.
|
|
1274
1422
|
*/
|
|
1275
1423
|
getResponseAsJSONSchema(statusCode, opts = {}) {
|
|
1276
|
-
|
|
1277
|
-
throw new Error(
|
|
1278
|
-
"`.getResponseAsJSONSchema()` is not compatible with an operation or OpenAPI definition that has been run through `.dereference().`"
|
|
1279
|
-
);
|
|
1280
|
-
}
|
|
1281
|
-
if (!this.schemasDecorated) {
|
|
1282
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1283
|
-
this.schemasDecorated = true;
|
|
1284
|
-
}
|
|
1424
|
+
_chunkUKD63LKGcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1285
1425
|
return getResponseAsJSONSchema(this, this.api, statusCode, {
|
|
1286
1426
|
includeDiscriminatorMappingRefs: true,
|
|
1287
1427
|
...opts
|
|
@@ -1294,7 +1434,7 @@ var Operation = (_class = class {
|
|
|
1294
1434
|
getResponseStatusCodes() {
|
|
1295
1435
|
if (!this.schema.responses) return [];
|
|
1296
1436
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1297
|
-
this.schema.responses =
|
|
1437
|
+
this.schema.responses = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, this.schema.responses, this.api);
|
|
1298
1438
|
if (!this.schema.responses || _chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1299
1439
|
return [];
|
|
1300
1440
|
}
|
|
@@ -1303,7 +1443,7 @@ var Operation = (_class = class {
|
|
|
1303
1443
|
if (key.startsWith("x-")) {
|
|
1304
1444
|
return false;
|
|
1305
1445
|
}
|
|
1306
|
-
const response = _optionalChain([this, 'access',
|
|
1446
|
+
const response = _optionalChain([this, 'access', _98 => _98.schema, 'access', _99 => _99.responses, 'optionalAccess', _100 => _100[key]]);
|
|
1307
1447
|
return response && typeof response === "object";
|
|
1308
1448
|
});
|
|
1309
1449
|
}
|
|
@@ -1320,7 +1460,7 @@ var Operation = (_class = class {
|
|
|
1320
1460
|
let resp = response;
|
|
1321
1461
|
if (!resp) return;
|
|
1322
1462
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1323
|
-
resp =
|
|
1463
|
+
resp = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, resp, this.api);
|
|
1324
1464
|
if (!resp || _chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1325
1465
|
return;
|
|
1326
1466
|
}
|
|
@@ -1349,7 +1489,7 @@ var Operation = (_class = class {
|
|
|
1349
1489
|
let requestBody = this.schema.requestBody;
|
|
1350
1490
|
if (!requestBody) return false;
|
|
1351
1491
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1352
|
-
this.schema.requestBody =
|
|
1492
|
+
this.schema.requestBody = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1353
1493
|
requestBody = this.schema.requestBody;
|
|
1354
1494
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1355
1495
|
return false;
|
|
@@ -1423,7 +1563,7 @@ var Operation = (_class = class {
|
|
|
1423
1563
|
let availableMediaType;
|
|
1424
1564
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1425
1565
|
mediaTypes.forEach((mt) => {
|
|
1426
|
-
if (!availableMediaType &&
|
|
1566
|
+
if (!availableMediaType && _chunkUKD63LKGcjs.matches_mimetype_default.json(mt)) {
|
|
1427
1567
|
availableMediaType = mt;
|
|
1428
1568
|
}
|
|
1429
1569
|
});
|
|
@@ -1450,7 +1590,7 @@ var Operation = (_class = class {
|
|
|
1450
1590
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#request-body-examples}
|
|
1451
1591
|
*/
|
|
1452
1592
|
getRequestBodyExamples() {
|
|
1453
|
-
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";
|
|
1454
1594
|
if (this.requestBodyExamples && isRequestExampleValueDefined) {
|
|
1455
1595
|
return this.requestBodyExamples;
|
|
1456
1596
|
}
|
|
@@ -1471,7 +1611,7 @@ var Operation = (_class = class {
|
|
|
1471
1611
|
let response = this.schema.responses[statusCode];
|
|
1472
1612
|
if (!response) return false;
|
|
1473
1613
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1474
|
-
this.schema.responses[statusCode] =
|
|
1614
|
+
this.schema.responses[statusCode] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, response, this.api);
|
|
1475
1615
|
response = this.schema.responses[statusCode];
|
|
1476
1616
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1477
1617
|
return false;
|
|
@@ -1515,7 +1655,7 @@ var Operation = (_class = class {
|
|
|
1515
1655
|
let callbackObj = this.schema.callbacks[identifier];
|
|
1516
1656
|
if (!callbackObj) return false;
|
|
1517
1657
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1518
|
-
this.schema.callbacks[identifier] =
|
|
1658
|
+
this.schema.callbacks[identifier] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackObj, this.api);
|
|
1519
1659
|
callbackObj = this.schema.callbacks[identifier];
|
|
1520
1660
|
if (!callbackObj || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1521
1661
|
return false;
|
|
@@ -1524,7 +1664,7 @@ var Operation = (_class = class {
|
|
|
1524
1664
|
let callback = callbackObj[expression];
|
|
1525
1665
|
if (!callback) return false;
|
|
1526
1666
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1527
|
-
callbackObj[expression] =
|
|
1667
|
+
callbackObj[expression] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callback, this.api);
|
|
1528
1668
|
callback = callbackObj[expression];
|
|
1529
1669
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1530
1670
|
return false;
|
|
@@ -1545,10 +1685,10 @@ var Operation = (_class = class {
|
|
|
1545
1685
|
if (!this.hasCallbacks()) return [];
|
|
1546
1686
|
const callbacks = [];
|
|
1547
1687
|
Object.keys(this.schema.callbacks).forEach((callback) => {
|
|
1548
|
-
let cb = _optionalChain([this, 'access',
|
|
1688
|
+
let cb = _optionalChain([this, 'access', _106 => _106.schema, 'access', _107 => _107.callbacks, 'optionalAccess', _108 => _108[callback]]);
|
|
1549
1689
|
if (!cb) return;
|
|
1550
1690
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1551
|
-
this.schema.callbacks[callback] =
|
|
1691
|
+
this.schema.callbacks[callback] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, cb, this.api);
|
|
1552
1692
|
cb = this.schema.callbacks[callback];
|
|
1553
1693
|
if (!cb || _chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1554
1694
|
return;
|
|
@@ -1558,14 +1698,14 @@ var Operation = (_class = class {
|
|
|
1558
1698
|
let callbackPath = cb[expression];
|
|
1559
1699
|
if (!callbackPath) return;
|
|
1560
1700
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1561
|
-
cb[expression] =
|
|
1701
|
+
cb[expression] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, callbackPath, this.api);
|
|
1562
1702
|
callbackPath = cb[expression];
|
|
1563
1703
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1564
1704
|
return;
|
|
1565
1705
|
}
|
|
1566
1706
|
}
|
|
1567
1707
|
Object.keys(callbackPath).forEach((method) => {
|
|
1568
|
-
if (!
|
|
1708
|
+
if (!_chunkUKD63LKGcjs.supportedMethods.includes(method)) return;
|
|
1569
1709
|
const found = this.getCallback(callback, expression, method);
|
|
1570
1710
|
if (found) {
|
|
1571
1711
|
callbacks.push(found);
|
|
@@ -1608,7 +1748,7 @@ var Operation = (_class = class {
|
|
|
1608
1748
|
* @deprecated Use `oas.getExtension(extension, operation)` instead.
|
|
1609
1749
|
*/
|
|
1610
1750
|
getExtension(extension) {
|
|
1611
|
-
return _optionalChain([this, 'access',
|
|
1751
|
+
return _optionalChain([this, 'access', _109 => _109.schema, 'optionalAccess', _110 => _110[extension]]);
|
|
1612
1752
|
}
|
|
1613
1753
|
/**
|
|
1614
1754
|
* Returns an object with groups of all example definitions (body/header/query/path/response/etc.).
|
|
@@ -1627,108 +1767,7 @@ var Operation = (_class = class {
|
|
|
1627
1767
|
this.exampleGroups = groups;
|
|
1628
1768
|
return groups;
|
|
1629
1769
|
}
|
|
1630
|
-
|
|
1631
|
-
* Dereference the current operation schema so it can be parsed free of worries of `$ref` schemas
|
|
1632
|
-
* and circular structures.
|
|
1633
|
-
*
|
|
1634
|
-
*/
|
|
1635
|
-
async dereference(opts) {
|
|
1636
|
-
if (this.dereferencing.complete) {
|
|
1637
|
-
return Promise.resolve(true);
|
|
1638
|
-
}
|
|
1639
|
-
if (this.dereferencing.processing) {
|
|
1640
|
-
return new Promise((resolve, reject) => {
|
|
1641
|
-
this.promises.push({ resolve, reject });
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
this.dereferencing.processing = true;
|
|
1645
|
-
if (!this.schemasDecorated) {
|
|
1646
|
-
_chunkSCWW2SNXcjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1647
|
-
this.schemasDecorated = true;
|
|
1648
|
-
}
|
|
1649
|
-
const { api, schema, promises } = this;
|
|
1650
|
-
const circularRefs = /* @__PURE__ */ new Set();
|
|
1651
|
-
const dereferencingOptions = _chunkSCWW2SNXcjs.getDereferencingOptions.call(void 0, circularRefs);
|
|
1652
|
-
const parser = new (0, _jsonschemarefparser.$RefParser)();
|
|
1653
|
-
return parser.dereference(
|
|
1654
|
-
"#/__INTERNAL__",
|
|
1655
|
-
{
|
|
1656
|
-
// Because `json-schema-ref-parser` will dereference this entire object as we only want
|
|
1657
|
-
// to dereference this operation schema we're attaching it to the `__INTERNAL__` key, and
|
|
1658
|
-
// later using that to extract our dereferenced schema. If we didn't do this then we run
|
|
1659
|
-
// the risk of any keyword in `schema` being overriden by `paths` and `components`.
|
|
1660
|
-
//
|
|
1661
|
-
// This solution isn't the best and still requires us to send `json-schema-ref-parser`
|
|
1662
|
-
// basically the entire API defintiion but because we don't know what `$ref` pointers in
|
|
1663
|
-
// `schema` reference, we can't know which parts of full API definition we could safely
|
|
1664
|
-
// exclude from this process.
|
|
1665
|
-
__INTERNAL__: structuredClone(schema),
|
|
1666
|
-
paths: _nullishCoalesce(api.paths, () => ( void 0)),
|
|
1667
|
-
components: _nullishCoalesce(api.components, () => ( void 0))
|
|
1668
|
-
},
|
|
1669
|
-
{
|
|
1670
|
-
...dereferencingOptions,
|
|
1671
|
-
dereference: {
|
|
1672
|
-
...dereferencingOptions.dereference,
|
|
1673
|
-
/**
|
|
1674
|
-
* Because we only want to dereference our `__INTERNAL__` schema, not the **entire**
|
|
1675
|
-
* API definition if the parser attemps to dereference anything but that then we
|
|
1676
|
-
* should bail out of that crawler.
|
|
1677
|
-
*
|
|
1678
|
-
* @fixme this may cause issues where a path references a schema within itself to be ignored.
|
|
1679
|
-
*/
|
|
1680
|
-
excludedPathMatcher: (path) => {
|
|
1681
|
-
if (path === "#/paths" || path.startsWith("#/paths/")) {
|
|
1682
|
-
return true;
|
|
1683
|
-
}
|
|
1684
|
-
return path === "#/components" || path.startsWith("#/components/");
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
).then((res) => {
|
|
1689
|
-
const dereferenced = res;
|
|
1690
|
-
this.schema = dereferenced.__INTERNAL__;
|
|
1691
|
-
this.promises = promises;
|
|
1692
|
-
this.dereferencing = {
|
|
1693
|
-
processing: false,
|
|
1694
|
-
complete: true,
|
|
1695
|
-
// We need to convert our `Set` to an array in order to match the typings.
|
|
1696
|
-
circularRefs: [...circularRefs]
|
|
1697
|
-
};
|
|
1698
|
-
if (_optionalChain([opts, 'optionalAccess', _95 => _95.cb])) {
|
|
1699
|
-
opts.cb();
|
|
1700
|
-
}
|
|
1701
|
-
}).then(() => {
|
|
1702
|
-
return this.promises.map((deferred) => deferred.resolve());
|
|
1703
|
-
}).catch((err) => {
|
|
1704
|
-
this.dereferencing.processing = false;
|
|
1705
|
-
this.promises.map((deferred) => deferred.reject(err));
|
|
1706
|
-
throw err;
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
/**
|
|
1710
|
-
* Determine if the current operation schema, or the OpenAPI definition it's part of, has been
|
|
1711
|
-
* dereferenced or not with `.dereference()`.
|
|
1712
|
-
*
|
|
1713
|
-
* @see Operation.dereference
|
|
1714
|
-
*/
|
|
1715
|
-
isDereferenced() {
|
|
1716
|
-
return this.oas.isDereferenced() || this.dereferencing.processing || this.dereferencing.complete;
|
|
1717
|
-
}
|
|
1718
|
-
/**
|
|
1719
|
-
* Retrieve any circular `$ref` pointers that maybe present within operation schema.
|
|
1720
|
-
*
|
|
1721
|
-
* This method requires that you first dereference the definition.
|
|
1722
|
-
*
|
|
1723
|
-
* @see Operation.dereference
|
|
1724
|
-
*/
|
|
1725
|
-
getCircularReferences() {
|
|
1726
|
-
if (!this.dereferencing.complete) {
|
|
1727
|
-
throw new Error(".dereference() must be called first in order for this method to obtain circular references.");
|
|
1728
|
-
}
|
|
1729
|
-
return this.dereferencing.circularRefs;
|
|
1730
|
-
}
|
|
1731
|
-
}, _class);
|
|
1770
|
+
};
|
|
1732
1771
|
var Callback = class extends Operation {
|
|
1733
1772
|
/**
|
|
1734
1773
|
* The identifier that this callback is set to.
|
|
@@ -1759,7 +1798,7 @@ var Callback = class extends Operation {
|
|
|
1759
1798
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
1760
1799
|
*/
|
|
1761
1800
|
getSummary() {
|
|
1762
|
-
if (_optionalChain([this, 'access',
|
|
1801
|
+
if (_optionalChain([this, 'access', _111 => _111.schema, 'optionalAccess', _112 => _112.summary]) && typeof this.schema.summary === "string") {
|
|
1763
1802
|
return this.schema.summary;
|
|
1764
1803
|
} else if (this.parentSchema.summary && typeof this.parentSchema.summary === "string") {
|
|
1765
1804
|
return this.parentSchema.summary;
|
|
@@ -1773,7 +1812,7 @@ var Callback = class extends Operation {
|
|
|
1773
1812
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
1774
1813
|
*/
|
|
1775
1814
|
getDescription() {
|
|
1776
|
-
if (_optionalChain([this, 'access',
|
|
1815
|
+
if (_optionalChain([this, 'access', _113 => _113.schema, 'optionalAccess', _114 => _114.description]) && typeof this.schema.description === "string") {
|
|
1777
1816
|
return this.schema.description;
|
|
1778
1817
|
} else if (this.parentSchema.description && typeof this.parentSchema.description === "string") {
|
|
1779
1818
|
return this.parentSchema.description;
|
|
@@ -1787,10 +1826,10 @@ var Callback = class extends Operation {
|
|
|
1787
1826
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-parameters}
|
|
1788
1827
|
*/
|
|
1789
1828
|
getParameters() {
|
|
1790
|
-
let parameters = (_optionalChain([this, 'access',
|
|
1829
|
+
let parameters = (_optionalChain([this, 'access', _115 => _115.schema, 'optionalAccess', _116 => _116.parameters]) || []).map((p) => {
|
|
1791
1830
|
let param = p;
|
|
1792
1831
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1793
|
-
param =
|
|
1832
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1794
1833
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1795
1834
|
}
|
|
1796
1835
|
return param;
|
|
@@ -1798,7 +1837,7 @@ var Callback = class extends Operation {
|
|
|
1798
1837
|
const commonParams = (this.parentSchema.parameters || []).map((p) => {
|
|
1799
1838
|
let param = p;
|
|
1800
1839
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1801
|
-
param =
|
|
1840
|
+
param = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, param, this.api);
|
|
1802
1841
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1803
1842
|
}
|
|
1804
1843
|
return param;
|
|
@@ -1817,17 +1856,17 @@ var Webhook = class extends Operation {
|
|
|
1817
1856
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-summary}
|
|
1818
1857
|
*/
|
|
1819
1858
|
getSummary() {
|
|
1820
|
-
if (_optionalChain([this, 'access',
|
|
1859
|
+
if (_optionalChain([this, 'access', _117 => _117.schema, 'optionalAccess', _118 => _118.summary]) && typeof this.schema.summary === "string") {
|
|
1821
1860
|
return this.schema.summary;
|
|
1822
1861
|
} else if (!this.api.webhooks) {
|
|
1823
1862
|
return void 0;
|
|
1824
1863
|
}
|
|
1825
1864
|
let webhookPath = this.api.webhooks[this.path];
|
|
1826
1865
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1827
|
-
this.api.webhooks[this.path] =
|
|
1866
|
+
this.api.webhooks[this.path] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1828
1867
|
webhookPath = this.api.webhooks[this.path];
|
|
1829
1868
|
}
|
|
1830
|
-
return _optionalChain([webhookPath, 'optionalAccess',
|
|
1869
|
+
return _optionalChain([webhookPath, 'optionalAccess', _119 => _119.summary]);
|
|
1831
1870
|
}
|
|
1832
1871
|
/**
|
|
1833
1872
|
* Retrieve the `description` for this operation.
|
|
@@ -1836,17 +1875,17 @@ var Webhook = class extends Operation {
|
|
|
1836
1875
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-operation-description}
|
|
1837
1876
|
*/
|
|
1838
1877
|
getDescription() {
|
|
1839
|
-
if (_optionalChain([this, 'access',
|
|
1878
|
+
if (_optionalChain([this, 'access', _120 => _120.schema, 'optionalAccess', _121 => _121.description]) && typeof this.schema.description === "string") {
|
|
1840
1879
|
return this.schema.description;
|
|
1841
1880
|
} else if (!this.api.webhooks) {
|
|
1842
1881
|
return void 0;
|
|
1843
1882
|
}
|
|
1844
1883
|
let webhookPath = this.api.webhooks[this.path];
|
|
1845
1884
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1846
|
-
this.api.webhooks[this.path] =
|
|
1885
|
+
this.api.webhooks[this.path] = _chunkUKD63LKGcjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1847
1886
|
webhookPath = this.api.webhooks[this.path];
|
|
1848
1887
|
}
|
|
1849
|
-
return _optionalChain([webhookPath, 'optionalAccess',
|
|
1888
|
+
return _optionalChain([webhookPath, 'optionalAccess', _122 => _122.description]);
|
|
1850
1889
|
}
|
|
1851
1890
|
};
|
|
1852
1891
|
|
|
@@ -1854,7 +1893,17 @@ var Webhook = class extends Operation {
|
|
|
1854
1893
|
|
|
1855
1894
|
|
|
1856
1895
|
|
|
1857
|
-
|
|
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;
|
|
1858
1907
|
/**
|
|
1859
1908
|
* Portions of this file have been extracted and modified from Swagger UI.
|
|
1860
1909
|
*
|
|
@@ -1867,4 +1916,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1867
1916
|
* @license Apache-2.0
|
|
1868
1917
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1869
1918
|
*/
|
|
1870
|
-
//# sourceMappingURL=chunk-
|
|
1919
|
+
//# sourceMappingURL=chunk-GS43VKJH.cjs.map
|