@speclynx/apidom-reference 3.1.0 → 3.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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
+ # [3.2.0](https://github.com/speclynx/apidom/compare/v3.1.0...v3.2.0) (2026-03-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **referece:** fix indirection leak in dereference strategies ([#141](https://github.com/speclynx/apidom/issues/141)) ([57ec415](https://github.com/speclynx/apidom/commit/57ec4153baade728681e43223d058ef35b707212))
11
+
12
+ ### Features
13
+
14
+ - add keywords to all package.json files for npm search discoverability ([#142](https://github.com/speclynx/apidom/issues/142)) ([f6c2b38](https://github.com/speclynx/apidom/commit/f6c2b387db48427f0f12e3019e1bdb8d7e05dd00))
15
+
6
16
  # [3.1.0](https://github.com/speclynx/apidom/compare/v3.0.0...v3.1.0) (2026-03-08)
7
17
 
8
18
  ### Features
@@ -1653,6 +1653,7 @@ class Arazzo1DereferenceVisitor {
1653
1653
  path.skip();
1654
1654
  return;
1655
1655
  }
1656
+ const indirectionsSize = this.indirections.length;
1656
1657
  try {
1657
1658
  // compute baseURI using rules around $id and $ref keywords
1658
1659
  let reference = await this.toReference(_util_url_ts__WEBPACK_IMPORTED_MODULE_22__.unsanitize(this.reference.uri));
@@ -1797,7 +1798,6 @@ class Arazzo1DereferenceVisitor {
1797
1798
  });
1798
1799
  const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
1799
1800
  const replacement = replacer(refElement);
1800
- this.indirections.pop();
1801
1801
  path.replaceWith(replacement);
1802
1802
  return;
1803
1803
  }
@@ -1830,7 +1830,6 @@ class Arazzo1DereferenceVisitor {
1830
1830
  // remove referencing reference from ancestors lineage
1831
1831
  directAncestors.delete(referencingElement);
1832
1832
  }
1833
- this.indirections.pop();
1834
1833
 
1835
1834
  // Boolean JSON Schemas
1836
1835
  if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__.isBooleanJSONSchemaElement)(referencedElement)) {
@@ -1873,6 +1872,8 @@ class Arazzo1DereferenceVisitor {
1873
1872
  } catch (error) {
1874
1873
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref);
1875
1874
  this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
1875
+ } finally {
1876
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
1876
1877
  }
1877
1878
  }
1878
1879
  }
@@ -2229,6 +2230,7 @@ class AsyncAPI2DereferenceVisitor {
2229
2230
  return;
2230
2231
  }
2231
2232
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_18__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2233
+ const indirectionsSize = this.indirections.length;
2232
2234
  try {
2233
2235
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2234
2236
  this.indirections.push(referencingElement);
@@ -2289,7 +2291,6 @@ class AsyncAPI2DereferenceVisitor {
2289
2291
  });
2290
2292
  const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
2291
2293
  const replacement = replacer(refElement);
2292
- this.indirections.pop();
2293
2294
  path.replaceWith(replacement);
2294
2295
  return;
2295
2296
  }
@@ -2323,7 +2324,6 @@ class AsyncAPI2DereferenceVisitor {
2323
2324
  // remove referencing reference from ancestors lineage
2324
2325
  directAncestors.delete(referencingElement);
2325
2326
  }
2326
- this.indirections.pop();
2327
2327
 
2328
2328
  // Boolean JSON Schemas
2329
2329
  if ((0,_speclynx_apidom_ns_asyncapi_2__WEBPACK_IMPORTED_MODULE_12__.isBooleanJSONSchemaElement)(referencedElement)) {
@@ -2358,6 +2358,8 @@ class AsyncAPI2DereferenceVisitor {
2358
2358
  } catch (error) {
2359
2359
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
2360
2360
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
2361
+ } finally {
2362
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
2361
2363
  }
2362
2364
  }
