@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 +10 -0
- package/dist/apidom-reference.browser.js +24 -16
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +48 -25
- package/src/dereference/strategies/arazzo-1/visitor.cjs +3 -2
- package/src/dereference/strategies/arazzo-1/visitor.mjs +3 -2
- package/src/dereference/strategies/asyncapi-2/visitor.cjs +6 -4
- package/src/dereference/strategies/asyncapi-2/visitor.mjs +6 -4
- package/src/dereference/strategies/openapi-2/visitor.cjs +9 -6
- package/src/dereference/strategies/openapi-2/visitor.mjs +9 -6
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +6 -4
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +6 -4
package/package.json
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-reference",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"apidom",
|
|
7
|
+
"api",
|
|
8
|
+
"$ref",
|
|
9
|
+
"dereference",
|
|
10
|
+
"reference",
|
|
11
|
+
"resolve",
|
|
12
|
+
"resolver",
|
|
13
|
+
"bundle",
|
|
14
|
+
"openapi",
|
|
15
|
+
"swagger",
|
|
16
|
+
"oas",
|
|
17
|
+
"asyncapi",
|
|
18
|
+
"arazzo",
|
|
19
|
+
"json-schema",
|
|
20
|
+
"json",
|
|
21
|
+
"yaml",
|
|
22
|
+
"spec",
|
|
23
|
+
"specification",
|
|
24
|
+
"parse",
|
|
25
|
+
"typescript",
|
|
26
|
+
"javascript"
|
|
27
|
+
],
|
|
5
28
|
"publishConfig": {
|
|
6
29
|
"access": "public",
|
|
7
30
|
"registry": "https://registry.npmjs.org",
|
|
@@ -231,29 +254,29 @@
|
|
|
231
254
|
"license": "Apache-2.0",
|
|
232
255
|
"dependencies": {
|
|
233
256
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
234
|
-
"@speclynx/apidom-core": "3.
|
|
235
|
-
"@speclynx/apidom-datamodel": "3.
|
|
236
|
-
"@speclynx/apidom-error": "3.
|
|
237
|
-
"@speclynx/apidom-json-pointer": "3.
|
|
238
|
-
"@speclynx/apidom-ns-arazzo-1": "3.
|
|
239
|
-
"@speclynx/apidom-ns-asyncapi-2": "3.
|
|
240
|
-
"@speclynx/apidom-ns-json-schema-2020-12": "3.
|
|
241
|
-
"@speclynx/apidom-ns-openapi-2": "3.
|
|
242
|
-
"@speclynx/apidom-ns-openapi-3-0": "3.
|
|
243
|
-
"@speclynx/apidom-ns-openapi-3-1": "3.
|
|
244
|
-
"@speclynx/apidom-parser-adapter-arazzo-json-1": "3.
|
|
245
|
-
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "3.
|
|
246
|
-
"@speclynx/apidom-parser-adapter-asyncapi-json-2": "3.
|
|
247
|
-
"@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "3.
|
|
248
|
-
"@speclynx/apidom-parser-adapter-json": "3.
|
|
249
|
-
"@speclynx/apidom-parser-adapter-openapi-json-2": "3.
|
|
250
|
-
"@speclynx/apidom-parser-adapter-openapi-json-3-0": "3.
|
|
251
|
-
"@speclynx/apidom-parser-adapter-openapi-json-3-1": "3.
|
|
252
|
-
"@speclynx/apidom-parser-adapter-openapi-yaml-2": "3.
|
|
253
|
-
"@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "3.
|
|
254
|
-
"@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "3.
|
|
255
|
-
"@speclynx/apidom-parser-adapter-yaml-1-2": "3.
|
|
256
|
-
"@speclynx/apidom-traverse": "3.
|
|
257
|
+
"@speclynx/apidom-core": "3.2.0",
|
|
258
|
+
"@speclynx/apidom-datamodel": "3.2.0",
|
|
259
|
+
"@speclynx/apidom-error": "3.2.0",
|
|
260
|
+
"@speclynx/apidom-json-pointer": "3.2.0",
|
|
261
|
+
"@speclynx/apidom-ns-arazzo-1": "3.2.0",
|
|
262
|
+
"@speclynx/apidom-ns-asyncapi-2": "3.2.0",
|
|
263
|
+
"@speclynx/apidom-ns-json-schema-2020-12": "3.2.0",
|
|
264
|
+
"@speclynx/apidom-ns-openapi-2": "3.2.0",
|
|
265
|
+
"@speclynx/apidom-ns-openapi-3-0": "3.2.0",
|
|
266
|
+
"@speclynx/apidom-ns-openapi-3-1": "3.2.0",
|
|
267
|
+
"@speclynx/apidom-parser-adapter-arazzo-json-1": "3.2.0",
|
|
268
|
+
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "3.2.0",
|
|
269
|
+
"@speclynx/apidom-parser-adapter-asyncapi-json-2": "3.2.0",
|
|
270
|
+
"@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "3.2.0",
|
|
271
|
+
"@speclynx/apidom-parser-adapter-json": "3.2.0",
|
|
272
|
+
"@speclynx/apidom-parser-adapter-openapi-json-2": "3.2.0",
|
|
273
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-0": "3.2.0",
|
|
274
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-1": "3.2.0",
|
|
275
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-2": "3.2.0",
|
|
276
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "3.2.0",
|
|
277
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "3.2.0",
|
|
278
|
+
"@speclynx/apidom-parser-adapter-yaml-1-2": "3.2.0",
|
|
279
|
+
"@speclynx/apidom-traverse": "3.2.0",
|
|
257
280
|
"@swaggerexpert/arazzo-runtime-expression": "^2.0.3",
|
|
258
281
|
"axios": "^1.13.5",
|
|
259
282
|
"picomatch": "^4.0.3",
|
|
@@ -275,5 +298,5 @@
|
|
|
275
298
|
"README.md",
|
|
276
299
|
"CHANGELOG.md"
|
|
277
300
|
],
|
|
278
|
-
"gitHead": "
|
|
301
|
+
"gitHead": "eeb2f01cd34fb0a95617f02bc1b6683aefc028f2"
|
|
279
302
|
}
|
|
@@ -274,6 +274,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
274
274
|
path.skip();
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
+
const indirectionsSize = this.indirections.length;
|
|
277
278
|
try {
|
|
278
279
|
// compute baseURI using rules around $id and $ref keywords
|
|
279
280
|
let reference = await this.toReference(url.unsanitize(this.reference.uri));
|
|
@@ -418,7 +419,6 @@ class Arazzo1DereferenceVisitor {
|
|
|
418
419
|
});
|
|
419
420
|
const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
420
421
|
const replacement = replacer(refElement);
|
|
421
|
-
this.indirections.pop();
|
|
422
422
|
path.replaceWith(replacement);
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
@@ -451,7 +451,6 @@ class Arazzo1DereferenceVisitor {
|
|
|
451
451
|
// remove referencing reference from ancestors lineage
|
|
452
452
|
directAncestors.delete(referencingElement);
|
|
453
453
|
}
|
|
454
|
-
this.indirections.pop();
|
|
455
454
|
|
|
456
455
|
// Boolean JSON Schemas
|
|
457
456
|
if ((0, _apidomNsArazzo.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
@@ -494,6 +493,8 @@ class Arazzo1DereferenceVisitor {
|
|
|
494
493
|
} catch (error) {
|
|
495
494
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
496
495
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
496
|
+
} finally {
|
|
497
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
497
498
|
}
|
|
498
499
|
}
|
|
499
500
|
}
|
|
@@ -267,6 +267,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
267
267
|
path.skip();
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
+
const indirectionsSize = this.indirections.length;
|
|
270
271
|
try {
|
|
271
272
|
// compute baseURI using rules around $id and $ref keywords
|
|
272
273
|
let reference = await this.toReference(url.unsanitize(this.reference.uri));
|
|
@@ -411,7 +412,6 @@ class Arazzo1DereferenceVisitor {
|
|
|
411
412
|
});
|
|
412
413
|
const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
413
414
|
const replacement = replacer(refElement);
|
|
414
|
-
this.indirections.pop();
|
|
415
415
|
path.replaceWith(replacement);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
@@ -444,7 +444,6 @@ class Arazzo1DereferenceVisitor {
|
|
|
444
444
|
// remove referencing reference from ancestors lineage
|
|
445
445
|
directAncestors.delete(referencingElement);
|
|
446
446
|
}
|
|
447
|
-
this.indirections.pop();
|
|
448
447
|
|
|
449
448
|
// Boolean JSON Schemas
|
|
450
449
|
if (isBooleanJSONSchemaElement(referencedElement)) {
|
|
@@ -487,6 +486,8 @@ class Arazzo1DereferenceVisitor {
|
|
|
487
486
|
} catch (error) {
|
|
488
487
|
const $ref = toValue(referencingElement.$ref);
|
|
489
488
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
489
|
+
} finally {
|
|
490
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
490
491
|
}
|
|
491
492
|
}
|
|
492
493
|
}
|
|
@@ -213,6 +213,7 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
216
|
+
const indirectionsSize = this.indirections.length;
|
|
216
217
|
try {
|
|
217
218
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
218
219
|
this.indirections.push(referencingElement);
|
|
@@ -273,7 +274,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
273
274
|
});
|
|
274
275
|
const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
275
276
|
const replacement = replacer(refElement);
|
|
276
|
-
this.indirections.pop();
|
|
277
277
|
path.replaceWith(replacement);
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
@@ -307,7 +307,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
307
307
|
// remove referencing reference from ancestors lineage
|
|
308
308
|
directAncestors.delete(referencingElement);
|
|
309
309
|
}
|
|
310
|
-
this.indirections.pop();
|
|
311
310
|
|
|
312
311
|
// Boolean JSON Schemas
|
|
313
312
|
if ((0, _apidomNsAsyncapi.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
@@ -342,6 +341,8 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
342
341
|
} catch (error) {
|
|
343
342
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
344
343
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
344
|
+
} finally {
|
|
345
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
348
|
async ChannelItemElement(path) {
|
|
@@ -372,6 +373,7 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
375
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
376
|
+
const indirectionsSize = this.indirections.length;
|
|
375
377
|
try {
|
|
376
378
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
377
379
|
this.indirections.push(referencingElement);
|
|
@@ -422,7 +424,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
422
424
|
});
|
|
423
425
|
const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
424
426
|
const replacement = replacer(refElement);
|
|
425
|
-
this.indirections.pop();
|
|
426
427
|
path.replaceWith(replacement);
|
|
427
428
|
return;
|
|
428
429
|
}
|
|
@@ -456,7 +457,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
456
457
|
// remove referencing reference from ancestors lineage
|
|
457
458
|
directAncestors.delete(referencingElement);
|
|
458
459
|
}
|
|
459
|
-
this.indirections.pop();
|
|
460
460
|
|
|
461
461
|
/**
|
|
462
462
|
* Creating a new version of Channel Item by merging fields from referenced Channel Item with referencing one.
|
|
@@ -487,6 +487,8 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
487
487
|
} catch (error) {
|
|
488
488
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
489
489
|
this.handleError(`Error while dereferencing Channel Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
490
|
+
} finally {
|
|
491
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
494
|
}
|
|
@@ -206,6 +206,7 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
209
|
+
const indirectionsSize = this.indirections.length;
|
|
209
210
|
try {
|
|
210
211
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
211
212
|
this.indirections.push(referencingElement);
|
|
@@ -266,7 +267,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
266
267
|
});
|
|
267
268
|
const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
268
269
|
const replacement = replacer(refElement);
|
|
269
|
-
this.indirections.pop();
|
|
270
270
|
path.replaceWith(replacement);
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
@@ -300,7 +300,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
300
300
|
// remove referencing reference from ancestors lineage
|
|
301
301
|
directAncestors.delete(referencingElement);
|
|
302
302
|
}
|
|
303
|
-
this.indirections.pop();
|
|
304
303
|
|
|
305
304
|
// Boolean JSON Schemas
|
|
306
305
|
if (isBooleanJSONSchemaElement(referencedElement)) {
|
|
@@ -335,6 +334,8 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
335
334
|
} catch (error) {
|
|
336
335
|
const $ref = toValue(referencingElement.$ref);
|
|
337
336
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
337
|
+
} finally {
|
|
338
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
async ChannelItemElement(path) {
|
|
@@ -365,6 +366,7 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
368
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
369
|
+
const indirectionsSize = this.indirections.length;
|
|
368
370
|
try {
|
|
369
371
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
370
372
|
this.indirections.push(referencingElement);
|
|
@@ -415,7 +417,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
415
417
|
});
|
|
416
418
|
const replacer = this.options.dereference.strategyOpts['asyncapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
417
419
|
const replacement = replacer(refElement);
|
|
418
|
-
this.indirections.pop();
|
|
419
420
|
path.replaceWith(replacement);
|
|
420
421
|
return;
|
|
421
422
|
}
|
|
@@ -449,7 +450,6 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
449
450
|
// remove referencing reference from ancestors lineage
|
|
450
451
|
directAncestors.delete(referencingElement);
|
|
451
452
|
}
|
|
452
|
-
this.indirections.pop();
|
|
453
453
|
|
|
454
454
|
/**
|
|
455
455
|
* Creating a new version of Channel Item by merging fields from referenced Channel Item with referencing one.
|
|
@@ -480,6 +480,8 @@ class AsyncAPI2DereferenceVisitor {
|
|
|
480
480
|
} catch (error) {
|
|
481
481
|
const $ref = toValue(referencingElement.$ref);
|
|
482
482
|
this.handleError(`Error while dereferencing Channel Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
483
|
+
} finally {
|
|
484
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
487
|
}
|
|
@@ -213,6 +213,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
216
|
+
const indirectionsSize = this.indirections.length;
|
|
216
217
|
try {
|
|
217
218
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
218
219
|
this.indirections.push(referencingElement);
|
|
@@ -273,7 +274,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
273
274
|
});
|
|
274
275
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
275
276
|
const replacement = replacer(refElement);
|
|
276
|
-
this.indirections.pop();
|
|
277
277
|
path.replaceWith(replacement);
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
@@ -305,7 +305,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
305
305
|
});
|
|
306
306
|
directAncestors.delete(referencingElement);
|
|
307
307
|
}
|
|
308
|
-
this.indirections.pop();
|
|
309
308
|
|
|
310
309
|
/**
|
|
311
310
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -326,6 +325,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
326
325
|
} catch (error) {
|
|
327
326
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
328
327
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
328
|
+
} finally {
|
|
329
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
async PathItemElement(path) {
|
|
@@ -356,6 +357,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
356
357
|
return;
|
|
357
358
|
}
|
|
358
359
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
360
|
+
const indirectionsSize = this.indirections.length;
|
|
359
361
|
try {
|
|
360
362
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
361
363
|
this.indirections.push(referencingElement);
|
|
@@ -406,7 +408,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
406
408
|
});
|
|
407
409
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
408
410
|
const replacement = replacer(refElement);
|
|
409
|
-
this.indirections.pop();
|
|
410
411
|
path.replaceWith(replacement);
|
|
411
412
|
return;
|
|
412
413
|
}
|
|
@@ -440,7 +441,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
440
441
|
// remove referencing reference from ancestors lineage
|
|
441
442
|
directAncestors.delete(referencingElement);
|
|
442
443
|
}
|
|
443
|
-
this.indirections.pop();
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
446
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
@@ -472,6 +472,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
472
472
|
} catch (error) {
|
|
473
473
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
474
474
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
475
|
+
} finally {
|
|
476
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
475
477
|
}
|
|
476
478
|
}
|
|
477
479
|
async JSONReferenceElement(path) {
|
|
@@ -499,6 +501,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
499
501
|
return;
|
|
500
502
|
}
|
|
501
503
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
504
|
+
const indirectionsSize = this.indirections.length;
|
|
502
505
|
try {
|
|
503
506
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
504
507
|
this.indirections.push(referencingElement);
|
|
@@ -559,7 +562,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
559
562
|
});
|
|
560
563
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
561
564
|
const replacement = replacer(refElement);
|
|
562
|
-
this.indirections.pop();
|
|
563
565
|
path.replaceWith(replacement);
|
|
564
566
|
return;
|
|
565
567
|
}
|
|
@@ -593,7 +595,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
593
595
|
// remove referencing reference from ancestors lineage
|
|
594
596
|
directAncestors.delete(referencingElement);
|
|
595
597
|
}
|
|
596
|
-
this.indirections.pop();
|
|
597
598
|
|
|
598
599
|
/**
|
|
599
600
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -614,6 +615,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
614
615
|
} catch (error) {
|
|
615
616
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
616
617
|
this.handleError(`Error while dereferencing JSON Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
618
|
+
} finally {
|
|
619
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
617
620
|
}
|
|
618
621
|
}
|
|
619
622
|
}
|
|
@@ -206,6 +206,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
209
|
+
const indirectionsSize = this.indirections.length;
|
|
209
210
|
try {
|
|
210
211
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
211
212
|
this.indirections.push(referencingElement);
|
|
@@ -266,7 +267,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
266
267
|
});
|
|
267
268
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
268
269
|
const replacement = replacer(refElement);
|
|
269
|
-
this.indirections.pop();
|
|
270
270
|
path.replaceWith(replacement);
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
@@ -298,7 +298,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
298
298
|
});
|
|
299
299
|
directAncestors.delete(referencingElement);
|
|
300
300
|
}
|
|
301
|
-
this.indirections.pop();
|
|
302
301
|
|
|
303
302
|
/**
|
|
304
303
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -319,6 +318,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
319
318
|
} catch (error) {
|
|
320
319
|
const $ref = toValue(referencingElement.$ref);
|
|
321
320
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
321
|
+
} finally {
|
|
322
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
322
323
|
}
|
|
323
324
|
}
|
|
324
325
|
async PathItemElement(path) {
|
|
@@ -349,6 +350,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
349
350
|
return;
|
|
350
351
|
}
|
|
351
352
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
353
|
+
const indirectionsSize = this.indirections.length;
|
|
352
354
|
try {
|
|
353
355
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
354
356
|
this.indirections.push(referencingElement);
|
|
@@ -399,7 +401,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
399
401
|
});
|
|
400
402
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
401
403
|
const replacement = replacer(refElement);
|
|
402
|
-
this.indirections.pop();
|
|
403
404
|
path.replaceWith(replacement);
|
|
404
405
|
return;
|
|
405
406
|
}
|
|
@@ -433,7 +434,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
433
434
|
// remove referencing reference from ancestors lineage
|
|
434
435
|
directAncestors.delete(referencingElement);
|
|
435
436
|
}
|
|
436
|
-
this.indirections.pop();
|
|
437
437
|
|
|
438
438
|
/**
|
|
439
439
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
@@ -465,6 +465,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
465
465
|
} catch (error) {
|
|
466
466
|
const $ref = toValue(referencingElement.$ref);
|
|
467
467
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
468
|
+
} finally {
|
|
469
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
468
470
|
}
|
|
469
471
|
}
|
|
470
472
|
async JSONReferenceElement(path) {
|
|
@@ -492,6 +494,7 @@ class OpenAPI2DereferenceVisitor {
|
|
|
492
494
|
return;
|
|
493
495
|
}
|
|
494
496
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
497
|
+
const indirectionsSize = this.indirections.length;
|
|
495
498
|
try {
|
|
496
499
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
497
500
|
this.indirections.push(referencingElement);
|
|
@@ -552,7 +555,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
552
555
|
});
|
|
553
556
|
const replacer = this.options.dereference.strategyOpts['openapi-2']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
554
557
|
const replacement = replacer(refElement);
|
|
555
|
-
this.indirections.pop();
|
|
556
558
|
path.replaceWith(replacement);
|
|
557
559
|
return;
|
|
558
560
|
}
|
|
@@ -586,7 +588,6 @@ class OpenAPI2DereferenceVisitor {
|
|
|
586
588
|
// remove referencing reference from ancestors lineage
|
|
587
589
|
directAncestors.delete(referencingElement);
|
|
588
590
|
}
|
|
589
|
-
this.indirections.pop();
|
|
590
591
|
|
|
591
592
|
/**
|
|
592
593
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -607,6 +608,8 @@ class OpenAPI2DereferenceVisitor {
|
|
|
607
608
|
} catch (error) {
|
|
608
609
|
const $ref = toValue(referencingElement.$ref);
|
|
609
610
|
this.handleError(`Error while dereferencing JSON Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
611
|
+
} finally {
|
|
612
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
610
613
|
}
|
|
611
614
|
}
|
|
612
615
|
}
|
|
@@ -214,6 +214,7 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
217
|
+
const indirectionsSize = this.indirections.length;
|
|
217
218
|
try {
|
|
218
219
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
219
220
|
this.indirections.push(referencingElement);
|
|
@@ -274,7 +275,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
274
275
|
});
|
|
275
276
|
const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
276
277
|
const replacement = replacer(refElement);
|
|
277
|
-
this.indirections.pop();
|
|
278
278
|
path.replaceWith(replacement);
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
@@ -308,7 +308,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
308
308
|
// remove referencing reference from ancestors lineage
|
|
309
309
|
directAncestors.delete(referencingElement);
|
|
310
310
|
}
|
|
311
|
-
this.indirections.pop();
|
|
312
311
|
|
|
313
312
|
/**
|
|
314
313
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -329,6 +328,8 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
329
328
|
} catch (error) {
|
|
330
329
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
331
330
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
331
|
+
} finally {
|
|
332
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
332
333
|
}
|
|
333
334
|
}
|
|
334
335
|
async PathItemElement(path) {
|
|
@@ -359,6 +360,7 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
359
360
|
return;
|
|
360
361
|
}
|
|
361
362
|
const $refBaseURI = url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
363
|
+
const indirectionsSize = this.indirections.length;
|
|
362
364
|
try {
|
|
363
365
|
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
364
366
|
this.indirections.push(referencingElement);
|
|
@@ -409,7 +411,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
409
411
|
});
|
|
410
412
|
const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
411
413
|
const replacement = replacer(refElement);
|
|
412
|
-
this.indirections.pop();
|
|
413
414
|
path.replaceWith(replacement);
|
|
414
415
|
return;
|
|
415
416
|
}
|
|
@@ -443,7 +444,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
443
444
|
// remove referencing reference from ancestors lineage
|
|
444
445
|
directAncestors.delete(referencingElement);
|
|
445
446
|
}
|
|
446
|
-
this.indirections.pop();
|
|
447
447
|
|
|
448
448
|
/**
|
|
449
449
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
@@ -474,6 +474,8 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
474
474
|
} catch (error) {
|
|
475
475
|
const $ref = (0, _apidomCore.toValue)(referencingElement.$ref);
|
|
476
476
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
477
|
+
} finally {
|
|
478
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
477
479
|
}
|
|
478
480
|
}
|
|
479
481
|
async LinkElement(path) {
|
|
@@ -207,6 +207,7 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
210
|
+
const indirectionsSize = this.indirections.length;
|
|
210
211
|
try {
|
|
211
212
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
212
213
|
this.indirections.push(referencingElement);
|
|
@@ -267,7 +268,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
267
268
|
});
|
|
268
269
|
const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
269
270
|
const replacement = replacer(refElement);
|
|
270
|
-
this.indirections.pop();
|
|
271
271
|
path.replaceWith(replacement);
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
@@ -301,7 +301,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
301
301
|
// remove referencing reference from ancestors lineage
|
|
302
302
|
directAncestors.delete(referencingElement);
|
|
303
303
|
}
|
|
304
|
-
this.indirections.pop();
|
|
305
304
|
|
|
306
305
|
/**
|
|
307
306
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
@@ -322,6 +321,8 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
322
321
|
} catch (error) {
|
|
323
322
|
const $ref = toValue(referencingElement.$ref);
|
|
324
323
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
324
|
+
} finally {
|
|
325
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
async PathItemElement(path) {
|
|
@@ -352,6 +353,7 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
352
353
|
return;
|
|
353
354
|
}
|
|
354
355
|
const $refBaseURI = url.resolve(retrievalURI, toValue(referencingElement.$ref));
|
|
356
|
+
const indirectionsSize = this.indirections.length;
|
|
355
357
|
try {
|
|
356
358
|
const reference = await this.toReference(toValue(referencingElement.$ref));
|
|
357
359
|
this.indirections.push(referencingElement);
|
|
@@ -402,7 +404,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
402
404
|
});
|
|
403
405
|
const replacer = this.options.dereference.strategyOpts['openapi-3-0']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
404
406
|
const replacement = replacer(refElement);
|
|
405
|
-
this.indirections.pop();
|
|
406
407
|
path.replaceWith(replacement);
|
|
407
408
|
return;
|
|
408
409
|
}
|
|
@@ -436,7 +437,6 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
436
437
|
// remove referencing reference from ancestors lineage
|
|
437
438
|
directAncestors.delete(referencingElement);
|
|
438
439
|
}
|
|
439
|
-
this.indirections.pop();
|
|
440
440
|
|
|
441
441
|
/**
|
|
442
442
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
@@ -467,6 +467,8 @@ class OpenAPI3_0DereferenceVisitor {
|
|
|
467
467
|
} catch (error) {
|
|
468
468
|
const $ref = toValue(referencingElement.$ref);
|
|
469
469
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
470
|
+
} finally {
|
|
471
|
+
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
470
472
|
}
|
|
471
473
|
}
|
|
472
474
|
async LinkElement(path) {
|