swagger-client 3.19.4 → 3.19.6

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.
@@ -33,7 +33,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
33
33
  methods: {
34
34
  async ReferenceElement(referenceElement, key, parent, path, ancestors) {
35
35
  try {
36
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
36
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
37
37
 
38
38
  // skip already identified cycled Path Item Objects
39
39
  if (includesClasses(['cycle'], referenceElement.$ref)) {
@@ -82,6 +82,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
82
82
  if (this.indirections.length > this.options.dereference.maxDepth) {
83
83
  throw new MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
84
84
  }
85
+ if (!this.useCircularStructures) {
86
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
87
+ if (hasCycles) {
88
+ if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
89
+ // make the referencing URL or file system path absolute
90
+ const cycledReferenceElement = new ReferenceElement({
91
+ $ref: $refBaseURI
92
+ }, referenceElement.meta.clone(), referenceElement.attributes.clone());
93
+ cycledReferenceElement.get('$ref').classes.push('cycle');
94
+ return cycledReferenceElement;
95
+ }
96
+ // skip processing this schema and all it's child schemas
97
+ return false;
98
+ }
99
+ }
85
100
 
86
101
  // append referencing schema to ancestors lineage
87
102
  directAncestors.add(referenceElement);
@@ -105,21 +120,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
105
120
  // remove referencing schema from ancestors lineage
106
121
  directAncestors.delete(referenceElement);
107
122
  this.indirections.pop();
108
- if (!this.useCircularStructures) {
109
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
110
- if (hasCycles) {
111
- if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
112
- // make the referencing URL or file system path absolute
113
- const cycledReferenceElement = new ReferenceElement({
114
- $ref: $refBaseURI
115
- }, referenceElement.meta.clone(), referenceElement.attributes.clone());
116
- cycledReferenceElement.get('$ref').classes.push('cycle');
117
- return cycledReferenceElement;
118
- }
119
- // skip processing this schema but traverse all it's child schemas
120
- return false;
121
- }
122
- }
123
123
  fragment = fragment.clone();
124
124
  fragment.setMetaProperty('ref-fields', {
125
125
  $ref: referenceElement.$ref?.toValue(),
@@ -165,7 +165,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
165
165
  },
166
166
  async PathItemElement(pathItemElement, key, parent, path, ancestors) {
167
167
  try {
168
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
168
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
169
169
 
170
170
  // ignore PathItemElement without $ref field
171
171
  if (!isStringElement(pathItemElement.$ref)) {
@@ -210,6 +210,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
210
210
  if (this.indirections.length > this.options.dereference.maxDepth) {
211
211
  throw new MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
212
212
  }
213
+ if (!this.useCircularStructures) {
214
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
215
+ if (hasCycles) {
216
+ if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
217
+ // make the referencing URL or file system path absolute
218
+ const cycledPathItemElement = new PathItemElement({
219
+ $ref: $refBaseURI
220
+ }, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
221
+ cycledPathItemElement.get('$ref').classes.push('cycle');
222
+ return cycledPathItemElement;
223
+ }
224
+ // skip processing this schema and all it's child schemas
225
+ return false;
226
+ }
227
+ }
213
228
 
214
229
  // append referencing schema to ancestors lineage
215
230
  directAncestors.add(pathItemElement);
@@ -233,21 +248,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
233
248
  // remove referencing schema from ancestors lineage
234
249
  directAncestors.delete(pathItemElement);
235
250
  this.indirections.pop();
236
- if (!this.useCircularStructures) {
237
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
238
- if (hasCycles) {
239
- if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
240
- // make the referencing URL or file system path absolute
241
- const cycledPathItemElement = new PathItemElement({
242
- $ref: $refBaseURI
243
- }, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
244
- cycledPathItemElement.get('$ref').classes.push('cycle');
245
- return cycledPathItemElement;
246
- }
247
- // skip processing this schema but traverse all it's child schemas
248
- return false;
249
- }
250
- }
251
251
 
252
252
  // merge fields from referenced Path Item with referencing one
253
253
  const mergedPathItemElement = new PathItemElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
@@ -290,7 +290,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
290
290
  },
291
291
  async SchemaElement(referencingElement, key, parent, path, ancestors) {
292
292
  try {
293
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
293
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
294
294
 
295
295
  // skip current referencing schema as $ref keyword was not defined
296
296
  if (!isStringElement(referencingElement.$ref)) {
@@ -380,6 +380,24 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
380
380
  throw new MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
381
381
  }
382
382
 
383
+ // useCircularStructures option processing
384
+ if (!this.useCircularStructures) {
385
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
386
+ if (hasCycles) {
387
+ if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
388
+ // make the referencing URL or file system path absolute
389
+ const baseURI = url.resolve(retrievalURI, $refBaseURI);
390
+ const cycledSchemaElement = new SchemaElement({
391
+ $ref: baseURI
392
+ }, referencingElement.meta.clone(), referencingElement.attributes.clone());
393
+ cycledSchemaElement.get('$ref').classes.push('cycle');
394
+ return cycledSchemaElement;
395
+ }
396
+ // skip processing this schema and all it's child schemas
397
+ return false;
398
+ }
399
+ }
400
+
383
401
  // append referencing schema to ancestors lineage
384
402
  directAncestors.add(referencingElement);
385
403
 
@@ -414,24 +432,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = OpenApi3_1DereferenceVisitor.c
414
432
  return jsonSchemaBooleanElement;
415
433
  }
416
434
 
417
- // useCircularStructures option processing
418
- if (!this.useCircularStructures) {
419
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
420
- if (hasCycles) {
421
- if (url.isHttpUrl(retrievalURI) || url.isFileSystemPath(retrievalURI)) {
422
- // make the referencing URL or file system path absolute
423
- const baseURI = url.resolve(retrievalURI, $refBaseURI);
424
- const cycledSchemaElement = new SchemaElement({
425
- $ref: baseURI
426
- }, referencingElement.meta.clone(), referencingElement.attributes.clone());
427
- cycledSchemaElement.get('$ref').classes.push('cycle');
428
- return cycledSchemaElement;
429
- }
430
- // skip processing this schema but traverse all it's child schemas
431
- return false;
432
- }
433
- }
434
-
435
435
  // Schema Object - merge keywords from referenced schema with referencing schema
436
436
  const mergedSchemaElement = new SchemaElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
437
437
  // existing keywords from referencing schema overrides ones from referenced schema
@@ -35,8 +35,17 @@ const HttpResolverSwaggerClient = HttpResolver.compose({
35
35
  url: file.uri,
36
36
  signal,
37
37
  userFetch: async (resource, options) => {
38
- const res = await fetch(resource, options);
39
- res.headers.delete('Content-Type');
38
+ let res = await fetch(resource, options);
39
+ try {
40
+ // node-fetch supports mutations
41
+ res.headers.delete('Content-Type');
42
+ } catch {
43
+ // Fetch API has guards which prevent mutations
44
+ res = new Response(res.body, _objectSpread(_objectSpread({}, res), {}, {
45
+ headers: new Headers(res.headers)
46
+ }));
47
+ res.headers.delete('Content-Type');
48
+ }
40
49
  return res;
41
50
  },
42
51
  credentials,
@@ -11,7 +11,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
11
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // This function runs after the common function,
15
+ // `src/execute/index.js#buildRequest`
15
16
  function buildRequest(options, req) {
16
17
  const {
17
18
  operation,
package/lib/index.js CHANGED
@@ -26,7 +26,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
26
26
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
27
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
28
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
29
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
29
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable camelcase */
30
30
  Swagger.http = _index.default;
31
31
  Swagger.makeHttp = _index.makeHttp.bind(null, Swagger.http);
32
32
  Swagger.resolveStrategies = {
@@ -39,7 +39,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
39
39
  async ReferenceElement(referenceElement, key, parent, path, ancestors) {
40
40
  try {
41
41
  var _this$basePath, _referenceElement$$re, _referenceElement$des, _referenceElement$sum;
42
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
42
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
43
43
 
44
44
  // skip already identified cycled Path Item Objects
45
45
  if ((0, _apidomCore.includesClasses)(['cycle'], referenceElement.$ref)) {
@@ -88,6 +88,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
88
88
  if (this.indirections.length > this.options.dereference.maxDepth) {
89
89
  throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
90
90
  }
91
+ if (!this.useCircularStructures) {
92
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
93
+ if (hasCycles) {
94
+ if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
95
+ // make the referencing URL or file system path absolute
96
+ const cycledReferenceElement = new _apidomNsOpenapi.ReferenceElement({
97
+ $ref: $refBaseURI
98
+ }, referenceElement.meta.clone(), referenceElement.attributes.clone());
99
+ cycledReferenceElement.get('$ref').classes.push('cycle');
100
+ return cycledReferenceElement;
101
+ }
102
+ // skip processing this schema and all it's child schemas
103
+ return false;
104
+ }
105
+ }
91
106
 
92
107
  // append referencing schema to ancestors lineage
93
108
  directAncestors.add(referenceElement);
@@ -111,21 +126,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
111
126
  // remove referencing schema from ancestors lineage
112
127
  directAncestors.delete(referenceElement);
113
128
  this.indirections.pop();
114
- if (!this.useCircularStructures) {
115
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(fragment));
116
- if (hasCycles) {
117
- if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
118
- // make the referencing URL or file system path absolute
119
- const cycledReferenceElement = new _apidomNsOpenapi.ReferenceElement({
120
- $ref: $refBaseURI
121
- }, referenceElement.meta.clone(), referenceElement.attributes.clone());
122
- cycledReferenceElement.get('$ref').classes.push('cycle');
123
- return cycledReferenceElement;
124
- }
125
- // skip processing this schema but traverse all it's child schemas
126
- return false;
127
- }
128
- }
129
129
  fragment = fragment.clone();
130
130
  fragment.setMetaProperty('ref-fields', {
131
131
  $ref: (_referenceElement$$re = referenceElement.$ref) === null || _referenceElement$$re === void 0 ? void 0 : _referenceElement$$re.toValue(),
@@ -173,7 +173,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
173
173
  async PathItemElement(pathItemElement, key, parent, path, ancestors) {
174
174
  try {
175
175
  var _this$basePath3, _pathItemElement$$ref;
176
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
176
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
177
177
 
178
178
  // ignore PathItemElement without $ref field
179
179
  if (!(0, _apidomCore.isStringElement)(pathItemElement.$ref)) {
@@ -218,6 +218,21 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
218
218
  if (this.indirections.length > this.options.dereference.maxDepth) {
219
219
  throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
220
220
  }
221
+ if (!this.useCircularStructures) {
222
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
223
+ if (hasCycles) {
224
+ if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
225
+ // make the referencing URL or file system path absolute
226
+ const cycledPathItemElement = new _apidomNsOpenapi.PathItemElement({
227
+ $ref: $refBaseURI
228
+ }, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
229
+ cycledPathItemElement.get('$ref').classes.push('cycle');
230
+ return cycledPathItemElement;
231
+ }
232
+ // skip processing this schema and all it's child schemas
233
+ return false;
234
+ }
235
+ }
221
236
 
222
237
  // append referencing schema to ancestors lineage
223
238
  directAncestors.add(pathItemElement);
@@ -241,21 +256,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
241
256
  // remove referencing schema from ancestors lineage
242
257
  directAncestors.delete(pathItemElement);
243
258
  this.indirections.pop();
244
- if (!this.useCircularStructures) {
245
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
246
- if (hasCycles) {
247
- if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
248
- // make the referencing URL or file system path absolute
249
- const cycledPathItemElement = new _apidomNsOpenapi.PathItemElement({
250
- $ref: $refBaseURI
251
- }, pathItemElement.meta.clone(), pathItemElement.attributes.clone());
252
- cycledPathItemElement.get('$ref').classes.push('cycle');
253
- return cycledPathItemElement;
254
- }
255
- // skip processing this schema but traverse all it's child schemas
256
- return false;
257
- }
258
- }
259
259
 
260
260
  // merge fields from referenced Path Item with referencing one
261
261
  const mergedPathItemElement = new _apidomNsOpenapi.PathItemElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
@@ -300,7 +300,7 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
300
300
  async SchemaElement(referencingElement, key, parent, path, ancestors) {
301
301
  try {
302
302
  var _this$basePath5, _referencingElement$$2;
303
- const [ancestorsLineage, directAncestors] = this.toAncestorLineage(ancestors);
303
+ const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
304
304
 
305
305
  // skip current referencing schema as $ref keyword was not defined
306
306
  if (!(0, _apidomCore.isStringElement)(referencingElement.$ref)) {
@@ -390,6 +390,24 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
390
390
  throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
391
391
  }
392
392
 
393
+ // useCircularStructures option processing
394
+ if (!this.useCircularStructures) {
395
+ const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
396
+ if (hasCycles) {
397
+ if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
398
+ // make the referencing URL or file system path absolute
399
+ const baseURI = _empty.url.resolve(retrievalURI, $refBaseURI);
400
+ const cycledSchemaElement = new _apidomNsOpenapi.SchemaElement({
401
+ $ref: baseURI
402
+ }, referencingElement.meta.clone(), referencingElement.attributes.clone());
403
+ cycledSchemaElement.get('$ref').classes.push('cycle');
404
+ return cycledSchemaElement;
405
+ }
406
+ // skip processing this schema and all it's child schemas
407
+ return false;
408
+ }
409
+ }
410
+
393
411
  // append referencing schema to ancestors lineage
394
412
  directAncestors.add(referencingElement);
395
413
 
@@ -425,24 +443,6 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
425
443
  return jsonSchemaBooleanElement;
426
444
  }
427
445
 
428
- // useCircularStructures option processing
429
- if (!this.useCircularStructures) {
430
- const hasCycles = ancestorsLineage.some(ancs => ancs.has(referencedElement));
431
- if (hasCycles) {
432
- if (_empty.url.isHttpUrl(retrievalURI) || _empty.url.isFileSystemPath(retrievalURI)) {
433
- // make the referencing URL or file system path absolute
434
- const baseURI = _empty.url.resolve(retrievalURI, $refBaseURI);
435
- const cycledSchemaElement = new _apidomNsOpenapi.SchemaElement({
436
- $ref: baseURI
437
- }, referencingElement.meta.clone(), referencingElement.attributes.clone());
438
- cycledSchemaElement.get('$ref').classes.push('cycle');
439
- return cycledSchemaElement;
440
- }
441
- // skip processing this schema but traverse all it's child schemas
442
- return false;
443
- }
444
- }
445
-
446
446
  // Schema Object - merge keywords from referenced schema with referencing schema
447
447
  const mergedSchemaElement = new _apidomNsOpenapi.SchemaElement([...referencedElement.content], referencedElement.meta.clone(), referencedElement.attributes.clone());
448
448
  // existing keywords from referencing schema overrides ones from referenced schema
@@ -43,8 +43,17 @@ const HttpResolverSwaggerClient = _empty.HttpResolver.compose({
43
43
  url: file.uri,
44
44
  signal,
45
45
  userFetch: async (resource, options) => {
46
- const res = await fetch(resource, options);
47
- res.headers.delete('Content-Type');
46
+ let res = await fetch(resource, options);
47
+ try {
48
+ // node-fetch supports mutations
49
+ res.headers.delete('Content-Type');
50
+ } catch {
51
+ // Fetch API has guards which prevent mutations
52
+ res = new Response(res.body, _objectSpread(_objectSpread({}, res), {}, {
53
+ headers: new Headers(res.headers)
54
+ }));
55
+ res.headers.delete('Content-Type');
56
+ }
48
57
  return res;
49
58
  },
50
59
  credentials,
@@ -12,7 +12,28 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
12
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // The subtree resolver is a higher-level interface that allows you to
16
+ // get the same result that you would from `Swagger.resolve`, but focuses on
17
+ // a subtree of your object.
18
+ //
19
+ // It makes several assumptions that allow you to think less about what resolve,
20
+ // specmap, and normalizeSwagger are doing: if this is not suitable for you,
21
+ // you can emulate `resolveSubtree`'s behavior by talking to the traditional
22
+ // resolver directly.
23
+ //
24
+ // By providing a top-level `obj` and a `path` to resolve within, the subtree
25
+ // at `path` will be resolved and normalized in the context of your top-level
26
+ // `obj`. You'll get the resolved subtree you're interest in as a return value
27
+ // (or, you can use `returnEntireTree` to get everything back).
28
+ //
29
+ // This is useful for cases where resolving your entire object is unnecessary
30
+ // and/or non-performant; we use this interface for lazily resolving operations
31
+ // and models in Swagger-UI, which allows us to handle larger definitions.
32
+ //
33
+ // It's likely that Swagger-Client will rely entirely on lazy resolving in
34
+ // future versions.
35
+ //
36
+ // TODO: move the remarks above into project documentation
16
37
  const resolveSubtree = async (obj, path, options = {}) => {
17
38
  const {
18
39
  returnEntireTree,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.19.4",
3
+ "version": "3.19.6",
4
4
  "description": "SwaggerJS - a collection of interfaces for OAI specs",
5
5
  "browser": {
6
6
  "./src/http/fold-formdata-to-request.node.js": "./src/http/fold-formdata-to-request.browser.js",
@@ -114,10 +114,10 @@
114
114
  },
115
115
  "dependencies": {
116
116
  "@babel/runtime-corejs3": "^7.20.13",
117
- "@swagger-api/apidom-core": ">=0.69.1 <1.0.0",
118
- "@swagger-api/apidom-json-pointer": ">=0.69.1 <1.0.0",
119
- "@swagger-api/apidom-ns-openapi-3-1": ">=0.69.1 <1.0.0",
120
- "@swagger-api/apidom-reference": ">=0.69.1 <1.0.0",
117
+ "@swagger-api/apidom-core": ">=0.69.2 <1.0.0",
118
+ "@swagger-api/apidom-json-pointer": ">=0.69.2 <1.0.0",
119
+ "@swagger-api/apidom-ns-openapi-3-1": ">=0.69.2 <1.0.0",
120
+ "@swagger-api/apidom-reference": ">=0.69.2 <1.0.0",
121
121
  "cookie": "~0.5.0",
122
122
  "cross-fetch": "^3.1.5",
123
123
  "deepmerge": "~4.3.0",