oas 38.3.1 → 38.5.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 +38 -4
- package/dist/analyzer/index.cjs +16 -16
- package/dist/analyzer/index.js +2 -2
- package/dist/{chunk-3ZXZMZXT.cjs → chunk-2F2OPV5M.cjs} +89 -75
- package/dist/chunk-2F2OPV5M.cjs.map +1 -0
- package/dist/{chunk-ANZIKNVX.js → chunk-6D7GWVEH.js} +2 -2
- package/dist/chunk-6DVSNS26.cjs +709 -0
- package/dist/chunk-6DVSNS26.cjs.map +1 -0
- package/dist/{chunk-7WBPPWYI.cjs → chunk-6GTPCWO5.cjs} +3 -3
- package/dist/{chunk-7WBPPWYI.cjs.map → chunk-6GTPCWO5.cjs.map} +1 -1
- package/dist/{chunk-LZNTJ4ZR.js → chunk-DYHV2B4Z.js} +4 -1
- package/dist/chunk-DYHV2B4Z.js.map +1 -0
- package/dist/{chunk-6HXOZ5GY.cjs → chunk-EARDDQSB.cjs} +5 -2
- package/dist/chunk-EARDDQSB.cjs.map +1 -0
- package/dist/chunk-MR33ELUC.js +709 -0
- package/dist/chunk-MR33ELUC.js.map +1 -0
- package/dist/{chunk-XXX6U72S.js → chunk-TU6UPWO6.js} +19 -5
- package/dist/chunk-TU6UPWO6.js.map +1 -0
- package/dist/extensions.cjs +4 -2
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.d.cts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +3 -1
- package/dist/index-Borb1VXh.d.cts +174 -0
- package/dist/index-Br-eJMCh.d.ts +174 -0
- package/dist/index.cjs +60 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/operation/index.cjs +4 -4
- package/dist/operation/index.js +3 -3
- package/dist/pruner/index.cjs +87 -0
- package/dist/pruner/index.cjs.map +1 -0
- package/dist/pruner/index.d.cts +72 -0
- package/dist/pruner/index.d.ts +72 -0
- package/dist/pruner/index.js +87 -0
- package/dist/pruner/index.js.map +1 -0
- package/dist/reducer/index.cjs +40 -521
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.d.cts +22 -108
- package/dist/reducer/index.d.ts +22 -108
- package/dist/reducer/index.js +38 -519
- package/dist/reducer/index.js.map +1 -1
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +2 -2
- package/package.json +6 -2
- package/dist/chunk-3ZXZMZXT.cjs.map +0 -1
- package/dist/chunk-6HXOZ5GY.cjs.map +0 -1
- package/dist/chunk-LZNTJ4ZR.js.map +0 -1
- package/dist/chunk-XXX6U72S.js.map +0 -1
- /package/dist/{chunk-ANZIKNVX.js.map → chunk-6D7GWVEH.js.map} +0 -0
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk6GTPCWO5cjs = require('./chunk-6GTPCWO5.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkEARDDQSBcjs = require('./chunk-EARDDQSB.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunk7PWF3F2Wcjs = require('./chunk-7PWF3F2W.cjs');
|
|
@@ -47,6 +47,9 @@ function stripTrailingSlash(url) {
|
|
|
47
47
|
}
|
|
48
48
|
return url;
|
|
49
49
|
}
|
|
50
|
+
function escapeRegExp(string) {
|
|
51
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
52
|
+
}
|
|
50
53
|
function normalizeURL(url, urlForProtocolCheck = url) {
|
|
51
54
|
const exampleDotCom = "https://example.com";
|
|
52
55
|
if (!url) return exampleDotCom;
|
|
@@ -67,7 +70,7 @@ function normalizeURL(url, urlForProtocolCheck = url) {
|
|
|
67
70
|
}
|
|
68
71
|
function normalizedURLFromServers(servers, selected) {
|
|
69
72
|
const server = _optionalChain([servers, 'optionalAccess', _7 => _7[selected]]);
|
|
70
|
-
const resolvedUrl = _optionalChain([server, 'optionalAccess', _8 => _8.url, 'optionalAccess', _9 => _9.replace, 'call', _10 => _10(
|
|
73
|
+
const resolvedUrl = _optionalChain([server, 'optionalAccess', _8 => _8.url, 'optionalAccess', _9 => _9.replace, 'call', _10 => _10(_chunk6GTPCWO5cjs.SERVER_VARIABLE_REGEX, (original, key) => {
|
|
71
74
|
return key in (server.variables || {}) ? String(_optionalChain([server, 'access', _11 => _11.variables, 'optionalAccess', _12 => _12[key], 'access', _13 => _13.default])) : original;
|
|
72
75
|
})]);
|
|
73
76
|
return normalizeURL(_optionalChain([server, 'optionalAccess', _14 => _14.url]), resolvedUrl);
|
|
@@ -108,11 +111,21 @@ function splitUrlFromServers(servers, selected = 0) {
|
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
function transformURLIntoRegex(url) {
|
|
111
|
-
|
|
114
|
+
const staticParts = url.split(/\{[-_a-zA-Z0-9:.[\]]+\}/g);
|
|
115
|
+
return stripTrailingSlash(staticParts.map(escapeRegExp).join("([-_a-zA-Z0-9:.[\\]]+)"));
|
|
112
116
|
}
|
|
113
117
|
function normalizePath(path) {
|
|
118
|
+
const usedNames = /* @__PURE__ */ new Set();
|
|
114
119
|
return path.replace(/({?){(.*?)}(}?)/g, (str, ...args) => {
|
|
115
|
-
|
|
120
|
+
const base = args[1].replaceAll("-", "");
|
|
121
|
+
let name = base;
|
|
122
|
+
let suffix = 2;
|
|
123
|
+
while (usedNames.has(name)) {
|
|
124
|
+
name = `${base}_${suffix}`;
|
|
125
|
+
suffix += 1;
|
|
126
|
+
}
|
|
127
|
+
usedNames.add(name);
|
|
128
|
+
return `:${name}`;
|
|
116
129
|
}).replace(/::/, "\\::").split("?")[0];
|
|
117
130
|
}
|
|
118
131
|
var MATCHER_CACHE_MAX_SIZE = 1e4;
|
|
@@ -225,7 +238,7 @@ function usesPolymorphism(schema) {
|
|
|
225
238
|
return false;
|
|
226
239
|
}
|
|
227
240
|
function objectify(thing) {
|
|
228
|
-
if (!
|
|
241
|
+
if (!_chunk6GTPCWO5cjs.isObject.call(void 0, thing)) {
|
|
229
242
|
return {};
|
|
230
243
|
}
|
|
231
244
|
return thing;
|
|
@@ -290,7 +303,7 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
290
303
|
if (seenRefs.has(refToRelease)) {
|
|
291
304
|
return void 0;
|
|
292
305
|
}
|
|
293
|
-
objectifySchema =
|
|
306
|
+
objectifySchema = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, objectifySchema, opts.definition, seenRefs);
|
|
294
307
|
if (!objectifySchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, objectifySchema)) {
|
|
295
308
|
return void 0;
|
|
296
309
|
}
|
|
@@ -308,7 +321,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
308
321
|
const { example, additionalProperties, properties, items } = schema;
|
|
309
322
|
const { includeReadOnly, includeWriteOnly } = opts;
|
|
310
323
|
if (example !== void 0) {
|
|
311
|
-
return
|
|
324
|
+
return _chunk6GTPCWO5cjs.dereferenceRefDeep.call(void 0, example, opts.definition, seenRefs);
|
|
312
325
|
}
|
|
313
326
|
const hasPolymorphism = usesPolymorphism(schema);
|
|
314
327
|
if (hasPolymorphism === "allOf") {
|
|
@@ -317,7 +330,7 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
317
330
|
const resolvedAllOf = schema.allOf.map((subSchema) => {
|
|
318
331
|
let sub = objectify(subSchema);
|
|
319
332
|
if (definition && _chunk7PWF3F2Wcjs.isRef.call(void 0, sub)) {
|
|
320
|
-
const resolved =
|
|
333
|
+
const resolved = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, sub, definition, /* @__PURE__ */ new Set());
|
|
321
334
|
if (resolved && !_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) {
|
|
322
335
|
sub = resolved;
|
|
323
336
|
}
|
|
@@ -428,8 +441,8 @@ function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
|
428
441
|
// src/operation/lib/get-mediatype-examples.ts
|
|
429
442
|
function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {}) {
|
|
430
443
|
if (mediaTypeObject.example) {
|
|
431
|
-
mediaTypeObject.example =
|
|
432
|
-
if (mediaTypeObject.example === void 0 ||
|
|
444
|
+
mediaTypeObject.example = _chunk6GTPCWO5cjs.dereferenceRefDeep.call(void 0, mediaTypeObject.example, definition);
|
|
445
|
+
if (mediaTypeObject.example === void 0 || _chunk6GTPCWO5cjs.collectRefsInSchema.call(void 0, mediaTypeObject.example).size > 0) {
|
|
433
446
|
return [];
|
|
434
447
|
}
|
|
435
448
|
return [
|
|
@@ -445,7 +458,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
445
458
|
let example = examples[key];
|
|
446
459
|
if (example !== null && typeof example === "object") {
|
|
447
460
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
448
|
-
example =
|
|
461
|
+
example = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, example, definition);
|
|
449
462
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
450
463
|
return false;
|
|
451
464
|
}
|
|
@@ -457,8 +470,8 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
457
470
|
description = example.description;
|
|
458
471
|
}
|
|
459
472
|
if ("value" in example) {
|
|
460
|
-
example.value =
|
|
461
|
-
if (example.value === void 0 ||
|
|
473
|
+
example.value = _chunk6GTPCWO5cjs.dereferenceRefDeep.call(void 0, example.value, definition);
|
|
474
|
+
if (example.value === void 0 || _chunk6GTPCWO5cjs.collectRefsInSchema.call(void 0, example.value).size > 0) {
|
|
462
475
|
return false;
|
|
463
476
|
}
|
|
464
477
|
example = example.value;
|
|
@@ -475,7 +488,7 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {})
|
|
|
475
488
|
}
|
|
476
489
|
}
|
|
477
490
|
if (mediaTypeObject.schema) {
|
|
478
|
-
if (!
|
|
491
|
+
if (!_chunk6GTPCWO5cjs.matches_mimetype_default.xml(mediaType)) {
|
|
479
492
|
return [
|
|
480
493
|
{
|
|
481
494
|
value: sampleFromSchema(structuredClone(mediaTypeObject.schema), {
|
|
@@ -496,7 +509,7 @@ function getResponseExamples(operation, definition) {
|
|
|
496
509
|
let onlyHeaders = false;
|
|
497
510
|
if (!response) return false;
|
|
498
511
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
499
|
-
response =
|
|
512
|
+
response = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, response, definition);
|
|
500
513
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) return false;
|
|
501
514
|
}
|
|
502
515
|
const mediaTypes = {};
|
|
@@ -536,14 +549,14 @@ function getCallbackExamples(operation, definition) {
|
|
|
536
549
|
let callback = _optionalChain([operation, 'access', _34 => _34.callbacks, 'optionalAccess', _35 => _35[identifier]]);
|
|
537
550
|
if (!callback) return [];
|
|
538
551
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
539
|
-
callback =
|
|
552
|
+
callback = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, callback, definition);
|
|
540
553
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) return [];
|
|
541
554
|
}
|
|
542
555
|
const items = Object.keys(callback).map((expression) => {
|
|
543
556
|
let callbackPath = callback[expression];
|
|
544
557
|
if (!callbackPath) return [];
|
|
545
558
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
546
|
-
callbackPath =
|
|
559
|
+
callbackPath = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, callbackPath, definition);
|
|
547
560
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) return [];
|
|
548
561
|
}
|
|
549
562
|
return Object.keys(callbackPath).map((method) => {
|
|
@@ -592,7 +605,7 @@ function getDefaultName(sample, count) {
|
|
|
592
605
|
function getExampleGroups(operation) {
|
|
593
606
|
const namelessCodeSampleCounts = {};
|
|
594
607
|
const groups = {};
|
|
595
|
-
const codeSamples =
|
|
608
|
+
const codeSamples = _chunkEARDDQSBcjs.getExtension.call(void 0, "code-samples", operation.api, operation);
|
|
596
609
|
_optionalChain([codeSamples, 'optionalAccess', _36 => _36.forEach, 'call', _37 => _37((sample, i) => {
|
|
597
610
|
if (namelessCodeSampleCounts[sample.language]) {
|
|
598
611
|
namelessCodeSampleCounts[sample.language] += 1;
|
|
@@ -626,7 +639,7 @@ function getExampleGroups(operation) {
|
|
|
626
639
|
Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]) => {
|
|
627
640
|
let example = paramExample;
|
|
628
641
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, example)) {
|
|
629
|
-
example =
|
|
642
|
+
example = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, example, operation.api);
|
|
630
643
|
if (!example || _chunk7PWF3F2Wcjs.isRef.call(void 0, example)) return;
|
|
631
644
|
}
|
|
632
645
|
groups[exampleKey] = {
|
|
@@ -674,7 +687,7 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
674
687
|
if (!requestBody) {
|
|
675
688
|
return [];
|
|
676
689
|
} else if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
677
|
-
requestBody =
|
|
690
|
+
requestBody = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, requestBody, definition);
|
|
678
691
|
}
|
|
679
692
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) || !requestBody.content) {
|
|
680
693
|
return [];
|
|
@@ -739,7 +752,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
739
752
|
}
|
|
740
753
|
|
|
741
754
|
// src/operation/transformers/get-response-as-json-schema.ts
|
|
742
|
-
var isJSON =
|
|
755
|
+
var isJSON = _chunk6GTPCWO5cjs.matches_mimetype_default.json;
|
|
743
756
|
function buildHeadersSchema(response, schemaOptions) {
|
|
744
757
|
const headersSchema = {
|
|
745
758
|
type: "object",
|
|
@@ -752,7 +765,7 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
752
765
|
let headerEntry = _optionalChain([response, 'access', _62 => _62.headers, 'optionalAccess', _63 => _63[key]]);
|
|
753
766
|
if (!headerEntry) return;
|
|
754
767
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) {
|
|
755
|
-
headerEntry =
|
|
768
|
+
headerEntry = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, headerEntry, api, seenRefs);
|
|
756
769
|
if (!headerEntry || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerEntry)) return;
|
|
757
770
|
}
|
|
758
771
|
if (headerEntry.schema) {
|
|
@@ -760,10 +773,10 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
760
773
|
let headerSchema = header.schema;
|
|
761
774
|
if (!headerSchema) return;
|
|
762
775
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) {
|
|
763
|
-
headerSchema =
|
|
776
|
+
headerSchema = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, headerSchema, api, seenRefs);
|
|
764
777
|
if (!headerSchema || _chunk7PWF3F2Wcjs.isRef.call(void 0, headerSchema)) return;
|
|
765
778
|
}
|
|
766
|
-
headersSchema.properties[key] =
|
|
779
|
+
headersSchema.properties[key] = _chunk6GTPCWO5cjs.toJSONSchema.call(void 0, _chunk6GTPCWO5cjs.cloneObject.call(void 0, headerSchema), {
|
|
767
780
|
addEnumsToDescriptions: true,
|
|
768
781
|
...schemaOptions
|
|
769
782
|
});
|
|
@@ -817,32 +830,32 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
817
830
|
}
|
|
818
831
|
if (preferredContentType) {
|
|
819
832
|
if (contentTypes.includes(preferredContentType)) {
|
|
820
|
-
const schema2 =
|
|
833
|
+
const schema2 = _chunk6GTPCWO5cjs.cloneObject.call(void 0, content[preferredContentType].schema);
|
|
821
834
|
if (!schema2) {
|
|
822
835
|
return null;
|
|
823
836
|
}
|
|
824
|
-
return
|
|
837
|
+
return _chunk6GTPCWO5cjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
825
838
|
}
|
|
826
839
|
return null;
|
|
827
840
|
}
|
|
828
841
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
829
842
|
if (isJSON(contentTypes[i])) {
|
|
830
|
-
const schema2 =
|
|
843
|
+
const schema2 = _chunk6GTPCWO5cjs.cloneObject.call(void 0, content[contentTypes[i]].schema);
|
|
831
844
|
if (!schema2) {
|
|
832
845
|
return {};
|
|
833
846
|
}
|
|
834
|
-
return
|
|
847
|
+
return _chunk6GTPCWO5cjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
835
848
|
}
|
|
836
849
|
}
|
|
837
850
|
const contentType = contentTypes.shift();
|
|
838
851
|
if (!contentType) {
|
|
839
852
|
return {};
|
|
840
853
|
}
|
|
841
|
-
const schema =
|
|
854
|
+
const schema = _chunk6GTPCWO5cjs.cloneObject.call(void 0, content[contentType].schema);
|
|
842
855
|
if (!schema) {
|
|
843
856
|
return {};
|
|
844
857
|
}
|
|
845
|
-
return
|
|
858
|
+
return _chunk6GTPCWO5cjs.toJSONSchema.call(void 0, schema, baseSchemaOptions);
|
|
846
859
|
}
|
|
847
860
|
const foundSchema = getPreferredSchema(response.content, _optionalChain([opts, 'optionalAccess', _64 => _64.contentType]));
|
|
848
861
|
if (_optionalChain([opts, 'optionalAccess', _65 => _65.contentType]) && !foundSchema) {
|
|
@@ -861,23 +874,23 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
861
874
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
862
875
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
863
876
|
type: _nullishCoalesce(schemaType, () => ( "string")),
|
|
864
|
-
schema:
|
|
877
|
+
schema: _chunk6GTPCWO5cjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
865
878
|
...schema,
|
|
866
|
-
$schema:
|
|
879
|
+
$schema: _chunk6GTPCWO5cjs.getSchemaVersionString.call(void 0, schema, api)
|
|
867
880
|
},
|
|
868
881
|
label: "Response body"
|
|
869
882
|
};
|
|
870
883
|
if (response.description && schemaWrapper.schema) {
|
|
871
884
|
schemaWrapper.description = response.description;
|
|
872
885
|
}
|
|
873
|
-
|
|
886
|
+
_chunk6GTPCWO5cjs.applyDiscriminatorOneOfToUsedSchemas.call(void 0, api, usedSchemas, (ref) => {
|
|
874
887
|
if (usedSchemas.has(ref)) {
|
|
875
888
|
return usedSchemas.get(ref);
|
|
876
889
|
}
|
|
877
890
|
try {
|
|
878
|
-
const resolved =
|
|
891
|
+
const resolved = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, { $ref: ref }, api, seenRefs);
|
|
879
892
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resolved)) return;
|
|
880
|
-
const converted =
|
|
893
|
+
const converted = _chunk6GTPCWO5cjs.toJSONSchema.call(void 0, structuredClone(resolved), {
|
|
881
894
|
...baseSchemaOptions,
|
|
882
895
|
seenRefs
|
|
883
896
|
});
|
|
@@ -887,11 +900,11 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
887
900
|
}
|
|
888
901
|
});
|
|
889
902
|
if (schemaWrapper.schema && usedSchemas.size > 0) {
|
|
890
|
-
const refsInOutput =
|
|
903
|
+
const refsInOutput = _chunk6GTPCWO5cjs.collectRefsInSchema.call(void 0, schemaWrapper.schema);
|
|
891
904
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("body"), () => ( /* @__PURE__ */ new Set()));
|
|
892
|
-
const referencedSchemas =
|
|
905
|
+
const referencedSchemas = _chunk6GTPCWO5cjs.filterRequiredRefsToReferenced.call(void 0, /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]), usedSchemas);
|
|
893
906
|
if (referencedSchemas.size > 0) {
|
|
894
|
-
|
|
907
|
+
_chunk6GTPCWO5cjs.mergeReferencedSchemasIntoRoot.call(void 0, schemaWrapper.schema, referencedSchemas);
|
|
895
908
|
}
|
|
896
909
|
}
|
|
897
910
|
jsonSchema.push(schemaWrapper);
|
|
@@ -903,10 +916,10 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
903
916
|
});
|
|
904
917
|
if (headersWrapper.schema && usedSchemas.size > 0) {
|
|
905
918
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("headers"), () => ( /* @__PURE__ */ new Set()));
|
|
906
|
-
const refsInOutput =
|
|
907
|
-
const referencedSchemas =
|
|
919
|
+
const refsInOutput = _chunk6GTPCWO5cjs.collectRefsInSchema.call(void 0, headersWrapper.schema);
|
|
920
|
+
const referencedSchemas = _chunk6GTPCWO5cjs.filterRequiredRefsToReferenced.call(void 0, /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]), usedSchemas);
|
|
908
921
|
if (referencedSchemas.size > 0) {
|
|
909
|
-
|
|
922
|
+
_chunk6GTPCWO5cjs.mergeReferencedSchemasIntoRoot.call(void 0, headersWrapper.schema, referencedSchemas);
|
|
910
923
|
}
|
|
911
924
|
}
|
|
912
925
|
jsonSchema.push(headersWrapper);
|
|
@@ -1017,7 +1030,7 @@ var Operation = class {
|
|
|
1017
1030
|
return this.schema.servers;
|
|
1018
1031
|
}
|
|
1019
1032
|
if (_optionalChain([this, 'access', _81 => _81.api, 'access', _82 => _82.paths, 'optionalAccess', _83 => _83[this.path]])) {
|
|
1020
|
-
const pathItem =
|
|
1033
|
+
const pathItem = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, this.api.paths[this.path], this.api);
|
|
1021
1034
|
if (pathItem && !_chunk7PWF3F2Wcjs.isRef.call(void 0, pathItem) && _optionalChain([pathItem, 'access', _84 => _84.servers, 'optionalAccess', _85 => _85.length])) {
|
|
1022
1035
|
return pathItem.servers;
|
|
1023
1036
|
}
|
|
@@ -1052,7 +1065,7 @@ var Operation = class {
|
|
|
1052
1065
|
let types = [];
|
|
1053
1066
|
if (this.schema.requestBody) {
|
|
1054
1067
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.requestBody)) {
|
|
1055
|
-
this.schema.requestBody =
|
|
1068
|
+
this.schema.requestBody = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, this.schema.requestBody, this.api);
|
|
1056
1069
|
}
|
|
1057
1070
|
if (this.schema.requestBody && "content" in this.schema.requestBody) {
|
|
1058
1071
|
types = Object.keys(this.schema.requestBody.content);
|
|
@@ -1063,7 +1076,7 @@ var Operation = class {
|
|
|
1063
1076
|
this.contentType = types[0];
|
|
1064
1077
|
}
|
|
1065
1078
|
types.forEach((t) => {
|
|
1066
|
-
if (
|
|
1079
|
+
if (_chunk6GTPCWO5cjs.matches_mimetype_default.json(t)) {
|
|
1067
1080
|
this.contentType = t;
|
|
1068
1081
|
}
|
|
1069
1082
|
});
|
|
@@ -1076,7 +1089,7 @@ var Operation = class {
|
|
|
1076
1089
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
1077
1090
|
*/
|
|
1078
1091
|
isFormUrlEncoded() {
|
|
1079
|
-
return
|
|
1092
|
+
return _chunk6GTPCWO5cjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
1080
1093
|
}
|
|
1081
1094
|
/**
|
|
1082
1095
|
* Checks if the current operation has a mutipart content type payload.
|
|
@@ -1085,7 +1098,7 @@ var Operation = class {
|
|
|
1085
1098
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
1086
1099
|
*/
|
|
1087
1100
|
isMultipart() {
|
|
1088
|
-
return
|
|
1101
|
+
return _chunk6GTPCWO5cjs.matches_mimetype_default.multipart(this.getContentType());
|
|
1089
1102
|
}
|
|
1090
1103
|
/**
|
|
1091
1104
|
* Checks if the current operation has a JSON-like content type payload.
|
|
@@ -1094,7 +1107,7 @@ var Operation = class {
|
|
|
1094
1107
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
1095
1108
|
*/
|
|
1096
1109
|
isJson() {
|
|
1097
|
-
return
|
|
1110
|
+
return _chunk6GTPCWO5cjs.matches_mimetype_default.json(this.getContentType());
|
|
1098
1111
|
}
|
|
1099
1112
|
/**
|
|
1100
1113
|
* Checks if the current operation has an XML content type payload.
|
|
@@ -1103,7 +1116,7 @@ var Operation = class {
|
|
|
1103
1116
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
1104
1117
|
*/
|
|
1105
1118
|
isXml() {
|
|
1106
|
-
return
|
|
1119
|
+
return _chunk6GTPCWO5cjs.matches_mimetype_default.xml(this.getContentType());
|
|
1107
1120
|
}
|
|
1108
1121
|
/**
|
|
1109
1122
|
* Checks if the current operation is a webhook or not.
|
|
@@ -1151,7 +1164,7 @@ var Operation = class {
|
|
|
1151
1164
|
security = _optionalChain([this, 'access', _94 => _94.api, 'optionalAccess', _95 => _95.components, 'optionalAccess', _96 => _96.securitySchemes, 'optionalAccess', _97 => _97[key]]);
|
|
1152
1165
|
if (!security) return false;
|
|
1153
1166
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, security)) {
|
|
1154
|
-
security =
|
|
1167
|
+
security = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, security, this.api);
|
|
1155
1168
|
if (!security || _chunk7PWF3F2Wcjs.isRef.call(void 0, security)) return false;
|
|
1156
1169
|
}
|
|
1157
1170
|
} catch (e6) {
|
|
@@ -1232,7 +1245,7 @@ var Operation = class {
|
|
|
1232
1245
|
this.schema.parameters.map((p) => {
|
|
1233
1246
|
let param = p;
|
|
1234
1247
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1235
|
-
param =
|
|
1248
|
+
param = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, param, this.api);
|
|
1236
1249
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1237
1250
|
}
|
|
1238
1251
|
if (param.in && param.in === "header") return param.name;
|
|
@@ -1245,7 +1258,7 @@ var Operation = class {
|
|
|
1245
1258
|
let response = this.schema.responses[r];
|
|
1246
1259
|
if (!response) return [];
|
|
1247
1260
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1248
|
-
this.schema.responses[r] =
|
|
1261
|
+
this.schema.responses[r] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, response, this.api);
|
|
1249
1262
|
response = this.schema.responses[r];
|
|
1250
1263
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1251
1264
|
return [];
|
|
@@ -1258,7 +1271,7 @@ var Operation = class {
|
|
|
1258
1271
|
let requestBody = this.schema.requestBody;
|
|
1259
1272
|
if (requestBody) {
|
|
1260
1273
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1261
|
-
this.schema.requestBody =
|
|
1274
|
+
this.schema.requestBody = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1262
1275
|
requestBody = this.schema.requestBody;
|
|
1263
1276
|
}
|
|
1264
1277
|
if (requestBody && !_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody) && "content" in requestBody && Object.keys(requestBody.content)) {
|
|
@@ -1271,7 +1284,7 @@ var Operation = class {
|
|
|
1271
1284
|
let response = _optionalChain([this, 'access', _101 => _101.schema, 'access', _102 => _102.responses, 'optionalAccess', _103 => _103[r]]);
|
|
1272
1285
|
if (!response) return false;
|
|
1273
1286
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1274
|
-
this.schema.responses[r] =
|
|
1287
|
+
this.schema.responses[r] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, response, this.api);
|
|
1275
1288
|
response = this.schema.responses[r];
|
|
1276
1289
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1277
1290
|
return false;
|
|
@@ -1381,7 +1394,7 @@ var Operation = class {
|
|
|
1381
1394
|
let parameters = (_optionalChain([this, 'access', _106 => _106.schema, 'optionalAccess', _107 => _107.parameters]) || []).map((p) => {
|
|
1382
1395
|
let param = p;
|
|
1383
1396
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1384
|
-
param =
|
|
1397
|
+
param = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, param, this.api);
|
|
1385
1398
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1386
1399
|
}
|
|
1387
1400
|
return param;
|
|
@@ -1389,7 +1402,7 @@ var Operation = class {
|
|
|
1389
1402
|
const commonParams = (_optionalChain([this, 'access', _108 => _108.api, 'optionalAccess', _109 => _109.paths, 'optionalAccess', _110 => _110[this.path], 'optionalAccess', _111 => _111.parameters]) || []).map((p) => {
|
|
1390
1403
|
let param = p;
|
|
1391
1404
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1392
|
-
param =
|
|
1405
|
+
param = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, param, this.api);
|
|
1393
1406
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1394
1407
|
}
|
|
1395
1408
|
return param;
|
|
@@ -1421,8 +1434,8 @@ var Operation = class {
|
|
|
1421
1434
|
*
|
|
1422
1435
|
*/
|
|
1423
1436
|
getParametersAsJSONSchema(opts = {}) {
|
|
1424
|
-
|
|
1425
|
-
return
|
|
1437
|
+
_chunk6GTPCWO5cjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1438
|
+
return _chunk6GTPCWO5cjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
1426
1439
|
includeDiscriminatorMappingRefs: true,
|
|
1427
1440
|
...opts
|
|
1428
1441
|
});
|
|
@@ -1441,7 +1454,7 @@ var Operation = class {
|
|
|
1441
1454
|
* this content-type, the function will return null.
|
|
1442
1455
|
*/
|
|
1443
1456
|
getResponseAsJSONSchema(statusCode, opts = {}) {
|
|
1444
|
-
|
|
1457
|
+
_chunk6GTPCWO5cjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1445
1458
|
return getResponseAsJSONSchema(this, this.api, statusCode, {
|
|
1446
1459
|
includeDiscriminatorMappingRefs: true,
|
|
1447
1460
|
...opts
|
|
@@ -1454,7 +1467,7 @@ var Operation = class {
|
|
|
1454
1467
|
getResponseStatusCodes() {
|
|
1455
1468
|
if (!this.schema.responses) return [];
|
|
1456
1469
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1457
|
-
this.schema.responses =
|
|
1470
|
+
this.schema.responses = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, this.schema.responses, this.api);
|
|
1458
1471
|
if (!this.schema.responses || _chunk7PWF3F2Wcjs.isRef.call(void 0, this.schema.responses)) {
|
|
1459
1472
|
return [];
|
|
1460
1473
|
}
|
|
@@ -1480,7 +1493,7 @@ var Operation = class {
|
|
|
1480
1493
|
let resp = response;
|
|
1481
1494
|
if (!resp) return;
|
|
1482
1495
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1483
|
-
resp =
|
|
1496
|
+
resp = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, resp, this.api);
|
|
1484
1497
|
if (!resp || _chunk7PWF3F2Wcjs.isRef.call(void 0, resp)) {
|
|
1485
1498
|
return;
|
|
1486
1499
|
}
|
|
@@ -1509,7 +1522,7 @@ var Operation = class {
|
|
|
1509
1522
|
let requestBody = this.schema.requestBody;
|
|
1510
1523
|
if (!requestBody) return false;
|
|
1511
1524
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1512
|
-
this.schema.requestBody =
|
|
1525
|
+
this.schema.requestBody = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1513
1526
|
requestBody = this.schema.requestBody;
|
|
1514
1527
|
if (!requestBody || _chunk7PWF3F2Wcjs.isRef.call(void 0, requestBody)) {
|
|
1515
1528
|
return false;
|
|
@@ -1583,7 +1596,7 @@ var Operation = class {
|
|
|
1583
1596
|
let availableMediaType;
|
|
1584
1597
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1585
1598
|
mediaTypes.forEach((mt) => {
|
|
1586
|
-
if (!availableMediaType &&
|
|
1599
|
+
if (!availableMediaType && _chunk6GTPCWO5cjs.matches_mimetype_default.json(mt)) {
|
|
1587
1600
|
availableMediaType = mt;
|
|
1588
1601
|
}
|
|
1589
1602
|
});
|
|
@@ -1631,7 +1644,7 @@ var Operation = class {
|
|
|
1631
1644
|
let response = this.schema.responses[statusCode];
|
|
1632
1645
|
if (!response) return false;
|
|
1633
1646
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1634
|
-
this.schema.responses[statusCode] =
|
|
1647
|
+
this.schema.responses[statusCode] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, response, this.api);
|
|
1635
1648
|
response = this.schema.responses[statusCode];
|
|
1636
1649
|
if (!response || _chunk7PWF3F2Wcjs.isRef.call(void 0, response)) {
|
|
1637
1650
|
return false;
|
|
@@ -1675,7 +1688,7 @@ var Operation = class {
|
|
|
1675
1688
|
let callbackObj = this.schema.callbacks[identifier];
|
|
1676
1689
|
if (!callbackObj) return false;
|
|
1677
1690
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1678
|
-
this.schema.callbacks[identifier] =
|
|
1691
|
+
this.schema.callbacks[identifier] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, callbackObj, this.api);
|
|
1679
1692
|
callbackObj = this.schema.callbacks[identifier];
|
|
1680
1693
|
if (!callbackObj || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackObj)) {
|
|
1681
1694
|
return false;
|
|
@@ -1684,7 +1697,7 @@ var Operation = class {
|
|
|
1684
1697
|
let callback = callbackObj[expression];
|
|
1685
1698
|
if (!callback) return false;
|
|
1686
1699
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1687
|
-
callbackObj[expression] =
|
|
1700
|
+
callbackObj[expression] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, callback, this.api);
|
|
1688
1701
|
callback = callbackObj[expression];
|
|
1689
1702
|
if (!callback || _chunk7PWF3F2Wcjs.isRef.call(void 0, callback)) {
|
|
1690
1703
|
return false;
|
|
@@ -1708,7 +1721,7 @@ var Operation = class {
|
|
|
1708
1721
|
let cb = _optionalChain([this, 'access', _120 => _120.schema, 'access', _121 => _121.callbacks, 'optionalAccess', _122 => _122[callback]]);
|
|
1709
1722
|
if (!cb) return;
|
|
1710
1723
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1711
|
-
this.schema.callbacks[callback] =
|
|
1724
|
+
this.schema.callbacks[callback] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, cb, this.api);
|
|
1712
1725
|
cb = this.schema.callbacks[callback];
|
|
1713
1726
|
if (!cb || _chunk7PWF3F2Wcjs.isRef.call(void 0, cb)) {
|
|
1714
1727
|
return;
|
|
@@ -1718,14 +1731,14 @@ var Operation = class {
|
|
|
1718
1731
|
let callbackPath = cb[expression];
|
|
1719
1732
|
if (!callbackPath) return;
|
|
1720
1733
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1721
|
-
cb[expression] =
|
|
1734
|
+
cb[expression] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, callbackPath, this.api);
|
|
1722
1735
|
callbackPath = cb[expression];
|
|
1723
1736
|
if (!callbackPath || _chunk7PWF3F2Wcjs.isRef.call(void 0, callbackPath)) {
|
|
1724
1737
|
return;
|
|
1725
1738
|
}
|
|
1726
1739
|
}
|
|
1727
1740
|
Object.keys(callbackPath).forEach((method) => {
|
|
1728
|
-
if (!
|
|
1741
|
+
if (!_chunk6GTPCWO5cjs.supportedMethods.includes(method)) return;
|
|
1729
1742
|
const found = this.getCallback(callback, expression, method);
|
|
1730
1743
|
if (found) {
|
|
1731
1744
|
callbacks.push(found);
|
|
@@ -1849,7 +1862,7 @@ var Callback = class extends Operation {
|
|
|
1849
1862
|
let parameters = (_optionalChain([this, 'access', _129 => _129.schema, 'optionalAccess', _130 => _130.parameters]) || []).map((p) => {
|
|
1850
1863
|
let param = p;
|
|
1851
1864
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1852
|
-
param =
|
|
1865
|
+
param = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, param, this.api);
|
|
1853
1866
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1854
1867
|
}
|
|
1855
1868
|
return param;
|
|
@@ -1857,7 +1870,7 @@ var Callback = class extends Operation {
|
|
|
1857
1870
|
const commonParams = (this.parentSchema.parameters || []).map((p) => {
|
|
1858
1871
|
let param = p;
|
|
1859
1872
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, param)) {
|
|
1860
|
-
param =
|
|
1873
|
+
param = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, param, this.api);
|
|
1861
1874
|
if (!param || _chunk7PWF3F2Wcjs.isRef.call(void 0, param)) return;
|
|
1862
1875
|
}
|
|
1863
1876
|
return param;
|
|
@@ -1883,7 +1896,7 @@ var Webhook = class extends Operation {
|
|
|
1883
1896
|
}
|
|
1884
1897
|
let webhookPath = this.api.webhooks[this.path];
|
|
1885
1898
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1886
|
-
this.api.webhooks[this.path] =
|
|
1899
|
+
this.api.webhooks[this.path] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1887
1900
|
webhookPath = this.api.webhooks[this.path];
|
|
1888
1901
|
}
|
|
1889
1902
|
return _optionalChain([webhookPath, 'optionalAccess', _133 => _133.summary]);
|
|
@@ -1902,7 +1915,7 @@ var Webhook = class extends Operation {
|
|
|
1902
1915
|
}
|
|
1903
1916
|
let webhookPath = this.api.webhooks[this.path];
|
|
1904
1917
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
1905
|
-
this.api.webhooks[this.path] =
|
|
1918
|
+
this.api.webhooks[this.path] = _chunk6GTPCWO5cjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1906
1919
|
webhookPath = this.api.webhooks[this.path];
|
|
1907
1920
|
}
|
|
1908
1921
|
return _optionalChain([webhookPath, 'optionalAccess', _136 => _136.description]);
|
|
@@ -1923,7 +1936,8 @@ var Webhook = class extends Operation {
|
|
|
1923
1936
|
|
|
1924
1937
|
|
|
1925
1938
|
|
|
1926
|
-
|
|
1939
|
+
|
|
1940
|
+
exports.getUserVariable = getUserVariable; exports.stripTrailingSlash = stripTrailingSlash; exports.escapeRegExp = escapeRegExp; exports.normalizeURL = normalizeURL; 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;
|
|
1927
1941
|
/**
|
|
1928
1942
|
* Portions of this file have been extracted and modified from Swagger UI.
|
|
1929
1943
|
*
|
|
@@ -1936,4 +1950,4 @@ exports.getUserVariable = getUserVariable; exports.stripTrailingSlash = stripTra
|
|
|
1936
1950
|
* @license Apache-2.0
|
|
1937
1951
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1938
1952
|
*/
|
|
1939
|
-
//# sourceMappingURL=chunk-
|
|
1953
|
+
//# sourceMappingURL=chunk-2F2OPV5M.cjs.map
|