swagger-client 3.34.2 → 3.34.4

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.
@@ -940,7 +940,7 @@ class SpecMap {
940
940
  if (!traversed) {
941
941
  if (isObj) {
942
942
  // Only store the ref if it exists
943
- if (specmap.allowMetaPatches && objRef) {
943
+ if (specmap.allowMetaPatches && objRef && isSubPath(pathDiscriminator, updatedPath)) {
944
944
  refCache[objRef] = true;
945
945
  }
946
946
  yield* traverse(val, updatedPath, patch);
@@ -25387,27 +25387,27 @@ __webpack_require__.r(__webpack_exports__);
25387
25387
 
25388
25388
 
25389
25389
  const arrayOrEmpty = ar => Array.isArray(ar) ? ar : [];
25390
- const findObjectSchema = (schema, {
25390
+ const findObjectOrArraySchema = (schema, {
25391
25391
  recurse = true,
25392
25392
  depth = 1
25393
25393
  } = {}) => {
25394
25394
  if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_9__["default"])(schema)) return undefined;
25395
25395
 
25396
- // check if the schema is an object type
25397
- if (schema.type === 'object' || Array.isArray(schema.type) && schema.type.includes('object')) {
25396
+ // check if the schema is an object or array type
25397
+ if (schema.type === 'object' || schema.type === 'array' || Array.isArray(schema.type) && (schema.type.includes('object') || schema.type.includes('array'))) {
25398
25398
  return schema;
25399
25399
  }
25400
25400
  if (depth > _constants_js__WEBPACK_IMPORTED_MODULE_1__.TRAVERSE_LIMIT) return undefined;
25401
25401
  if (recurse) {
25402
25402
  // traverse oneOf keyword first
25403
- const oneOfResult = Array.isArray(schema.oneOf) ? schema.oneOf.find(subschema => findObjectSchema(subschema, {
25403
+ const oneOfResult = Array.isArray(schema.oneOf) ? schema.oneOf.find(subschema => findObjectOrArraySchema(subschema, {
25404
25404
  recurse,
25405
25405
  depth: depth + 1
25406
25406
  })) : undefined;
25407
25407
  if (oneOfResult) return oneOfResult;
25408
25408
 
25409
25409
  // traverse anyOf keyword second
25410
- const anyOfResult = Array.isArray(schema.anyOf) ? schema.anyOf.find(subschema => findObjectSchema(subschema, {
25410
+ const anyOfResult = Array.isArray(schema.anyOf) ? schema.anyOf.find(subschema => findObjectOrArraySchema(subschema, {
25411
25411
  recurse,
25412
25412
  depth: depth + 1
25413
25413
  })) : undefined;
@@ -25415,21 +25415,21 @@ const findObjectSchema = (schema, {
25415
25415
  }
25416
25416
  return undefined;
25417
25417
  };
25418
- const parseJsonObject = ({
25418
+ const parseJsonObjectOrArray = ({
25419
25419
  value,
25420
25420
  silentFail = false
25421
25421
  }) => {
25422
25422
  try {
25423
25423
  const parsedValue = JSON.parse(value);
25424
- if (typeof parsedValue === 'object') {
25424
+ if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_9__["default"])(parsedValue) || Array.isArray(parsedValue)) {
25425
25425
  return parsedValue;
25426
25426
  }
25427
25427
  if (!silentFail) {
25428
- throw new Error('Expected JSON serialized object');
25428
+ throw new Error('Expected JSON serialized object or array');
25429
25429
  }
25430
25430
  } catch {
25431
25431
  if (!silentFail) {
25432
- throw new Error('Could not parse object parameter value string as JSON Object');
25432
+ throw new Error('Could not parse parameter value string as JSON Object or JSON Array');
25433
25433
  }
25434
25434
  }
25435
25435
  return value;
@@ -25647,17 +25647,24 @@ function buildRequest(options) {
25647
25647
  throw new Error(`Required parameter ${parameter.name} is not provided`);
25648
25648
  }
25649
25649
  if (specIsOAS3 && typeof value === 'string') {
25650
- if ((0,ramda__WEBPACK_IMPORTED_MODULE_14__["default"])('type', parameter.schema) && findObjectSchema(parameter.schema, {
25650
+ if ((0,ramda__WEBPACK_IMPORTED_MODULE_14__["default"])('type', parameter.schema) && typeof parameter.schema.type === 'string' && findObjectOrArraySchema(parameter.schema, {
25651
25651
  recurse: false
25652
25652
  })) {
25653
- value = parseJsonObject({
25653
+ value = parseJsonObjectOrArray({
25654
25654
  value,
25655
25655
  silentFail: false
25656
25656
  });
25657
- } else if (findObjectSchema(parameter.schema, {
25657
+ } else if ((0,ramda__WEBPACK_IMPORTED_MODULE_14__["default"])('type', parameter.schema) && Array.isArray(parameter.schema.type) && findObjectOrArraySchema(parameter.schema, {
25658
+ recurse: false
25659
+ })) {
25660
+ value = parseJsonObjectOrArray({
25661
+ value,
25662
+ silentFail: true
25663
+ });
25664
+ } else if (!(0,ramda__WEBPACK_IMPORTED_MODULE_14__["default"])('type', parameter.schema) && findObjectOrArraySchema(parameter.schema, {
25658
25665
  recurse: true
25659
25666
  })) {
25660
- value = parseJsonObject({
25667
+ value = parseJsonObjectOrArray({
25661
25668
  value,
25662
25669
  silentFail: true
25663
25670
  });