2363
2365
  async ChannelItemElement(path) {
@@ -2388,6 +2390,7 @@ class AsyncAPI2DereferenceVisitor {
2388
2390
  return;
2389
2391
  }
2390
2392
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_18__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2393
+ const indirectionsSize = this.indirections.length;
2391
2394
  try {
2392
2395
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2393
2396
  this.indirections.push(referencingElement);
@@ -2438,7 +2441,6 @@ class AsyncAPI2DereferenceVisitor {
2438
2441
  });
2439
2442
  const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
2440
2443
  const replacement = replacer(refElement);
2441
- this.indirections.pop();
2442
2444
  path.replaceWith(replacement);
2443
2445
  return;
2444
2446
  }
@@ -2472,7 +2474,6 @@ class AsyncAPI2DereferenceVisitor {
2472
2474
  // remove referencing reference from ancestors lineage
2473
2475
  directAncestors.delete(referencingElement);
2474
2476
  }
2475
- this.indirections.pop();
2476
2477
 
2477
2478
  /**
2478
2479
  * Creating a new version of Channel Item by merging fields from referenced Channel Item with referencing one.
@@ -2503,6 +2504,8 @@ class AsyncAPI2DereferenceVisitor {
2503
2504
  } catch (error) {
2504
2505
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
2505
2506
  this.handleError(`Error while dereferencing Channel Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
2507
+ } finally {
2508
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
2506
2509
  }
2507
2510
  }
2508
2511
  }
@@ -2863,6 +2866,7 @@ class OpenAPI2DereferenceVisitor {
2863
2866
  return;
2864
2867
  }
2865
2868
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_20__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2869
+ const indirectionsSize = this.indirections.length;
2866
2870
  try {
2867
2871
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
2868
2872
  this.indirections.push(referencingElement);
@@ -2923,7 +2927,6 @@ class OpenAPI2DereferenceVisitor {
2923
2927
  });
2924
2928
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
2925
2929
  const replacement = replacer(refElement);
2926
- this.indirections.pop();
2927
2930
  path.replaceWith(replacement);
2928
2931
  return;
2929
2932
  }
@@ -2955,7 +2958,6 @@ class OpenAPI2DereferenceVisitor {
2955
2958
  });
2956
2959
  directAncestors.delete(referencingElement);
2957
2960
  }
2958
- this.indirections.pop();
2959
2961
 
2960
2962
  /**
2961
2963
  * Creating a new version of referenced element to avoid modifying the original one.
@@ -2976,6 +2978,8 @@ class OpenAPI2DereferenceVisitor {
2976
2978
  } catch (error) {
2977
2979
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
2978
2980
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
2981
+ } finally {
2982
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
2979
2983
  }
2980
2984
  }
2981
2985
  async PathItemElement(path) {
@@ -3006,6 +3010,7 @@ class OpenAPI2DereferenceVisitor {
3006
3010
  return;
3007
3011
  }
3008
3012
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_20__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
3013
+ const indirectionsSize = this.indirections.length;
3009
3014
  try {
3010
3015
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
3011
3016
  this.indirections.push(referencingElement);
@@ -3056,7 +3061,6 @@ class OpenAPI2DereferenceVisitor {
3056
3061
  });
3057
3062
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
3058
3063
  const replacement = replacer(refElement);
3059
- this.indirections.pop();
3060
3064
  path.replaceWith(replacement);
3061
3065
  return;
3062
3066
  }
@@ -3090,7 +3094,6 @@ class OpenAPI2DereferenceVisitor {
3090
3094
  // remove referencing reference from ancestors lineage
3091
3095
  directAncestors.delete(referencingElement);
3092
3096
  }
3093
- this.indirections.pop();
3094
3097
 
3095
3098
  /**
3096
3099
  * Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
@@ -3122,6 +3125,8 @@ class OpenAPI2DereferenceVisitor {
3122
3125
  } catch (error) {
3123
3126
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
3124
3127
  this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
3128
+ } finally {
3129
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
3125
3130
  }
3126
3131
  }
3127
3132
  async JSONReferenceElement(path) {
@@ -3149,6 +3154,7 @@ class OpenAPI2DereferenceVisitor {
3149
3154
  return;
3150
3155
  }
3151
3156
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_20__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
3157
+ const indirectionsSize = this.indirections.length;
3152
3158
  try {
3153
3159
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref));
3154
3160
  this.indirections.push(referencingElement);
@@ -3209,7 +3215,6 @@ class OpenAPI2DereferenceVisitor {
3209
3215
  });
3210
3216
  const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
3211
3217
  const replacement = replacer(refElement);
3212
- this.indirections.pop();
3213
3218
  path.replaceWith(replacement);
3214
3219
  return;
3215
3220
  }
@@ -3243,7 +3248,6 @@ class OpenAPI2DereferenceVisitor {
3243
3248
  // remove referencing reference from ancestors lineage
3244
3249
  directAncestors.delete(referencingElement);
3245
3250
  }
3246
- this.indirections.pop();
3247
3251
 
3248
3252
  /**
3249
3253
  * Creating a new version of referenced element to avoid modifying the original one.
@@ -3264,6 +3268,8 @@ class OpenAPI2DereferenceVisitor {
3264
3268
  } catch (error) {
3265
3269
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__["default"])(referencingElement.$ref);
3266
3270
  this.handleError(`Error while dereferencing JSON Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
3271
+ } finally {
3272
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
3267
3273
  }
3268
3274
  }
3269
3275
  }
@@ -3623,6 +3629,7 @@ class OpenAPI3_0DereferenceVisitor {
3623
3629
  return;
3624
3630
  }
3625
3631
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_17__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref));
3632
+ const indirectionsSize = this.indirections.length;
3626
3633
  try {
3627
3634
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref));
3628
3635
  this.indirections.push(referencingElement);
@@ -3683,7 +3690,6 @@ class OpenAPI3_0DereferenceVisitor {
3683
3690
  });
3684
3691
  const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
3685
3692
  const replacement = replacer(refElement);
3686
- this.indirections.pop();
3687
3693
  path.replaceWith(replacement);
3688
3694
  return;
3689
3695
  }
@@ -3717,7 +3723,6 @@ class OpenAPI3_0DereferenceVisitor {
3717
3723
  // remove referencing reference from ancestors lineage
3718
3724
  directAncestors.delete(referencingElement);
3719
3725
  }
3720
- this.indirections.pop();
3721
3726
 
3722
3727
  /**
3723
3728
  * Creating a new version of referenced element to avoid modifying the original one.
@@ -3738,6 +3743,8 @@ class OpenAPI3_0DereferenceVisitor {
3738
3743
  } catch (error) {
3739
3744
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref);
3740
3745
  this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
3746
+ } finally {
3747
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
3741
3748
  }
3742
3749
  }
3743
3750
  async PathItemElement(path) {
@@ -3768,6 +3775,7 @@ class OpenAPI3_0DereferenceVisitor {
3768
3775
  return;
3769
3776
  }
3770
3777
  const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_17__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref));
3778
+ const indirectionsSize = this.indirections.length;
3771
3779
  try {
3772
3780
  const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref));
3773
3781
  this.indirections.push(referencingElement);
@@ -3818,7 +3826,6 @@ class OpenAPI3_0DereferenceVisitor {
3818
3826
  });
3819
3827
  const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
3820
3828
  const replacement = replacer(refElement);
3821
- this.indirections.pop();
3822
3829
  path.replaceWith(replacement);
3823
3830
  return;
3824
3831
  }
@@ -3852,7 +3859,6 @@ class OpenAPI3_0DereferenceVisitor {
3852
3859
  // remove referencing reference from ancestors lineage
3853
3860
  directAncestors.delete(referencingElement);
3854
3861
  }
3855
- this.indirections.pop();
3856
3862
 
3857
3863
  /**
3858
3864
  * Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
@@ -3883,6 +3889,8 @@ class OpenAPI3_0DereferenceVisitor {
3883
3889
  } catch (error) {
3884
3890
  const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(referencingElement.$ref);
3885
3891
  this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
3892
+ } finally {
3893
+ if (this.indirections.length > indirectionsSize) this.indirections.pop();
3886
3894
  }
3887
3895
  }
3888
3896
  async LinkElement(path) {