@speclynx/apidom-reference 4.7.0 → 4.7.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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.7.1](https://github.com/speclynx/apidom/compare/v4.7.0...v4.7.1) (2026-04-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **reference:** prevent exponential tree growth on deref ([#244](https://github.com/speclynx/apidom/issues/244)) ([2873e2a](https://github.com/speclynx/apidom/commit/2873e2ac8a2489396091b6bdf321138a34398d44)), closes [#12](https://github.com/speclynx/apidom/issues/12)
11
+
6
12
  # [4.7.0](https://github.com/speclynx/apidom/compare/v4.6.0...v4.7.0) (2026-04-12)
7
13
 
8
14
  **Note:** Version bump only for package @speclynx/apidom-reference
@@ -1659,6 +1659,7 @@ class Arazzo1DereferenceVisitor {
1659
1659
  * Transclude referencing element with merged referenced element.
1660
1660
  */
1661
1661
  path.replaceWith(mergedElement);
1662
+ path.skip();
1662
1663
  }
1663
1664
  async JSONSchemaElement(path) {
1664
1665
  const referencingElement = path.node;
@@ -1819,6 +1820,7 @@ class Arazzo1DereferenceVisitor {
1819
1820
  const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
1820
1821
  const replacement = replacer(refElement);
1821
1822
  path.replaceWith(replacement);
1823
+ path.skip();
1822
1824
  return;
1823
1825
  }
1824
1826
  }
@@ -1862,6 +1864,7 @@ class Arazzo1DereferenceVisitor {
1862
1864
  booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
1863
1865
  booleanJsonSchemaElement.meta.set('ref-type', referencingElement.element);
1864
1866
  path.replaceWith(booleanJsonSchemaElement);
1867
+ path.skip();
1865
1868
  return;
1866
1869
  }
1867
1870
 
@@ -2318,6 +2321,7 @@ class AsyncAPI2DereferenceVisitor {
2318
2321
  const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
2319
2322
  const replacement = replacer(refElement);
2320
2323
  path.replaceWith(replacement);
2324
+ path.skip();
2321
2325
  return;
2322
2326
  }
2323
2327
  }
@@ -2362,6 +2366,7 @@ class AsyncAPI2DereferenceVisitor {
2362
2366
  booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
2363
2367
  booleanJsonSchemaElement.meta.set('ref-type', referencingElement.element);
2364
2368
  path.replaceWith(booleanJsonSchemaElement);
2369
+ path.skip();
2365
2370
  return;
2366
2371
  }
2367
2372
 
@@ -2381,6 +2386,7 @@ class AsyncAPI2DereferenceVisitor {
2381
2386
  * Transclude referencing element with merged referenced element.
2382
2387
  */
2383
2388
  path.replaceWith(mergedElement);
2389
+ path.skip();
2384
2390
  } catch (error) {
2385
2391
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
2386
2392
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
@@ -2960,6 +2966,7 @@ class OpenAPI2DereferenceVisitor {
2960
2966
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
2961
2967
  const replacement = replacer(refElement);
2962
2968
  path.replaceWith(replacement);
2969
+ path.skip();
2963
2970
  return;
2964
2971
  }
2965
2972
  }
@@ -3007,6 +3014,7 @@ class OpenAPI2DereferenceVisitor {
3007
3014
  * Transclude referencing element with merged referenced element.
3008
3015
  */
3009
3016
  path.replaceWith(mergedElement);
3017
+ path.skip();
3010
3018
  } catch (error) {
3011
3019
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
3012
3020
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
@@ -3094,6 +3102,7 @@ class OpenAPI2DereferenceVisitor {
3094
3102
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
3095
3103
  const replacement = replacer(refElement);
3096
3104
  path.replaceWith(replacement);
3105
+ path.skip();
3097
3106
  return;
3098
3107
  }
3099
3108
  }
@@ -3248,6 +3257,7 @@ class OpenAPI2DereferenceVisitor {
3248
3257
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
3249
3258
  const replacement = replacer(refElement);
3250
3259
  path.replaceWith(replacement);
3260
+ path.skip();
3251
3261
  return;
3252
3262
  }
