oas 32.0.0 → 32.1.1
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 +5 -5
- package/dist/analyzer/index.cjs.map +1 -1
- package/dist/analyzer/index.js +3 -3
- package/dist/{chunk-7RDMAMMI.cjs → chunk-5CNCBRXS.cjs} +7 -2
- package/dist/chunk-5CNCBRXS.cjs.map +1 -0
- package/dist/{chunk-ORCSXEZP.js → chunk-6XFZCLQN.js} +56 -19
- package/dist/chunk-6XFZCLQN.js.map +1 -0
- package/dist/{chunk-7H5IXVWY.cjs → chunk-AGIMYOPQ.cjs} +19 -19
- package/dist/{chunk-7H5IXVWY.cjs.map → chunk-AGIMYOPQ.cjs.map} +1 -1
- package/dist/{chunk-AQUZF2EA.cjs → chunk-IJNLIFFG.cjs} +111 -74
- package/dist/chunk-IJNLIFFG.cjs.map +1 -0
- package/dist/{chunk-HYH37HS2.js → chunk-J3RVB7UI.js} +7 -2
- package/dist/chunk-J3RVB7UI.js.map +1 -0
- package/dist/{chunk-4JRU2N6C.js → chunk-TJG7YHRD.js} +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +3 -3
- 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 +2 -2
- package/dist/chunk-7RDMAMMI.cjs.map +0 -1
- package/dist/chunk-AQUZF2EA.cjs.map +0 -1
- package/dist/chunk-HYH37HS2.js.map +0 -1
- package/dist/chunk-ORCSXEZP.js.map +0 -1
- /package/dist/{chunk-4JRU2N6C.js.map → chunk-TJG7YHRD.js.map} +0 -0
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk5CNCBRXScjs = require('./chunk-5CNCBRXS.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkAYA3UT4Lcjs = require('./chunk-AYA3UT4L.cjs');
|
|
@@ -54,7 +54,7 @@ function usesPolymorphism(schema) {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
function objectify(thing) {
|
|
57
|
-
if (!
|
|
57
|
+
if (!_chunk5CNCBRXScjs.isObject.call(void 0, thing)) {
|
|
58
58
|
return {};
|
|
59
59
|
}
|
|
60
60
|
return thing;
|
|
@@ -125,27 +125,51 @@ var primitive = (schema) => {
|
|
|
125
125
|
return `Unknown Type: ${objectifiedSchema.type}`;
|
|
126
126
|
};
|
|
127
127
|
function sampleFromSchema(schema, opts = {}) {
|
|
128
|
-
const
|
|
129
|
-
let
|
|
130
|
-
|
|
128
|
+
const seenRefs = opts.seenRefs || /* @__PURE__ */ new Set();
|
|
129
|
+
let objectifySchema = objectify(schema);
|
|
130
|
+
let refToRelease;
|
|
131
|
+
if (opts.definition && _chunkYPR7YTHMcjs.isRef.call(void 0, objectifySchema)) {
|
|
132
|
+
refToRelease = objectifySchema.$ref;
|
|
133
|
+
if (seenRefs.has(refToRelease)) {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
objectifySchema = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, objectifySchema, opts.definition, seenRefs);
|
|
137
|
+
if (!objectifySchema || _chunkYPR7YTHMcjs.isRef.call(void 0, objectifySchema)) {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
return sampleFromResolvedSchema(objectifySchema, opts, seenRefs);
|
|
143
|
+
} finally {
|
|
144
|
+
if (refToRelease) {
|
|
145
|
+
seenRefs.delete(refToRelease);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function sampleFromResolvedSchema(schema, opts, seenRefs) {
|
|
150
|
+
let { type } = schema;
|
|
151
|
+
const hasPolymorphism = usesPolymorphism(schema);
|
|
131
152
|
if (hasPolymorphism === "allOf") {
|
|
132
153
|
try {
|
|
133
154
|
return sampleFromSchema(
|
|
134
|
-
_jsonschemamergeallof2.default.call(void 0,
|
|
155
|
+
_jsonschemamergeallof2.default.call(void 0, schema, {
|
|
135
156
|
resolvers: {
|
|
136
157
|
// Ignore any unrecognized OAS-specific keywords that might be present on the schema
|
|
137
158
|
// (like `xml`).
|
|
138
159
|
defaultResolver: _jsonschemamergeallof2.default.options.resolvers.title
|
|
139
160
|
}
|
|
140
161
|
}),
|
|
141
|
-
|
|
162
|
+
{
|
|
163
|
+
...opts,
|
|
164
|
+
seenRefs
|
|
165
|
+
}
|
|
142
166
|
);
|
|
143
167
|
} catch (e) {
|
|
144
168
|
return void 0;
|
|
145
169
|
}
|
|
146
170
|
} else if (hasPolymorphism) {
|
|
147
|
-
const samples =
|
|
148
|
-
return sampleFromSchema(s, opts);
|
|
171
|
+
const samples = schema[hasPolymorphism].map((s) => {
|
|
172
|
+
return sampleFromSchema(s, { ...opts, seenRefs });
|
|
149
173
|
});
|
|
150
174
|
if (samples.length === 1) {
|
|
151
175
|
return samples[0];
|
|
@@ -154,7 +178,7 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
154
178
|
}
|
|
155
179
|
return samples[0];
|
|
156
180
|
}
|
|
157
|
-
const { example, additionalProperties, properties, items } =
|
|
181
|
+
const { example, additionalProperties, properties, items } = schema;
|
|
158
182
|
const { includeReadOnly, includeWriteOnly } = opts;
|
|
159
183
|
if (example !== void 0) {
|
|
160
184
|
return deeplyStripKey(example, "$$ref", (val) => {
|
|
@@ -187,13 +211,13 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
187
211
|
obj[name] = props[name].examples[0];
|
|
188
212
|
continue;
|
|
189
213
|
}
|
|
190
|
-
obj[name] = sampleFromSchema(props[name], opts);
|
|
214
|
+
obj[name] = sampleFromSchema(props[name], { ...opts, seenRefs });
|
|
191
215
|
}
|
|
192
216
|
if (additionalProperties === true) {
|
|
193
217
|
obj.additionalProp = {};
|
|
194
218
|
} else if (additionalProperties) {
|
|
195
219
|
const additionalProps = objectify(additionalProperties);
|
|
196
|
-
const additionalPropVal = sampleFromSchema(additionalProps, opts);
|
|
220
|
+
const additionalPropVal = sampleFromSchema(additionalProps, { ...opts, seenRefs });
|
|
197
221
|
obj.additionalProp = additionalPropVal;
|
|
198
222
|
}
|
|
199
223
|
return obj;
|
|
@@ -203,12 +227,22 @@ function sampleFromSchema(schema, opts = {}) {
|
|
|
203
227
|
return [];
|
|
204
228
|
}
|
|
205
229
|
if (Array.isArray(items.anyOf)) {
|
|
206
|
-
return items.anyOf.map(
|
|
230
|
+
return items.anyOf.map(
|
|
231
|
+
(i) => sampleFromSchema(i, {
|
|
232
|
+
...opts,
|
|
233
|
+
seenRefs
|
|
234
|
+
})
|
|
235
|
+
);
|
|
207
236
|
}
|
|
208
237
|
if (Array.isArray(items.oneOf)) {
|
|
209
|
-
return items.oneOf.map(
|
|
238
|
+
return items.oneOf.map(
|
|
239
|
+
(i) => sampleFromSchema(i, {
|
|
240
|
+
...opts,
|
|
241
|
+
seenRefs
|
|
242
|
+
})
|
|
243
|
+
);
|
|
210
244
|
}
|
|
211
|
-
return [sampleFromSchema(items, opts)];
|
|
245
|
+
return [sampleFromSchema(items, { ...opts, seenRefs })];
|
|
212
246
|
}
|
|
213
247
|
if (schema.enum) {
|
|
214
248
|
if (schema.default) {
|
|
@@ -225,7 +259,7 @@ var memo = _memoizee2.default.call(void 0, sampleFromSchema);
|
|
|
225
259
|
var samples_default = memo;
|
|
226
260
|
|
|
227
261
|
// src/operation/lib/get-mediatype-examples.ts
|
|
228
|
-
function getMediaTypeExamples(mediaType, mediaTypeObject, opts = {}) {
|
|
262
|
+
function getMediaTypeExamples(mediaType, mediaTypeObject, definition, opts = {}) {
|
|
229
263
|
if (mediaTypeObject.example) {
|
|
230
264
|
return [
|
|
231
265
|
{
|
|
@@ -263,10 +297,13 @@ function getMediaTypeExamples(mediaType, mediaTypeObject, opts = {}) {
|
|
|
263
297
|
}
|
|
264
298
|
}
|
|
265
299
|
if (mediaTypeObject.schema) {
|
|
266
|
-
if (!
|
|
300
|
+
if (!_chunk5CNCBRXScjs.matches_mimetype_default.xml(mediaType)) {
|
|
267
301
|
return [
|
|
268
302
|
{
|
|
269
|
-
value: samples_default(
|
|
303
|
+
value: samples_default(structuredClone(mediaTypeObject.schema), {
|
|
304
|
+
...opts,
|
|
305
|
+
definition
|
|
306
|
+
})
|
|
270
307
|
}
|
|
271
308
|
];
|
|
272
309
|
}
|
|
@@ -281,7 +318,7 @@ function getResponseExamples(operation, definition) {
|
|
|
281
318
|
let onlyHeaders = false;
|
|
282
319
|
if (!response) return false;
|
|
283
320
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
284
|
-
response =
|
|
321
|
+
response = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, response, definition);
|
|
285
322
|
if (!response || _chunkYPR7YTHMcjs.isRef.call(void 0, response)) return false;
|
|
286
323
|
}
|
|
287
324
|
const mediaTypes = {};
|
|
@@ -289,7 +326,7 @@ function getResponseExamples(operation, definition) {
|
|
|
289
326
|
if (!mediaType) return;
|
|
290
327
|
const mediaTypeObject = _optionalChain([response, 'access', _14 => _14.content, 'optionalAccess', _15 => _15[mediaType]]);
|
|
291
328
|
if (!mediaTypeObject) return;
|
|
292
|
-
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {
|
|
329
|
+
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, definition, {
|
|
293
330
|
includeReadOnly: true,
|
|
294
331
|
includeWriteOnly: false
|
|
295
332
|
});
|
|
@@ -321,14 +358,14 @@ function getCallbackExamples(operation, definition) {
|
|
|
321
358
|
let callback = _optionalChain([operation, 'access', _16 => _16.callbacks, 'optionalAccess', _17 => _17[identifier]]);
|
|
322
359
|
if (!callback) return [];
|
|
323
360
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, callback)) {
|
|
324
|
-
callback =
|
|
361
|
+
callback = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, callback, definition);
|
|
325
362
|
if (!callback || _chunkYPR7YTHMcjs.isRef.call(void 0, callback)) return [];
|
|
326
363
|
}
|
|
327
364
|
const items = Object.keys(callback).map((expression) => {
|
|
328
365
|
let callbackPath = callback[expression];
|
|
329
366
|
if (!callbackPath) return [];
|
|
330
367
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, callbackPath)) {
|
|
331
|
-
callbackPath =
|
|
368
|
+
callbackPath = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, callbackPath, definition);
|
|
332
369
|
if (!callbackPath || _chunkYPR7YTHMcjs.isRef.call(void 0, callbackPath)) return [];
|
|
333
370
|
}
|
|
334
371
|
return Object.keys(callbackPath).map((method) => {
|
|
@@ -411,7 +448,7 @@ function getExampleGroups(operation) {
|
|
|
411
448
|
Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]) => {
|
|
412
449
|
let example = paramExample;
|
|
413
450
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, example)) {
|
|
414
|
-
example =
|
|
451
|
+
example = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, example, operation.api);
|
|
415
452
|
if (!example || _chunkYPR7YTHMcjs.isRef.call(void 0, example)) return;
|
|
416
453
|
}
|
|
417
454
|
groups[exampleKey] = {
|
|
@@ -459,14 +496,14 @@ function getRequestBodyExamples(operation, definition) {
|
|
|
459
496
|
if (!requestBody) {
|
|
460
497
|
return [];
|
|
461
498
|
} else if (_chunkYPR7YTHMcjs.isRef.call(void 0, requestBody)) {
|
|
462
|
-
requestBody =
|
|
499
|
+
requestBody = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, requestBody, definition);
|
|
463
500
|
}
|
|
464
501
|
if (!requestBody || _chunkYPR7YTHMcjs.isRef.call(void 0, requestBody) || !requestBody.content) {
|
|
465
502
|
return [];
|
|
466
503
|
}
|
|
467
504
|
return Object.keys(requestBody.content || {}).map((mediaType) => {
|
|
468
505
|
const mediaTypeObject = requestBody.content[mediaType];
|
|
469
|
-
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {
|
|
506
|
+
const examples = getMediaTypeExamples(mediaType, mediaTypeObject, definition, {
|
|
470
507
|
includeReadOnly: false,
|
|
471
508
|
includeWriteOnly: true
|
|
472
509
|
});
|
|
@@ -524,7 +561,7 @@ function getOperationId(path, method, operation, opts = {}) {
|
|
|
524
561
|
}
|
|
525
562
|
|
|
526
563
|
// src/operation/transformers/get-response-as-json-schema.ts
|
|
527
|
-
var isJSON =
|
|
564
|
+
var isJSON = _chunk5CNCBRXScjs.matches_mimetype_default.json;
|
|
528
565
|
function buildHeadersSchema(response, schemaOptions) {
|
|
529
566
|
const headersSchema = {
|
|
530
567
|
type: "object",
|
|
@@ -540,7 +577,7 @@ function buildHeadersSchema(response, schemaOptions) {
|
|
|
540
577
|
if (!header.schema || _chunkYPR7YTHMcjs.isRef.call(void 0, header.schema)) {
|
|
541
578
|
return;
|
|
542
579
|
}
|
|
543
|
-
headersSchema.properties[key] =
|
|
580
|
+
headersSchema.properties[key] = _chunk5CNCBRXScjs.toJSONSchema.call(void 0, header.schema, {
|
|
544
581
|
addEnumsToDescriptions: true,
|
|
545
582
|
...schemaOptions
|
|
546
583
|
});
|
|
@@ -594,32 +631,32 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
594
631
|
}
|
|
595
632
|
if (preferredContentType) {
|
|
596
633
|
if (contentTypes.includes(preferredContentType)) {
|
|
597
|
-
const schema2 =
|
|
634
|
+
const schema2 = _chunk5CNCBRXScjs.cloneObject.call(void 0, content[preferredContentType].schema);
|
|
598
635
|
if (!schema2) {
|
|
599
636
|
return null;
|
|
600
637
|
}
|
|
601
|
-
return
|
|
638
|
+
return _chunk5CNCBRXScjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
602
639
|
}
|
|
603
640
|
return null;
|
|
604
641
|
}
|
|
605
642
|
for (let i = 0; i < contentTypes.length; i++) {
|
|
606
643
|
if (isJSON(contentTypes[i])) {
|
|
607
|
-
const schema2 =
|
|
644
|
+
const schema2 = _chunk5CNCBRXScjs.cloneObject.call(void 0, content[contentTypes[i]].schema);
|
|
608
645
|
if (!schema2) {
|
|
609
646
|
return {};
|
|
610
647
|
}
|
|
611
|
-
return
|
|
648
|
+
return _chunk5CNCBRXScjs.toJSONSchema.call(void 0, schema2, baseSchemaOptions);
|
|
612
649
|
}
|
|
613
650
|
}
|
|
614
651
|
const contentType = contentTypes.shift();
|
|
615
652
|
if (!contentType) {
|
|
616
653
|
return {};
|
|
617
654
|
}
|
|
618
|
-
const schema =
|
|
655
|
+
const schema = _chunk5CNCBRXScjs.cloneObject.call(void 0, content[contentType].schema);
|
|
619
656
|
if (!schema) {
|
|
620
657
|
return {};
|
|
621
658
|
}
|
|
622
|
-
return
|
|
659
|
+
return _chunk5CNCBRXScjs.toJSONSchema.call(void 0, schema, baseSchemaOptions);
|
|
623
660
|
}
|
|
624
661
|
const foundSchema = getPreferredSchema(response.content, _optionalChain([opts, 'optionalAccess', _48 => _48.contentType]));
|
|
625
662
|
if (_optionalChain([opts, 'optionalAccess', _49 => _49.contentType]) && !foundSchema) {
|
|
@@ -638,23 +675,23 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
638
675
|
// able to render so instead of generating a JSON Schema with an `undefined` type we should
|
|
639
676
|
// default to `string` so there's at least *something* the end-user can interact with.
|
|
640
677
|
type: _nullishCoalesce(schemaType, () => ( "string")),
|
|
641
|
-
schema:
|
|
678
|
+
schema: _chunk5CNCBRXScjs.isPrimitive.call(void 0, schema) ? schema : {
|
|
642
679
|
...schema,
|
|
643
|
-
$schema:
|
|
680
|
+
$schema: _chunk5CNCBRXScjs.getSchemaVersionString.call(void 0, schema, api)
|
|
644
681
|
},
|
|
645
682
|
label: "Response body"
|
|
646
683
|
};
|
|
647
684
|
if (response.description && schemaWrapper.schema) {
|
|
648
685
|
schemaWrapper.description = response.description;
|
|
649
686
|
}
|
|
650
|
-
|
|
687
|
+
_chunk5CNCBRXScjs.applyDiscriminatorOneOfToUsedSchemas.call(void 0, api, usedSchemas, (ref) => {
|
|
651
688
|
if (usedSchemas.has(ref)) {
|
|
652
689
|
return usedSchemas.get(ref);
|
|
653
690
|
}
|
|
654
691
|
try {
|
|
655
|
-
const resolved =
|
|
692
|
+
const resolved = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, { $ref: ref }, api, seenRefs);
|
|
656
693
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, resolved)) return void 0;
|
|
657
|
-
const converted =
|
|
694
|
+
const converted = _chunk5CNCBRXScjs.toJSONSchema.call(void 0, structuredClone(resolved), {
|
|
658
695
|
...baseSchemaOptions,
|
|
659
696
|
seenRefs
|
|
660
697
|
});
|
|
@@ -666,9 +703,9 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
666
703
|
});
|
|
667
704
|
if (schemaWrapper.schema && usedSchemas.size > 0) {
|
|
668
705
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("body"), () => ( /* @__PURE__ */ new Set()));
|
|
669
|
-
const referencedSchemas =
|
|
706
|
+
const referencedSchemas = _chunk5CNCBRXScjs.filterRequiredRefsToReferenced.call(void 0, refsInGroup, usedSchemas);
|
|
670
707
|
if (referencedSchemas.size > 0) {
|
|
671
|
-
|
|
708
|
+
_chunk5CNCBRXScjs.mergeReferencedSchemasIntoRoot.call(void 0, schemaWrapper.schema, referencedSchemas);
|
|
672
709
|
}
|
|
673
710
|
}
|
|
674
711
|
jsonSchema.push(schemaWrapper);
|
|
@@ -680,9 +717,9 @@ function getResponseAsJSONSchema(operation, api, statusCode, opts) {
|
|
|
680
717
|
});
|
|
681
718
|
if (headersWrapper.schema && usedSchemas.size > 0) {
|
|
682
719
|
const refsInGroup = _nullishCoalesce(refsByGroup.get("headers"), () => ( /* @__PURE__ */ new Set()));
|
|
683
|
-
const referencedSchemas =
|
|
720
|
+
const referencedSchemas = _chunk5CNCBRXScjs.filterRequiredRefsToReferenced.call(void 0, refsInGroup, usedSchemas);
|
|
684
721
|
if (referencedSchemas.size > 0) {
|
|
685
|
-
|
|
722
|
+
_chunk5CNCBRXScjs.mergeReferencedSchemasIntoRoot.call(void 0, headersWrapper.schema, referencedSchemas);
|
|
686
723
|
}
|
|
687
724
|
}
|
|
688
725
|
jsonSchema.push(headersWrapper);
|
|
@@ -822,7 +859,7 @@ var Operation = (_class = class {
|
|
|
822
859
|
let types = [];
|
|
823
860
|
if (this.schema.requestBody) {
|
|
824
861
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, this.schema.requestBody)) {
|
|
825
|
-
this.schema.requestBody =
|
|
862
|
+
this.schema.requestBody = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, this.schema.requestBody, this.api);
|
|
826
863
|
}
|
|
827
864
|
if (this.schema.requestBody && "content" in this.schema.requestBody) {
|
|
828
865
|
types = Object.keys(this.schema.requestBody.content);
|
|
@@ -833,7 +870,7 @@ var Operation = (_class = class {
|
|
|
833
870
|
this.contentType = types[0];
|
|
834
871
|
}
|
|
835
872
|
types.forEach((t) => {
|
|
836
|
-
if (
|
|
873
|
+
if (_chunk5CNCBRXScjs.matches_mimetype_default.json(t)) {
|
|
837
874
|
this.contentType = t;
|
|
838
875
|
}
|
|
839
876
|
});
|
|
@@ -846,7 +883,7 @@ var Operation = (_class = class {
|
|
|
846
883
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
847
884
|
*/
|
|
848
885
|
isFormUrlEncoded() {
|
|
849
|
-
return
|
|
886
|
+
return _chunk5CNCBRXScjs.matches_mimetype_default.formUrlEncoded(this.getContentType());
|
|
850
887
|
}
|
|
851
888
|
/**
|
|
852
889
|
* Checks if the current operation has a mutipart content type payload.
|
|
@@ -855,7 +892,7 @@ var Operation = (_class = class {
|
|
|
855
892
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
856
893
|
*/
|
|
857
894
|
isMultipart() {
|
|
858
|
-
return
|
|
895
|
+
return _chunk5CNCBRXScjs.matches_mimetype_default.multipart(this.getContentType());
|
|
859
896
|
}
|
|
860
897
|
/**
|
|
861
898
|
* Checks if the current operation has a JSON-like content type payload.
|
|
@@ -864,7 +901,7 @@ var Operation = (_class = class {
|
|
|
864
901
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
865
902
|
*/
|
|
866
903
|
isJson() {
|
|
867
|
-
return
|
|
904
|
+
return _chunk5CNCBRXScjs.matches_mimetype_default.json(this.getContentType());
|
|
868
905
|
}
|
|
869
906
|
/**
|
|
870
907
|
* Checks if the current operation has an XML content type payload.
|
|
@@ -873,7 +910,7 @@ var Operation = (_class = class {
|
|
|
873
910
|
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md#user-content-request-body-content}
|
|
874
911
|
*/
|
|
875
912
|
isXml() {
|
|
876
|
-
return
|
|
913
|
+
return _chunk5CNCBRXScjs.matches_mimetype_default.xml(this.getContentType());
|
|
877
914
|
}
|
|
878
915
|
/**
|
|
879
916
|
* Checks if the current operation is a webhook or not.
|
|
@@ -921,7 +958,7 @@ var Operation = (_class = class {
|
|
|
921
958
|
security = _optionalChain([this, 'access', _66 => _66.api, 'optionalAccess', _67 => _67.components, 'optionalAccess', _68 => _68.securitySchemes, 'optionalAccess', _69 => _69[key]]);
|
|
922
959
|
if (!security) return false;
|
|
923
960
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, security)) {
|
|
924
|
-
security =
|
|
961
|
+
security = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, security, this.api);
|
|
925
962
|
if (!security || _chunkYPR7YTHMcjs.isRef.call(void 0, security)) return false;
|
|
926
963
|
}
|
|
927
964
|
} catch (e4) {
|
|
@@ -1002,7 +1039,7 @@ var Operation = (_class = class {
|
|
|
1002
1039
|
this.schema.parameters.map((p) => {
|
|
1003
1040
|
let param = p;
|
|
1004
1041
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, param)) {
|
|
1005
|
-
param =
|
|
1042
|
+
param = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, param, this.api);
|
|
1006
1043
|
if (!param || _chunkYPR7YTHMcjs.isRef.call(void 0, param)) return void 0;
|
|
1007
1044
|
}
|
|
1008
1045
|
if (param.in && param.in === "header") return param.name;
|
|
@@ -1015,7 +1052,7 @@ var Operation = (_class = class {
|
|
|
1015
1052
|
let response = this.schema.responses[r];
|
|
1016
1053
|
if (!response) return [];
|
|
1017
1054
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1018
|
-
this.schema.responses[r] =
|
|
1055
|
+
this.schema.responses[r] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, response, this.api);
|
|
1019
1056
|
response = this.schema.responses[r];
|
|
1020
1057
|
if (!response || _chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1021
1058
|
return [];
|
|
@@ -1028,7 +1065,7 @@ var Operation = (_class = class {
|
|
|
1028
1065
|
let requestBody = this.schema.requestBody;
|
|
1029
1066
|
if (requestBody) {
|
|
1030
1067
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, requestBody)) {
|
|
1031
|
-
this.schema.requestBody =
|
|
1068
|
+
this.schema.requestBody = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1032
1069
|
requestBody = this.schema.requestBody;
|
|
1033
1070
|
}
|
|
1034
1071
|
if (requestBody && !_chunkYPR7YTHMcjs.isRef.call(void 0, requestBody) && "content" in requestBody && Object.keys(requestBody.content)) {
|
|
@@ -1041,7 +1078,7 @@ var Operation = (_class = class {
|
|
|
1041
1078
|
let response = _optionalChain([this, 'access', _73 => _73.schema, 'access', _74 => _74.responses, 'optionalAccess', _75 => _75[r]]);
|
|
1042
1079
|
if (!response) return false;
|
|
1043
1080
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1044
|
-
this.schema.responses[r] =
|
|
1081
|
+
this.schema.responses[r] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, response, this.api);
|
|
1045
1082
|
response = this.schema.responses[r];
|
|
1046
1083
|
if (!response || _chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1047
1084
|
return false;
|
|
@@ -1151,7 +1188,7 @@ var Operation = (_class = class {
|
|
|
1151
1188
|
let parameters = (_optionalChain([this, 'access', _78 => _78.schema, 'optionalAccess', _79 => _79.parameters]) || []).map((p) => {
|
|
1152
1189
|
let param = p;
|
|
1153
1190
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, param)) {
|
|
1154
|
-
param =
|
|
1191
|
+
param = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, param, this.api);
|
|
1155
1192
|
if (!param || _chunkYPR7YTHMcjs.isRef.call(void 0, param)) return void 0;
|
|
1156
1193
|
}
|
|
1157
1194
|
return param;
|
|
@@ -1159,7 +1196,7 @@ var Operation = (_class = class {
|
|
|
1159
1196
|
const commonParams = (_optionalChain([this, 'access', _80 => _80.api, 'optionalAccess', _81 => _81.paths, 'optionalAccess', _82 => _82[this.path], 'optionalAccess', _83 => _83.parameters]) || []).map((p) => {
|
|
1160
1197
|
let param = p;
|
|
1161
1198
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, param)) {
|
|
1162
|
-
param =
|
|
1199
|
+
param = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, param, this.api);
|
|
1163
1200
|
if (!param || _chunkYPR7YTHMcjs.isRef.call(void 0, param)) return void 0;
|
|
1164
1201
|
}
|
|
1165
1202
|
return param;
|
|
@@ -1197,10 +1234,10 @@ var Operation = (_class = class {
|
|
|
1197
1234
|
);
|
|
1198
1235
|
}
|
|
1199
1236
|
if (!this.schemasDecorated) {
|
|
1200
|
-
|
|
1237
|
+
_chunk5CNCBRXScjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1201
1238
|
this.schemasDecorated = true;
|
|
1202
1239
|
}
|
|
1203
|
-
return
|
|
1240
|
+
return _chunk5CNCBRXScjs.getParametersAsJSONSchema.call(void 0, this, this.api, {
|
|
1204
1241
|
includeDiscriminatorMappingRefs: true,
|
|
1205
1242
|
...opts
|
|
1206
1243
|
});
|
|
@@ -1225,7 +1262,7 @@ var Operation = (_class = class {
|
|
|
1225
1262
|
);
|
|
1226
1263
|
}
|
|
1227
1264
|
if (!this.schemasDecorated) {
|
|
1228
|
-
|
|
1265
|
+
_chunk5CNCBRXScjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1229
1266
|
this.schemasDecorated = true;
|
|
1230
1267
|
}
|
|
1231
1268
|
return getResponseAsJSONSchema(this, this.api, statusCode, {
|
|
@@ -1253,7 +1290,7 @@ var Operation = (_class = class {
|
|
|
1253
1290
|
let resp = response;
|
|
1254
1291
|
if (!resp) return;
|
|
1255
1292
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, resp)) {
|
|
1256
|
-
resp =
|
|
1293
|
+
resp = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, resp, this.api);
|
|
1257
1294
|
if (!resp || _chunkYPR7YTHMcjs.isRef.call(void 0, resp)) {
|
|
1258
1295
|
return;
|
|
1259
1296
|
}
|
|
@@ -1282,7 +1319,7 @@ var Operation = (_class = class {
|
|
|
1282
1319
|
let requestBody = this.schema.requestBody;
|
|
1283
1320
|
if (!requestBody) return false;
|
|
1284
1321
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, requestBody)) {
|
|
1285
|
-
this.schema.requestBody =
|
|
1322
|
+
this.schema.requestBody = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, requestBody, this.api);
|
|
1286
1323
|
requestBody = this.schema.requestBody;
|
|
1287
1324
|
if (!requestBody || _chunkYPR7YTHMcjs.isRef.call(void 0, requestBody)) {
|
|
1288
1325
|
return false;
|
|
@@ -1352,7 +1389,7 @@ var Operation = (_class = class {
|
|
|
1352
1389
|
let availableMediaType;
|
|
1353
1390
|
const mediaTypes = this.getRequestBodyMediaTypes();
|
|
1354
1391
|
mediaTypes.forEach((mt) => {
|
|
1355
|
-
if (!availableMediaType &&
|
|
1392
|
+
if (!availableMediaType && _chunk5CNCBRXScjs.matches_mimetype_default.json(mt)) {
|
|
1356
1393
|
availableMediaType = mt;
|
|
1357
1394
|
}
|
|
1358
1395
|
});
|
|
@@ -1400,7 +1437,7 @@ var Operation = (_class = class {
|
|
|
1400
1437
|
let response = this.schema.responses[statusCode];
|
|
1401
1438
|
if (!response) return false;
|
|
1402
1439
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1403
|
-
this.schema.responses[statusCode] =
|
|
1440
|
+
this.schema.responses[statusCode] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, response, this.api);
|
|
1404
1441
|
response = this.schema.responses[statusCode];
|
|
1405
1442
|
if (!response || _chunkYPR7YTHMcjs.isRef.call(void 0, response)) {
|
|
1406
1443
|
return false;
|
|
@@ -1444,7 +1481,7 @@ var Operation = (_class = class {
|
|
|
1444
1481
|
let callbackObj = this.schema.callbacks[identifier];
|
|
1445
1482
|
if (!callbackObj) return false;
|
|
1446
1483
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, callbackObj)) {
|
|
1447
|
-
this.schema.callbacks[identifier] =
|
|
1484
|
+
this.schema.callbacks[identifier] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, callbackObj, this.api);
|
|
1448
1485
|
callbackObj = this.schema.callbacks[identifier];
|
|
1449
1486
|
if (!callbackObj || _chunkYPR7YTHMcjs.isRef.call(void 0, callbackObj)) {
|
|
1450
1487
|
return false;
|
|
@@ -1453,7 +1490,7 @@ var Operation = (_class = class {
|
|
|
1453
1490
|
let callback = callbackObj[expression];
|
|
1454
1491
|
if (!callback) return false;
|
|
1455
1492
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, callback)) {
|
|
1456
|
-
callbackObj[expression] =
|
|
1493
|
+
callbackObj[expression] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, callback, this.api);
|
|
1457
1494
|
callback = callbackObj[expression];
|
|
1458
1495
|
if (!callback || _chunkYPR7YTHMcjs.isRef.call(void 0, callback)) {
|
|
1459
1496
|
return false;
|
|
@@ -1477,7 +1514,7 @@ var Operation = (_class = class {
|
|
|
1477
1514
|
let cb = _optionalChain([this, 'access', _89 => _89.schema, 'access', _90 => _90.callbacks, 'optionalAccess', _91 => _91[callback]]);
|
|
1478
1515
|
if (!cb) return;
|
|
1479
1516
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, cb)) {
|
|
1480
|
-
this.schema.callbacks[callback] =
|
|
1517
|
+
this.schema.callbacks[callback] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, cb, this.api);
|
|
1481
1518
|
cb = this.schema.callbacks[callback];
|
|
1482
1519
|
if (!cb || _chunkYPR7YTHMcjs.isRef.call(void 0, cb)) {
|
|
1483
1520
|
return;
|
|
@@ -1487,14 +1524,14 @@ var Operation = (_class = class {
|
|
|
1487
1524
|
let callbackPath = cb[expression];
|
|
1488
1525
|
if (!callbackPath) return;
|
|
1489
1526
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, callbackPath)) {
|
|
1490
|
-
cb[expression] =
|
|
1527
|
+
cb[expression] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, callbackPath, this.api);
|
|
1491
1528
|
callbackPath = cb[expression];
|
|
1492
1529
|
if (!callbackPath || _chunkYPR7YTHMcjs.isRef.call(void 0, callbackPath)) {
|
|
1493
1530
|
return;
|
|
1494
1531
|
}
|
|
1495
1532
|
}
|
|
1496
1533
|
Object.keys(callbackPath).forEach((method) => {
|
|
1497
|
-
if (!
|
|
1534
|
+
if (!_chunk5CNCBRXScjs.supportedMethods.includes(method)) return;
|
|
1498
1535
|
const found = this.getCallback(callback, expression, method);
|
|
1499
1536
|
if (found) {
|
|
1500
1537
|
callbacks.push(found);
|
|
@@ -1572,12 +1609,12 @@ var Operation = (_class = class {
|
|
|
1572
1609
|
}
|
|
1573
1610
|
this.dereferencing.processing = true;
|
|
1574
1611
|
if (!this.schemasDecorated) {
|
|
1575
|
-
|
|
1612
|
+
_chunk5CNCBRXScjs.decorateComponentSchemasWithRefName.call(void 0, this.api);
|
|
1576
1613
|
this.schemasDecorated = true;
|
|
1577
1614
|
}
|
|
1578
1615
|
const { api, schema, promises } = this;
|
|
1579
1616
|
const circularRefs = /* @__PURE__ */ new Set();
|
|
1580
|
-
const dereferencingOptions =
|
|
1617
|
+
const dereferencingOptions = _chunk5CNCBRXScjs.getDereferencingOptions.call(void 0, circularRefs);
|
|
1581
1618
|
const parser = new (0, _jsonschemarefparser.$RefParser)();
|
|
1582
1619
|
return parser.dereference(
|
|
1583
1620
|
"#/__INTERNAL__",
|
|
@@ -1719,7 +1756,7 @@ var Callback = class extends Operation {
|
|
|
1719
1756
|
let parameters = (_optionalChain([this, 'access', _99 => _99.schema, 'optionalAccess', _100 => _100.parameters]) || []).map((p) => {
|
|
1720
1757
|
let param = p;
|
|
1721
1758
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, param)) {
|
|
1722
|
-
param =
|
|
1759
|
+
param = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, param, this.api);
|
|
1723
1760
|
if (!param || _chunkYPR7YTHMcjs.isRef.call(void 0, param)) return void 0;
|
|
1724
1761
|
}
|
|
1725
1762
|
return param;
|
|
@@ -1727,7 +1764,7 @@ var Callback = class extends Operation {
|
|
|
1727
1764
|
const commonParams = (this.parentSchema.parameters || []).map((p) => {
|
|
1728
1765
|
let param = p;
|
|
1729
1766
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, param)) {
|
|
1730
|
-
param =
|
|
1767
|
+
param = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, param, this.api);
|
|
1731
1768
|
if (!param || _chunkYPR7YTHMcjs.isRef.call(void 0, param)) return void 0;
|
|
1732
1769
|
}
|
|
1733
1770
|
return param;
|
|
@@ -1753,7 +1790,7 @@ var Webhook = class extends Operation {
|
|
|
1753
1790
|
}
|
|
1754
1791
|
let webhookPath = this.api.webhooks[this.path];
|
|
1755
1792
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, webhookPath)) {
|
|
1756
|
-
this.api.webhooks[this.path] =
|
|
1793
|
+
this.api.webhooks[this.path] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1757
1794
|
webhookPath = this.api.webhooks[this.path];
|
|
1758
1795
|
}
|
|
1759
1796
|
return _optionalChain([webhookPath, 'optionalAccess', _103 => _103.summary]);
|
|
@@ -1772,7 +1809,7 @@ var Webhook = class extends Operation {
|
|
|
1772
1809
|
}
|
|
1773
1810
|
let webhookPath = this.api.webhooks[this.path];
|
|
1774
1811
|
if (_chunkYPR7YTHMcjs.isRef.call(void 0, webhookPath)) {
|
|
1775
|
-
this.api.webhooks[this.path] =
|
|
1812
|
+
this.api.webhooks[this.path] = _chunk5CNCBRXScjs.dereferenceRef.call(void 0, webhookPath, this.api);
|
|
1776
1813
|
webhookPath = this.api.webhooks[this.path];
|
|
1777
1814
|
}
|
|
1778
1815
|
return _optionalChain([webhookPath, 'optionalAccess', _106 => _106.description]);
|
|
@@ -1796,4 +1833,4 @@ exports.Operation = Operation; exports.Callback = Callback; exports.Webhook = We
|
|
|
1796
1833
|
* @license Apache-2.0
|
|
1797
1834
|
* @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}
|
|
1798
1835
|
*/
|
|
1799
|
-
//# sourceMappingURL=chunk-
|
|
1836
|
+
//# sourceMappingURL=chunk-IJNLIFFG.cjs.map
|