oas 27.2.1 → 28.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/dist/analyzer/index.cjs +10 -10
- package/dist/analyzer/index.cjs.map +1 -1
- package/dist/analyzer/index.d.cts +1 -1
- package/dist/analyzer/index.d.ts +1 -1
- package/dist/analyzer/index.js +8 -8
- package/dist/analyzer/index.js.map +1 -1
- package/dist/{chunk-5XZQA26T.js → chunk-45FGY5MW.js} +76 -52
- package/dist/chunk-45FGY5MW.js.map +1 -0
- package/dist/{chunk-BLQKFBR2.cjs → chunk-64CLCOBW.cjs} +23 -22
- package/dist/chunk-64CLCOBW.cjs.map +1 -0
- package/dist/{chunk-W2TD4LSC.js → chunk-BBB7GA2U.js} +8 -9
- package/dist/chunk-BBB7GA2U.js.map +1 -0
- package/dist/{chunk-VSXG73AZ.cjs → chunk-EQEXNJJE.cjs} +1 -1
- package/dist/chunk-EQEXNJJE.cjs.map +1 -0
- package/dist/{chunk-3TRWJPXH.js → chunk-F42EZPPE.js} +11 -10
- package/dist/chunk-F42EZPPE.js.map +1 -0
- package/dist/{chunk-URXLIMMM.cjs → chunk-MW5BWU34.cjs} +124 -100
- package/dist/chunk-MW5BWU34.cjs.map +1 -0
- package/dist/{chunk-OJBEY3IB.cjs → chunk-N4TGMVNA.cjs} +11 -11
- package/dist/chunk-N4TGMVNA.cjs.map +1 -0
- package/dist/{chunk-V24D22KO.js → chunk-TM3VSYIS.js} +2 -2
- package/dist/chunk-TM3VSYIS.js.map +1 -0
- package/dist/{chunk-DPTPURCR.js → chunk-UCEHCARG.js} +1 -1
- package/dist/chunk-UCEHCARG.js.map +1 -0
- package/dist/{chunk-TDI4MZLI.cjs → chunk-UW57LXCE.cjs} +8 -9
- package/dist/chunk-UW57LXCE.cjs.map +1 -0
- package/dist/{extensions-Bv1ipECR.d.ts → extensions-D51otYaI.d.ts} +40 -26
- package/dist/{extensions-DCqurkah.d.cts → extensions-ViDsWf_9.d.cts} +40 -26
- package/dist/extensions.d.cts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/operation/index.cjs +5 -5
- package/dist/operation/index.d.cts +1 -1
- package/dist/operation/index.d.ts +1 -1
- package/dist/operation/index.js +4 -4
- package/dist/operation/lib/get-parameters-as-json-schema.cjs +3 -3
- package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.js +2 -2
- package/dist/reducer/index.cjs +3 -1
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.js +3 -1
- package/dist/reducer/index.js.map +1 -1
- package/dist/types.cjs +2 -2
- package/dist/types.js +1 -1
- package/dist/utils.cjs +4 -4
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +7 -7
- package/dist/chunk-3TRWJPXH.js.map +0 -1
- package/dist/chunk-5XZQA26T.js.map +0 -1
- package/dist/chunk-BLQKFBR2.cjs.map +0 -1
- package/dist/chunk-DPTPURCR.js.map +0 -1
- package/dist/chunk-OJBEY3IB.cjs.map +0 -1
- package/dist/chunk-TDI4MZLI.cjs.map +0 -1
- package/dist/chunk-URXLIMMM.cjs.map +0 -1
- package/dist/chunk-V24D22KO.js.map +0 -1
- package/dist/chunk-VSXG73AZ.cjs.map +0 -1
- package/dist/chunk-W2TD4LSC.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
|
-
var
|
|
4
|
+
var _chunkUW57LXCEcjs = require('./chunk-UW57LXCE.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -10,13 +10,13 @@ var _chunkTDI4MZLIcjs = require('./chunk-TDI4MZLI.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkN4TGMVNAcjs = require('./chunk-N4TGMVNA.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _chunkXS7VDTTTcjs = require('./chunk-XS7VDTTT.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkEQEXNJJEcjs = require('./chunk-EQEXNJJE.cjs');
|
|
20
20
|
|
|
21
21
|
// src/operation/lib/dedupe-common-parameters.ts
|
|
22
22
|
function dedupeCommonParameters(parameters, commonParameters) {
|
|
@@ -24,7 +24,7 @@ function dedupeCommonParameters(parameters, commonParameters) {
|
|
|
24
24
|
return !parameters.find((param2) => {
|
|
25
25
|
if (param.name && param2.name) {
|
|
26
26
|
return param.name === param2.name && param.in === param2.in;
|
|
27
|
-
} else if (
|
|
27
|
+
} else if (_chunkEQEXNJJEcjs.isRef.call(void 0, param) && _chunkEQEXNJJEcjs.isRef.call(void 0, param2)) {
|
|
28
28
|
return param.$ref === param2.$ref;
|
|
29
29
|
}
|
|
30
30
|
return false;
|
|
@@ -48,7 +48,7 @@ function usesPolymorphism(schema) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
function objectify(thing) {
|
|
51
|
-
if (!
|
|
51
|
+
if (!_chunkN4TGMVNAcjs.isObject.call(void 0, thing)) {
|
|
52
52
|
return {};
|
|
53
53
|
}
|
|
54
54
|
return thing;
|
|
@@ -97,9 +97,9 @@ var primitives = {
|
|
|
97
97
|
boolean: sampleDefaults(true)
|
|
98
98
|
};
|
|
99
99
|
var primitive = (schema) => {
|
|
100
|
-
|
|
101
|
-
const { format } =
|
|
102
|
-
let { type } =
|
|
100
|
+
const objectifiedSchema = objectify(schema);
|
|
101
|
+
const { format } = objectifiedSchema;
|
|
102
|
+
let { type } = objectifiedSchema;
|
|
103
103
|
if (type === "null") {
|
|
104
104
|
return null;
|
|
105
105
|
} else if (Array.isArray(type)) {
|
|
@@ -114,9 +114,9 @@ var primitive = (schema) => {
|
|
|
114
114
|
}
|
|
115
115
|
const fn = primitives[`${type}_${format}`] || primitives[type];
|
|
116
116
|
if (isFunc(fn)) {
|
|
117
|
-
return fn(
|
|
117
|
+
return fn(objectifiedSchema);
|
|
118
118
|
}
|
|
119
|
-
return `Unknown Type: ${
|
|
119
|
+
return `Unknown Type: ${objectifiedSchema.type}`;
|
|
120
120
|
};
|
|
121
121
|
function sampleFromSchema(schema, opts = {}) {
|
|
122
122
|
const objectifySchema = objectify(schema);
|
|
@@ -168,16 +168,16 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
168
168
|
const props = objectify(properties);
|
|
169
169
|
const obj = {};
|
|
170
170
|
for (const name in props) {
|
|
171
|
-
if (props[name]
|
|
171
|
+
if (_optionalChain([props, 'optionalAccess', _2 => _2[name], 'access', _3 => _3.deprecated])) {
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
|
-
if (props[name]
|
|
174
|
+
if (_optionalChain([props, 'optionalAccess', _4 => _4[name], 'access', _5 => _5.readOnly]) && !includeReadOnly) {
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
|
-
if (props[name]
|
|
177
|
+
if (_optionalChain([props, 'optionalAccess', _6 => _6[name], 'access', _7 => _7.writeOnly]) && !includeWriteOnly) {
|
|
178
178
|
continue;
|
|
179
179
|
}
|
|
180
|
-
if (_optionalChain([props, 'access',
|
|
180
|
+
if (_optionalChain([props, 'access', _8 => _8[name], 'access', _9 => _9.examples, 'optionalAccess', _10 => _10.length])) {
|
|
181
181
|
obj[name] = props[name].examples[0];
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
@@ -257,10 +257,9 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, opts = {}) {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
if (mediaTypeObject.schema) {
|
|
260
|
-
if (!
|
|
260
|
+
if (!_chunkN4TGMVNAcjs.matches_mimetype_default.xml(mediaType)) {
|
|
261
261
|
return [
|
|
262
262
|
{
|
|
263
|
-
// eslint-disable-next-line try-catch-failsafe/json-parse
|
|
264
263
|
value: samples_default(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts)
|
|
265
264
|
}
|
|
266
265
|
];
|
|
@@ -274,7 +273,7 @@ function getResponseExamples(operation) {
|
|
|
274
273
|
return Object.keys(operation.responses || {}).map((status) => {
|
|
275
274
|
const response = operation.responses[status];
|
|
276
275
|
let onlyHeaders = false;
|
|
277
|
-
if (
|
|
276
|
+
if (_chunkEQEXNJJEcjs.isRef.call(void 0, response)) {
|
|
278
277
|
return false;
|
|
279
278
|
}
|
|
280
279
|
const mediaTypes = {};
|
|
@@ -356,21 +355,21 @@ function getExampleGroups(operation) {
|
|
|
356
355
|
const namelessCodeSampleCounts = {};
|
|
357
356
|
const groups = {};
|
|
358
357
|
const codeSamples = _chunkXS7VDTTTcjs.getExtension.call(void 0, "code-samples", operation.api, operation);
|
|
359
|
-
_optionalChain([codeSamples, 'optionalAccess',
|
|
358
|
+
_optionalChain([codeSamples, 'optionalAccess', _11 => _11.forEach, 'call', _12 => _12((sample, i) => {
|
|
360
359
|
if (namelessCodeSampleCounts[sample.language]) {
|
|
361
360
|
namelessCodeSampleCounts[sample.language] += 1;
|
|
362
361
|
} else {
|
|
363
362
|
namelessCodeSampleCounts[sample.language] = 1;
|
|
364
363
|
}
|
|
365
364
|
const name = getDefaultName(sample, namelessCodeSampleCounts);
|
|
366
|
-
if (_optionalChain([groups, 'access',
|
|
365
|
+
if (_optionalChain([groups, 'access', _13 => _13[sample.correspondingExample], 'optionalAccess', _14 => _14.customCodeSamples, 'optionalAccess', _15 => _15.length])) {
|
|
367
366
|
groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
368
367
|
} else if (sample.correspondingExample) {
|
|
369
368
|
groups[sample.correspondingExample] = {
|
|
370
369
|
name,
|
|
371
370
|
customCodeSamples: [{ ...sample, name, originalIndex: i }]
|
|
372
371
|
};
|
|
373
|
-
} else if (_optionalChain([groups, 'access',
|
|
372
|
+
} else if (_optionalChain([groups, 'access', _16 => _16[noCorrespondingResponseKey], 'optionalAccess', _17 => _17.customCodeSamples, 'optionalAccess', _18 => _18.length])) {
|
|
374
373
|
groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });
|
|
375
374
|
} else {
|
|
376
375
|
groups[noCorrespondingResponseKey] = {
|
|
@@ -387,11 +386,11 @@ function getExampleGroups(operation) {
|
|
|
387
386
|
Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]) => {
|
|
388
387
|
groups[exampleKey] = {
|
|
389
388
|
...groups[exampleKey],
|
|
390
|
-
name: _optionalChain([groups, 'access',
|
|
389
|
+
name: _optionalChain([groups, 'access', _19 => _19[exampleKey], 'optionalAccess', _20 => _20.name]) || paramExample.summary,
|
|
391
390
|
request: {
|
|
392
|
-
..._optionalChain([groups, 'access',
|
|
391
|
+
..._optionalChain([groups, 'access', _21 => _21[exampleKey], 'optionalAccess', _22 => _22.request]),
|
|
393
392
|
[param.in]: {
|
|
394
|
-
..._optionalChain([groups, 'access',
|
|
393
|
+
..._optionalChain([groups, 'access', _23 => _23[exampleKey], 'optionalAccess', _24 => _24.request, 'optionalAccess', _25 => _25[param.in]]),
|
|
395
394
|
[param.name]: paramExample.value
|
|
396
395
|
}
|
|
397
396
|
}
|
|
@@ -404,9 +403,9 @@ function getExampleGroups(operation) {
|
|
|
404
403
|
const mediaType = requestExample.mediaType === "application/x-www-form-urlencoded" ? "formData" : "body";
|
|
405
404
|
groups[mediaTypeExample.title] = {
|
|
406
405
|
...groups[mediaTypeExample.title],
|
|
407
|
-
name: _optionalChain([groups, 'access',
|
|
406
|
+
name: _optionalChain([groups, 'access', _26 => _26[mediaTypeExample.title], 'optionalAccess', _27 => _27.name]) || mediaTypeExample.summary,
|
|
408
407
|
request: {
|
|
409
|
-
..._optionalChain([groups, 'access',
|
|
408
|
+
..._optionalChain([groups, 'access', _28 => _28[mediaTypeExample.title], 'optionalAccess', _29 => _29.request]),
|
|
410
409
|
[mediaType]: mediaTypeExample.value
|
|
411
410
|
}
|
|
412
411
|
};
|
|
@@ -447,7 +446,7 @@ function getRequestBodyExamples(operation) {
|
|
|
447
446
|
}
|
|
448
447
|
|
|
449
448
|
// src/operation/lib/get-response-as-json-schema.ts
|
|
450
|
-
var isJSON =
|
|
449
|
+
var isJSON = _chunkN4TGMVNAcjs.matches_mimetype_default.json;
|
|
451
450
|
function buildHeadersSchema(response, opts) {
|
|
452
451
|
const headers = response.headers;
|
|
453
452
|
const headersSchema = {
|
|
@@ -457,7 +456,7 @@ function buildHeadersSchema(response, opts) {
|
|
|
457
456
|
Object.keys(headers).forEach((key) => {
|
|
458
457
|
if (headers[key] && headers[key].schema) {
|
|
459
458
|
const header = headers[key];
|
|
460
|
-
headersSchema.properties[key] =
|
|
459
|
+
headersSchema.properties[key] = _chunkN4TGMVNAcjs.toJSONSchema.call(void 0, header.schema, {
|
|
461
460
|
addEnumsToDescriptions: true,
|
|
462
461
|
transformer: opts.transformer
|
|
463
462
|
});
|
|
@@ -501,7 +500,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
501
500
|
}
|
|
502
501
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
503
502
|
if (isJSON(contentTypes[i])) {
|
|
504
|
-
return
|
|
503
|
+
return _chunkN4TGMVNAcjs.toJSONSchema.call(void 0, _chunkN4TGMVNAcjs.cloneObject.call(void 0, content[contentTypes[i]].schema), {
|
|
505
504
|
addEnumsToDescriptions: true,
|
|
506
505
|
refLogger,
|
|
507
506
|
transformer: opts.transformer
|
|
@@ -509,7 +508,7 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
510
|
const contentType = contentTypes.shift();
|
|
512
|
-
return
|
|
511
|
+
return _chunkN4TGMVNAcjs.toJSONSchema.call(void 0, _chunkN4TGMVNAcjs.cloneObject.call(void 0, content[contentType].schema), {
|
|
513
512
|
addEnumsToDescriptions: true,
|
|
514
513
|
refLogger,
|
|
515
514
|
transformer: opts.transformer
|
|
@@ -517,15 +516,15 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
517
516
|
}
|
|
518
517
|
const foundSchema = getPreferredSchema(response.content);
|
|
519
518
|
if (foundSchema) {
|
|
520
|
-
const schema =
|
|
519
|
+
const schema = _chunkN4TGMVNAcjs.cloneObject.call(void 0, foundSchema);
|
|
521
520
|
const schemaWrapper = {
|
|
522
521
|
// If there's no `type` then the root schema is a circular `$ref` that we likely won't be
|
|
523
522
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
524
523
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
525
524
|
type: foundSchema.type || "string",
|
|
526
|
-
schema:
|
|
525
|
+
schema: _chunkN4TGMVNAcjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
527
526
|
...schema,
|
|
528
|
-
$schema:
|
|
527
|
+
$schema: _chunkN4TGMVNAcjs.getSchemaVersionString.call(void 0, schema, api)
|
|
529
528
|
},
|
|
530
529
|
label: "Response body"
|
|
531
530
|
};
|
|
@@ -545,6 +544,49 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
545
544
|
return jsonSchema.length ? jsonSchema : null;
|
|
546
545
|
}
|
|
547
546
|
|
|
547
|
+
// src/operation/lib/operationId.ts
|
|
548
|
+
function hasOperationId(operation) {
|
|
549
|
+
return Boolean("operationId" in operation && operation.operationId.length);
|
|
550
|
+
}
|
|
551
|
+
function getOperationId(path, method, operation, opts = {}) {
|
|
552
|
+
function sanitize(id) {
|
|
553
|
+
return id.replace(_optionalChain([opts, 'optionalAccess', _30 => _30.camelCase]) || _optionalChain([opts, 'optionalAccess', _31 => _31.friendlyCase]) ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, "-").replace(/--+/g, "-").replace(/^-|-$/g, "");
|
|
554
|
+
}
|
|
555
|
+
const operationIdExists = hasOperationId(operation);
|
|
556
|
+
let operationId;
|
|
557
|
+
if (operationIdExists) {
|
|
558
|
+
operationId = operation.operationId;
|
|
559
|
+
} else {
|
|
560
|
+
operationId = sanitize(path).toLowerCase();
|
|
561
|
+
}
|
|
562
|
+
const currMethod = method.toLowerCase();
|
|
563
|
+
if (_optionalChain([opts, 'optionalAccess', _32 => _32.camelCase]) || _optionalChain([opts, 'optionalAccess', _33 => _33.friendlyCase])) {
|
|
564
|
+
if (_optionalChain([opts, 'optionalAccess', _34 => _34.friendlyCase])) {
|
|
565
|
+
operationId = operationId.replaceAll("_", " ");
|
|
566
|
+
if (!operationIdExists) {
|
|
567
|
+
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`).split(" ").filter((word, i, arr) => word !== arr[i - 1]).join(" ");
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => chr.toUpperCase());
|
|
571
|
+
if (operationIdExists) {
|
|
572
|
+
operationId = sanitize(operationId);
|
|
573
|
+
}
|
|
574
|
+
operationId = operationId.replace(/^[0-9]/g, (match) => `_${match}`);
|
|
575
|
+
operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);
|
|
576
|
+
if (operationId.startsWith(currMethod)) {
|
|
577
|
+
return operationId;
|
|
578
|
+
}
|
|
579
|
+
if (operationIdExists) {
|
|
580
|
+
return operationId;
|
|
581
|
+
}
|
|
582
|
+
operationId = operationId.charAt(0).toUpperCase() + operationId.slice(1);
|
|
583
|
+
return `${currMethod}${operationId}`;
|
|
584
|
+
} else if (operationIdExists) {
|
|
585
|
+
return operationId;
|
|
586
|
+
}
|
|
587
|
+
return `${currMethod}_${operationId}`;
|
|
588
|
+
}
|
|
589
|
+
|
|
548
590
|
// src/operation/index.ts
|
|
549
591
|
var Operation = class {
|
|
550
592
|
/**
|
|
@@ -603,7 +645,7 @@ var Operation = class {
|
|
|
603
645
|
};
|
|
604
646
|
}
|
|
605
647
|
getSummary() {
|
|
606
|
-
if (_optionalChain([this, 'access',
|
|
648
|
+
if (_optionalChain([this, 'access', _35 => _35.schema, 'optionalAccess', _36 => _36.summary]) && typeof this.schema.summary === "string") {
|
|
607
649
|
return this.schema.summary;
|
|
608
650
|
} else if (this.api.paths[this.path].summary && typeof this.api.paths[this.path].summary === "string") {
|
|
609
651
|
return this.api.paths[this.path].summary;
|
|
@@ -611,7 +653,7 @@ var Operation = class {
|
|
|
611
653
|
return void 0;
|
|
612
654
|
}
|
|
613
655
|
getDescription() {
|
|
614
|
-
if (_optionalChain([this, 'access',
|
|
656
|
+
if (_optionalChain([this, 'access', _37 => _37.schema, 'optionalAccess', _38 => _38.description]) && typeof this.schema.description === "string") {
|
|
615
657
|
return this.schema.description;
|
|
616
658
|
} else if (this.api.paths[this.path].description && typeof this.api.paths[this.path].description === "string") {
|
|
617
659
|
return this.api.paths[this.path].description;
|
|
@@ -625,34 +667,34 @@ var Operation = class {
|
|
|
625
667
|
let types = [];
|
|
626
668
|
if (this.schema.requestBody) {
|
|
627
669
|
if ("$ref" in this.schema.requestBody) {
|
|
628
|
-
this.schema.requestBody =
|
|
670
|
+
this.schema.requestBody = _chunkUW57LXCEcjs.findSchemaDefinition.call(void 0, this.schema.requestBody.$ref, this.api);
|
|
629
671
|
}
|
|
630
672
|
if ("content" in this.schema.requestBody) {
|
|
631
673
|
types = Object.keys(this.schema.requestBody.content);
|
|
632
674
|
}
|
|
633
675
|
}
|
|
634
676
|
this.contentType = "application/json";
|
|
635
|
-
if (types
|
|
677
|
+
if (_optionalChain([types, 'optionalAccess', _39 => _39.length])) {
|
|
636
678
|
this.contentType = types[0];
|
|
637
679
|
}
|
|
638
680
|
types.forEach((t) => {
|
|
639
|
-
if (
|
|
681
|
+
if (_chunkN4TGMVNAcjs.matches_mimetype_default.json(t)) {
|
|
640
682
|
this.contentType = t;
|
|
641
683
|
}
|
|
642
684
|
});
|
|
643
685
|
return this.contentType;
|
|
644
686
|
}
|
|
645
687
|
isFormUrlEncoded() {
|
|
646
|
-
return
|
|
688
|
+
return _chunkN4TGMVNAcjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
647
689
|
}
|
|
648
690
|
isMultipart() {
|
|
649
|
-
return
|
|
691
|
+
return _chunkN4TGMVNAcjs.matches_mimetype_default.multipart(this.getContentType());
|
|
650
692
|
}
|
|
651
693
|
isJson() {
|
|
652
|
-
return
|
|
694
|
+
return _chunkN4TGMVNAcjs.matches_mimetype_default.json(this.getContentType());
|
|
653
695
|
}
|
|
654
696
|
isXml() {
|
|
655
|
-
return
|
|
697
|
+
return _chunkN4TGMVNAcjs.matches_mimetype_default.xml(this.getContentType());
|
|
656
698
|
}
|
|
657
699
|
/**
|
|
658
700
|
* Checks if the current operation is a webhook or not.
|
|
@@ -668,7 +710,7 @@ var Operation = class {
|
|
|
668
710
|
*
|
|
669
711
|
*/
|
|
670
712
|
getSecurity() {
|
|
671
|
-
if (!_optionalChain([this, 'access',
|
|
713
|
+
if (!_optionalChain([this, 'access', _40 => _40.api, 'optionalAccess', _41 => _41.components, 'optionalAccess', _42 => _42.securitySchemes]) || !Object.keys(this.api.components.securitySchemes).length) {
|
|
672
714
|
return [];
|
|
673
715
|
}
|
|
674
716
|
return this.schema.security || this.api.security || [];
|
|
@@ -743,7 +785,7 @@ var Operation = class {
|
|
|
743
785
|
if (!prev[security.type]) prev[security.type] = [];
|
|
744
786
|
const exists = prev[security.type].some((sec) => sec._key === security.security._key);
|
|
745
787
|
if (!exists) {
|
|
746
|
-
if (_optionalChain([security, 'access',
|
|
788
|
+
if (_optionalChain([security, 'access', _43 => _43.security, 'optionalAccess', _44 => _44._requirements])) delete security.security._requirements;
|
|
747
789
|
prev[security.type].push(security.security);
|
|
748
790
|
}
|
|
749
791
|
});
|
|
@@ -798,12 +840,20 @@ var Operation = class {
|
|
|
798
840
|
return this.headers;
|
|
799
841
|
}
|
|
800
842
|
/**
|
|
801
|
-
* Determine if the operation has an
|
|
802
|
-
* in the schema but is an empty string then this will return false.
|
|
843
|
+
* Determine if the operation has an `operationId` present in its schema. Note that if one is
|
|
844
|
+
* present in the schema but is an empty string then this will return false.
|
|
803
845
|
*
|
|
804
846
|
*/
|
|
805
847
|
hasOperationId() {
|
|
806
|
-
return
|
|
848
|
+
return hasOperationId(this.schema);
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Determine if an operation has an `operationId` present in its schema. Note that if one is
|
|
852
|
+
* present in the schema but is an empty string then this will return false.
|
|
853
|
+
*
|
|
854
|
+
*/
|
|
855
|
+
static hasOperationId(schema) {
|
|
856
|
+
return hasOperationId(schema);
|
|
807
857
|
}
|
|
808
858
|
/**
|
|
809
859
|
* Get an `operationId` for this operation. If one is not present (it's not required by the spec!)
|
|
@@ -811,41 +861,15 @@ var Operation = class {
|
|
|
811
861
|
*
|
|
812
862
|
*/
|
|
813
863
|
getOperationId(opts = {}) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
const method = this.method.toLowerCase();
|
|
824
|
-
if (_optionalChain([opts, 'optionalAccess', _35 => _35.camelCase]) || _optionalChain([opts, 'optionalAccess', _36 => _36.friendlyCase])) {
|
|
825
|
-
if (_optionalChain([opts, 'optionalAccess', _37 => _37.friendlyCase])) {
|
|
826
|
-
operationId = operationId.replaceAll("_", " ");
|
|
827
|
-
if (!this.hasOperationId()) {
|
|
828
|
-
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`).split(" ").filter((word, i, arr) => word !== arr[i - 1]).join(" ");
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => chr.toUpperCase());
|
|
832
|
-
if (this.hasOperationId()) {
|
|
833
|
-
operationId = sanitize(operationId);
|
|
834
|
-
}
|
|
835
|
-
operationId = operationId.replace(/^[0-9]/g, (match) => `_${match}`);
|
|
836
|
-
operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);
|
|
837
|
-
if (operationId.startsWith(method)) {
|
|
838
|
-
return operationId;
|
|
839
|
-
}
|
|
840
|
-
if (this.hasOperationId()) {
|
|
841
|
-
return operationId;
|
|
842
|
-
}
|
|
843
|
-
operationId = operationId.charAt(0).toUpperCase() + operationId.slice(1);
|
|
844
|
-
return `${method}${operationId}`;
|
|
845
|
-
} else if (this.hasOperationId()) {
|
|
846
|
-
return operationId;
|
|
847
|
-
}
|
|
848
|
-
return `${method}_${operationId}`;
|
|
864
|
+
return getOperationId(this.path, this.method, this.schema, opts);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Get an `operationId` for an operation. If one is not present (it's not required by the spec!)
|
|
868
|
+
* a hash of the path and method will be returned instead.
|
|
869
|
+
*
|
|
870
|
+
*/
|
|
871
|
+
static getOperationId(path, method, schema, opts = {}) {
|
|
872
|
+
return getOperationId(path, method, schema, opts);
|
|
849
873
|
}
|
|
850
874
|
/**
|
|
851
875
|
* Return an array of all tags, and their metadata, that exist on this operation.
|
|
@@ -895,8 +919,8 @@ var Operation = class {
|
|
|
895
919
|
*
|
|
896
920
|
*/
|
|
897
921
|
getParameters() {
|
|
898
|
-
let parameters = _optionalChain([this, 'access',
|
|
899
|
-
const commonParams = _optionalChain([this, 'access',
|
|
922
|
+
let parameters = _optionalChain([this, 'access', _45 => _45.schema, 'optionalAccess', _46 => _46.parameters]) || [];
|
|
923
|
+
const commonParams = _optionalChain([this, 'access', _47 => _47.api, 'optionalAccess', _48 => _48.paths, 'optionalAccess', _49 => _49[this.path], 'optionalAccess', _50 => _50.parameters]) || [];
|
|
900
924
|
if (commonParams.length) {
|
|
901
925
|
parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);
|
|
902
926
|
}
|
|
@@ -915,7 +939,7 @@ var Operation = class {
|
|
|
915
939
|
*
|
|
916
940
|
*/
|
|
917
941
|
getParametersAsJSONSchema(opts = {}) {
|
|
918
|
-
return
|
|
942
|
+
return _chunkN4TGMVNAcjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
919
943
|
includeDiscriminatorMappingRefs: true,
|
|
920
944
|
transformer: (s) => s,
|
|
921
945
|
...opts
|
|
@@ -958,7 +982,7 @@ var Operation = class {
|
|
|
958
982
|
return [];
|
|
959
983
|
}
|
|
960
984
|
const requestBody = this.schema.requestBody;
|
|
961
|
-
if (
|
|
985
|
+
if (_chunkEQEXNJJEcjs.isRef.call(void 0, requestBody)) {
|
|
962
986
|
return [];
|
|
963
987
|
}
|
|
964
988
|
return Object.keys(requestBody.content);
|
|
@@ -972,7 +996,7 @@ var Operation = class {
|
|
|
972
996
|
return false;
|
|
973
997
|
}
|
|
974
998
|
const requestBody = this.schema.requestBody;
|
|
975
|
-
if (
|
|
999
|
+
if (_chunkEQEXNJJEcjs.isRef.call(void 0, requestBody)) {
|
|
976
1000
|
return false;
|
|
977
1001
|
}
|
|
978
1002
|
if (requestBody.required) {
|
|
@@ -997,7 +1021,7 @@ var Operation = class {
|
|
|
997
1021
|
return false;
|
|
998
1022
|
}
|
|
999
1023
|
const requestBody = this.schema.requestBody;
|
|
1000
|
-
if (
|
|
1024
|
+
if (_chunkEQEXNJJEcjs.isRef.call(void 0, requestBody)) {
|
|
1001
1025
|
return false;
|
|
1002
1026
|
}
|
|
1003
1027
|
if (mediaType) {
|
|
@@ -1009,7 +1033,7 @@ var Operation = class {
|
|
|
1009
1033
|
let availableMediaType;
|
|
1010
1034
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1011
1035
|
mediaTypes.forEach((mt) => {
|
|
1012
|
-
if (!availableMediaType &&
|
|
1036
|
+
if (!availableMediaType && _chunkN4TGMVNAcjs.matches_mimetype_default.json(mt)) {
|
|
1013
1037
|
availableMediaType = mt;
|
|
1014
1038
|
}
|
|
1015
1039
|
});
|
|
@@ -1034,7 +1058,7 @@ var Operation = class {
|
|
|
1034
1058
|
*
|
|
1035
1059
|
*/
|
|
1036
1060
|
getRequestBodyExamples() {
|
|
1037
|
-
const isRequestExampleValueDefined = typeof _optionalChain([this, 'access',
|
|
1061
|
+
const isRequestExampleValueDefined = typeof _optionalChain([this, 'access', _51 => _51.requestBodyExamples, 'optionalAccess', _52 => _52[0], 'optionalAccess', _53 => _53.examples, 'optionalAccess', _54 => _54[0], 'access', _55 => _55.value]) !== "undefined";
|
|
1038
1062
|
if (this.requestBodyExamples && isRequestExampleValueDefined) {
|
|
1039
1063
|
return this.requestBodyExamples;
|
|
1040
1064
|
}
|
|
@@ -1054,7 +1078,7 @@ var Operation = class {
|
|
|
1054
1078
|
return false;
|
|
1055
1079
|
}
|
|
1056
1080
|
const response = this.schema.responses[statusCode];
|
|
1057
|
-
if (
|
|
1081
|
+
if (_chunkEQEXNJJEcjs.isRef.call(void 0, response)) {
|
|
1058
1082
|
return false;
|
|
1059
1083
|
}
|
|
1060
1084
|
return response;
|
|
@@ -1102,11 +1126,11 @@ var Operation = class {
|
|
|
1102
1126
|
Object.keys(this.schema.callbacks).forEach((callback) => {
|
|
1103
1127
|
Object.keys(this.schema.callbacks[callback]).forEach((expression) => {
|
|
1104
1128
|
const cb = this.schema.callbacks[callback];
|
|
1105
|
-
if (!
|
|
1129
|
+
if (!_chunkEQEXNJJEcjs.isRef.call(void 0, cb)) {
|
|
1106
1130
|
const exp = cb[expression];
|
|
1107
|
-
if (!
|
|
1131
|
+
if (!_chunkEQEXNJJEcjs.isRef.call(void 0, exp)) {
|
|
1108
1132
|
Object.keys(exp).forEach((method) => {
|
|
1109
|
-
if (!
|
|
1133
|
+
if (!_chunkUW57LXCEcjs.supportedMethods.includes(method)) return;
|
|
1110
1134
|
callbackOperations.push(this.getCallback(callback, expression, method));
|
|
1111
1135
|
});
|
|
1112
1136
|
}
|
|
@@ -1146,7 +1170,7 @@ var Operation = class {
|
|
|
1146
1170
|
* @deprecated Use `oas.getExtension(extension, operation)` instead.
|
|
1147
1171
|
*/
|
|
1148
1172
|
getExtension(extension) {
|
|
1149
|
-
return _optionalChain([this, 'access',
|
|
1173
|
+
return _optionalChain([this, 'access', _56 => _56.schema, 'optionalAccess', _57 => _57[extension]]);
|
|
1150
1174
|
}
|
|
1151
1175
|
/**
|
|
1152
1176
|
* Returns an object with groups of all example definitions (body/header/query/path/response/etc.).
|
|
@@ -1190,7 +1214,7 @@ var Callback = class extends Operation {
|
|
|
1190
1214
|
return this.identifier;
|
|
1191
1215
|
}
|
|
1192
1216
|
getSummary() {
|
|
1193
|
-
if (_optionalChain([this, 'access',
|
|
1217
|
+
if (_optionalChain([this, 'access', _58 => _58.schema, 'optionalAccess', _59 => _59.summary]) && typeof this.schema.summary === "string") {
|
|
1194
1218
|
return this.schema.summary;
|
|
1195
1219
|
} else if (this.parentSchema.summary && typeof this.parentSchema.summary === "string") {
|
|
1196
1220
|
return this.parentSchema.summary;
|
|
@@ -1198,7 +1222,7 @@ var Callback = class extends Operation {
|
|
|
1198
1222
|
return void 0;
|
|
1199
1223
|
}
|
|
1200
1224
|
getDescription() {
|
|
1201
|
-
if (_optionalChain([this, 'access',
|
|
1225
|
+
if (_optionalChain([this, 'access', _60 => _60.schema, 'optionalAccess', _61 => _61.description]) && typeof this.schema.description === "string") {
|
|
1202
1226
|
return this.schema.description;
|
|
1203
1227
|
} else if (this.parentSchema.description && typeof this.parentSchema.description === "string") {
|
|
1204
1228
|
return this.parentSchema.description;
|
|
@@ -1206,7 +1230,7 @@ var Callback = class extends Operation {
|
|
|
1206
1230
|
return void 0;
|
|
1207
1231
|
}
|
|
1208
1232
|
getParameters() {
|
|
1209
|
-
let parameters = _optionalChain([this, 'access',
|
|
1233
|
+
let parameters = _optionalChain([this, 'access', _62 => _62.schema, 'optionalAccess', _63 => _63.parameters]) || [];
|
|
1210
1234
|
const commonParams = this.parentSchema.parameters || [];
|
|
1211
1235
|
if (commonParams.length) {
|
|
1212
1236
|
parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);
|
|
@@ -1216,7 +1240,7 @@ var Callback = class extends Operation {
|
|
|
1216
1240
|
};
|
|
1217
1241
|
var Webhook = class extends Operation {
|
|
1218
1242
|
getSummary() {
|
|
1219
|
-
if (_optionalChain([this, 'access',
|
|
1243
|
+
if (_optionalChain([this, 'access', _64 => _64.schema, 'optionalAccess', _65 => _65.summary]) && typeof this.schema.summary === "string") {
|
|
1220
1244
|
return this.schema.summary;
|
|
1221
1245
|
} else if (this.api.webhooks[this.path].summary && typeof this.api.webhooks[this.path].summary === "string") {
|
|
1222
1246
|
return this.api.webhooks[this.path].summary;
|
|
@@ -1224,7 +1248,7 @@ var Webhook = class extends Operation {
|
|
|
1224
1248
|
return void 0;
|
|
1225
1249
|
}
|
|
1226
1250
|
getDescription() {
|
|
1227
|
-
if (_optionalChain([this, 'access',
|
|
1251
|
+
if (_optionalChain([this, 'access', _66 => _66.schema, 'optionalAccess', _67 => _67.description]) && typeof this.schema.description === "string") {
|
|
1228
1252
|
return this.schema.description;
|
|
1229
1253
|
} else if (this.api.webhooks[this.path].description && typeof this.api.webhooks[this.path].description === "string") {
|
|
1230
1254
|
return this.api.webhooks[this.path].description;
|
|
@@ -1250,4 +1274,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1250
1274
|
* @license Apache-2.0
|
|
1251
1275
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1252
1276
|
*/
|
|
1253
|
-
//# sourceMappingURL=chunk-
|
|
1277
|
+
//# sourceMappingURL=chunk-MW5BWU34.cjs.map
|