3253
3263
  }
@@ -3297,6 +3307,7 @@ class OpenAPI2DereferenceVisitor {
3297
3307
  * Transclude referencing element with merged referenced element.
3298
3308
  */
3299
3309
  path.replaceWith(mergedElement);
3310
+ path.skip();
3300
3311
  } catch (error) {
3301
3312
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
3302
3313
  this.handleError(`Error while dereferencing JSON Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
@@ -3729,6 +3740,7 @@ class OpenAPI3_0DereferenceVisitor {
3729
3740
  const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
3730
3741
  const replacement = replacer(refElement);
3731
3742
  path.replaceWith(replacement);
3743
+ path.skip();
3732
3744
  return;
3733
3745
  }
3734
3746
  }
@@ -3778,6 +3790,7 @@ class OpenAPI3_0DereferenceVisitor {
3778
3790
  * Transclude referencing element with merged referenced element.
3779
3791
  */
3780
3792
  path.replaceWith(mergedElement);
3793
+ path.skip();
3781
3794
  } catch (error) {
3782
3795
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref);
3783
3796
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
@@ -3865,6 +3878,7 @@ class OpenAPI3_0DereferenceVisitor {
3865
3878
  const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
3866
3879
  const replacement = replacer(refElement);
3867
3880
  path.replaceWith(replacement);
3881
+ path.skip();
3868
3882
  return;
3869
3883
  }
3870
3884
  }
@@ -4734,6 +4748,7 @@ class OpenAPI3_1DereferenceVisitor {
4734
4748
  const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
4735
4749
  const replacement = replacer(refElement);
4736
4750
  path.replaceWith(replacement);
4751
+ path.skip();
4737
4752
  return;
4738
4753
  }
4739
4754
  }
@@ -4886,6 +4901,7 @@ class OpenAPI3_1DereferenceVisitor {
4886
4901
  const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
4887
4902
  const replacement = replacer(refElement);
4888
4903
  path.replaceWith(replacement);
4904
+ path.skip();
4889
4905
  return;
4890
4906
  }
4891
4907
  }
@@ -5242,6 +5258,7 @@ class OpenAPI3_1DereferenceVisitor {
5242
5258
  const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
5243
5259
  const replacement = replacer(refElement);
5244
5260
  path.replaceWith(replacement);
5261
+ path.skip();
5245
5262
  return;
5246
5263
  }
5247
5264
  }
@@ -5283,6 +5300,7 @@ class OpenAPI3_1DereferenceVisitor {
5283
5300
  booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
5284
5301
  booleanJsonSchemaElement.meta.set('ref-type', referencingElement.element);
5285
5302
  path.replaceWith(booleanJsonSchemaElement);
5303
+ path.skip();
5286
5304
  return;
5287
5305
  }
5288
5306
 
@@ -99331,11 +99349,6 @@ function* traverseGenerator(root, visitor, options) {
99331
99349
  if (currentPath.shouldStop) {
99332
99350
  break;
99333
99351
  }
99334
- if (currentPath.shouldSkip) {
99335
- if (!isLeaving) {
99336
- continue;
99337
- }
99338
- }
99339
99352
  if (currentPath.removed) {
99340
99353
  edits.push([key, null]);
99341
99354
  if (!isLeaving) {
@@ -99345,12 +99358,19 @@ function* traverseGenerator(root, visitor, options) {
99345
99358
  const replacement = currentPath._getReplacementNode();
99346
99359
  edits.push([key, replacement]);
99347
99360
  if (!isLeaving) {
99361
+ if (currentPath.shouldSkip) {
99362
+ continue;
99363
+ }
99348
99364
  if (nodePredicate(replacement)) {
99349
99365
  node = replacement;
99350
99366
  } else {
99351
99367
  continue;
99352
99368
  }
99353
99369
  }
99370
+ } else if (currentPath.shouldSkip) {
99371
+ if (!isLeaving) {
99372
+ continue;
99373
+ }
99354
99374
  } else if (result !== undefined) {
99355
99375
  // Support return value replacement for backwards compatibility
99356
99376
  edits.push([key, result]);