@speclynx/apidom-overlay 5.2.4 → 5.2.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.
- package/CHANGELOG.md +8 -0
- package/dist/apidom-overlay.browser.js +1229 -596
- package/dist/apidom-overlay.browser.min.js +1 -1
- package/package.json +9 -9
|
@@ -97376,6 +97376,12 @@ const cf = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_4__.fixedFields)(_s
|
|
|
97376
97376
|
indexed: true
|
|
97377
97377
|
});
|
|
97378
97378
|
|
|
97379
|
+
/**
|
|
97380
|
+
* A bundled JSON Schema resource awaiting placement into the entry document's
|
|
97381
|
+
* `components.inputs`.
|
|
97382
|
+
* @public
|
|
97383
|
+
*/
|
|
97384
|
+
|
|
97379
97385
|
/**
|
|
97380
97386
|
* @public
|
|
97381
97387
|
*/
|
|
@@ -97423,17 +97429,47 @@ class Arazzo1BundleVisitor {
|
|
|
97423
97429
|
* components that are still being bundled.
|
|
97424
97430
|
*/
|
|
97425
97431
|
reservedNames;
|
|
97432
|
+
|
|
97433
|
+
/**
|
|
97434
|
+
* Embedded resources waiting to be placed into the entry document's
|
|
97435
|
+
* `components.inputs`, shared across the entry document and every external
|
|
97436
|
+
* document visitor. Placement is deferred until the entry document traversal
|
|
97437
|
+
* completes: the traversal walks live content, so placing a resource mid-way
|
|
97438
|
+
* would make it descend into the resource and re-bundle its `$ref`s against
|
|
97439
|
+
* the entry document's base URI instead of the resource's own.
|
|
97440
|
+
*/
|
|
97441
|
+
placements;
|
|
97442
|
+
|
|
97443
|
+
/**
|
|
97444
|
+
* Index of `$id`-bearing schemas per document, shared across the entry document
|
|
97445
|
+
* and every external document visitor of a single bundle run so it never
|
|
97446
|
+
* outlives mutations of the documents (e.g. the final placement of inputs).
|
|
97447
|
+
*/
|
|
97448
|
+
schema$idIndex;
|
|
97426
97449
|
constructor({
|
|
97427
97450
|
reference,
|
|
97428
97451
|
options,
|
|
97429
97452
|
assignments = new Map(),
|
|
97430
|
-
reservedNames = new Map()
|
|
97453
|
+
reservedNames = new Map(),
|
|
97454
|
+
placements = [],
|
|
97455
|
+
schema$idIndex = new WeakMap()
|
|
97431
97456
|
}) {
|
|
97432
97457
|
this.reference = reference;
|
|
97433
97458
|
this.baseURI = (0,_dereference_strategies_arazzo_1_util_mjs__WEBPACK_IMPORTED_MODULE_23__.resolveArazzo$selfField)(reference.uri, reference.value?.result);
|
|
97434
97459
|
this.options = options;
|
|
97435
97460
|
this.assignments = assignments;
|
|
97436
97461
|
this.reservedNames = reservedNames;
|
|
97462
|
+
this.placements = placements;
|
|
97463
|
+
this.schema$idIndex = schema$idIndex;
|
|
97464
|
+
}
|
|
97465
|
+
|
|
97466
|
+
/**
|
|
97467
|
+
* Base URI of the entry document — its `$self` when present, otherwise its
|
|
97468
|
+
* retrieval URI. It is the base against which a relative `$id` written into
|
|
97469
|
+
* `components.inputs` resolves.
|
|
97470
|
+
*/
|
|
97471
|
+
get entryBaseURI() {
|
|
97472
|
+
return (0,_dereference_strategies_arazzo_1_util_mjs__WEBPACK_IMPORTED_MODULE_23__.resolveArazzo$selfField)(_util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.stripHash(this.reference.refSet.rootRef.uri), this.entryResult);
|
|
97437
97473
|
}
|
|
97438
97474
|
toBaseURI(uri) {
|
|
97439
97475
|
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.resolve(this.baseURI, _util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.stripHash(uri)));
|
|
@@ -97585,14 +97621,17 @@ class Arazzo1BundleVisitor {
|
|
|
97585
97621
|
|
|
97586
97622
|
/**
|
|
97587
97623
|
* Computes a collision-free component name within `components.inputs`. A name
|
|
97588
|
-
* is taken if it's already
|
|
97589
|
-
* still being bundled (reserved before recursion).
|
|
97624
|
+
* is taken if it's already present in the entry document's inputs or reserved
|
|
97625
|
+
* by a component that is still being bundled (reserved before recursion).
|
|
97590
97626
|
*/
|
|
97591
97627
|
uniqueName(candidate) {
|
|
97592
97628
|
const field = cf.inputs.name;
|
|
97593
|
-
const
|
|
97629
|
+
const {
|
|
97630
|
+
components
|
|
97631
|
+
} = this.entryResult;
|
|
97632
|
+
const inputs = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isObjectElement)(components) ? components.get(field) : undefined;
|
|
97594
97633
|
const reserved = this.reservedNames.get(field) ?? new Set();
|
|
97595
|
-
return (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.uniqueName)(candidate, name => inputs.hasKey(name) || reserved.has(name));
|
|
97634
|
+
return (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.uniqueName)(candidate, name => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isObjectElement)(inputs) && inputs.hasKey(name) || reserved.has(name));
|
|
97596
97635
|
}
|
|
97597
97636
|
|
|
97598
97637
|
/**
|
|
@@ -97617,14 +97656,36 @@ class Arazzo1BundleVisitor {
|
|
|
97617
97656
|
this.entryParseResult.content.push(annotation);
|
|
97618
97657
|
}
|
|
97619
97658
|
|
|
97659
|
+
/**
|
|
97660
|
+
* The entry document traversal is rooted at its Parse Result (nested
|
|
97661
|
+
* traversals are rooted at schema resources), so leaving it marks the moment
|
|
97662
|
+
* the whole entry document has been visited and the collected resources can
|
|
97663
|
+
* be placed into `components.inputs` without the traversal descending into them.
|
|
97664
|
+
* Guarded on the node so that a traversal rooted at any other Parse Result
|
|
97665
|
+
* never flushes the shared placements early.
|
|
97666
|
+
*/
|
|
97667
|
+
ParseResultElement = {
|
|
97668
|
+
leave: path => {
|
|
97669
|
+
if (path.node !== this.entryParseResult) return;
|
|
97670
|
+
for (const {
|
|
97671
|
+
name,
|
|
97672
|
+
element
|
|
97673
|
+
} of this.placements) {
|
|
97674
|
+
this.ensureInputsField().set(name, element);
|
|
97675
|
+
}
|
|
97676
|
+
this.placements.length = 0;
|
|
97677
|
+
}
|
|
97678
|
+
};
|
|
97679
|
+
|
|
97620
97680
|
/**
|
|
97621
97681
|
* JSON Schema Objects in Arazzo (used by Input Objects and inline schemas) are
|
|
97622
97682
|
* a JSON Schema 2020-12 dialect — the only external reference type Arazzo
|
|
97623
97683
|
* defines. They are bundled per the JSON Schema Compound Document rules: the
|
|
97624
97684
|
* external schema RESOURCE is embedded verbatim into `components.inputs`
|
|
97625
|
-
* (carrying its `$id`), and the referencing `$ref` is
|
|
97626
|
-
*
|
|
97627
|
-
*
|
|
97685
|
+
* (carrying its `$id`), and the referencing `$ref` is rebased onto that `$id`
|
|
97686
|
+
* when it resolves to a different URI (a location-based `$ref` to a
|
|
97687
|
+
* self-identifying resource); otherwise it is left unchanged. This mirrors
|
|
97688
|
+
* the openapi-3-1 strategy's Schema Object handling.
|
|
97628
97689
|
*/
|
|
97629
97690
|
async JSONSchemaElement(path) {
|
|
97630
97691
|
const referencingElement = path.node;
|
|
@@ -97639,7 +97700,8 @@ class Arazzo1BundleVisitor {
|
|
|
97639
97700
|
// current document's base URI is derived directly (not via toReference)
|
|
97640
97701
|
// so an internal $ref needs no resolution and never trips the
|
|
97641
97702
|
// resolve.maxDepth guard.
|
|
97642
|
-
const
|
|
97703
|
+
const schemaBaseURI = (0,_dereference_strategies_arazzo_1_util_mjs__WEBPACK_IMPORTED_MODULE_24__.resolveSchemaBaseURI)(this.baseURI, path);
|
|
97704
|
+
const $refBaseURI = (0,_dereference_strategies_arazzo_1_util_mjs__WEBPACK_IMPORTED_MODULE_24__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
97643
97705
|
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.stripHash($refBaseURI);
|
|
97644
97706
|
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_20__["default"]({
|
|
97645
97707
|
uri: $refBaseURIStrippedHash
|
|
@@ -97677,7 +97739,10 @@ class Arazzo1BundleVisitor {
|
|
|
97677
97739
|
let schemaReference = this.reference;
|
|
97678
97740
|
try {
|
|
97679
97741
|
const referenceAsSchema = (0,_dereference_strategies_arazzo_1_util_mjs__WEBPACK_IMPORTED_MODULE_23__.maybeRefractToJSONSchemaElement)(schemaReference.value.result);
|
|
97680
|
-
(0,_dereference_strategies_arazzo_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_22__.evaluate)($refBaseURI, referenceAsSchema
|
|
97742
|
+
(0,_dereference_strategies_arazzo_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_22__.evaluate)($refBaseURI, referenceAsSchema, {
|
|
97743
|
+
baseURI: this.baseURI,
|
|
97744
|
+
index: this.schema$idIndex
|
|
97745
|
+
});
|
|
97681
97746
|
} catch (error) {
|
|
97682
97747
|
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]) {
|
|
97683
97748
|
if ((0,_dereference_strategies_arazzo_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_21__.isAnchor)((0,_dereference_strategies_arazzo_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_21__.uriToAnchor)($refBaseURI))) {
|
|
@@ -97716,20 +97781,23 @@ class Arazzo1BundleVisitor {
|
|
|
97716
97781
|
const field = cf.inputs.name;
|
|
97717
97782
|
const canonicalKey = `${field}\t${resourceBaseURI}`;
|
|
97718
97783
|
|
|
97719
|
-
//
|
|
97720
|
-
// $
|
|
97784
|
+
// a location-based $ref to a self-identifying resource is rebased onto the
|
|
97785
|
+
// resource's $id (keeping its fragment) — once embedded, the resource is
|
|
97786
|
+
// reachable only by its $id. A $ref already resolving to that $id is left
|
|
97787
|
+
// as written. See rebaseSchema$ref for the spec trade-off.
|
|
97788
|
+
const rebased$ref = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_25__.rebaseSchema$ref)($refBaseURI, resourceBaseURI);
|
|
97789
|
+
|
|
97790
|
+
// resource already embedded (or being embedded) — point the referencing
|
|
97791
|
+
// $ref at it and stop. This also terminates circular external schema
|
|
97721
97792
|
// references, since the assignment is reserved BEFORE recursion.
|
|
97722
97793
|
if (this.assignments.has(canonicalKey)) {
|
|
97794
|
+
if (rebased$ref !== undefined) referencingElement.set('$ref', rebased$ref);
|
|
97723
97795
|
path.skip();
|
|
97724
97796
|
return;
|
|
97725
97797
|
}
|
|
97726
97798
|
|
|
97727
|
-
// own a copy of the resource
|
|
97728
|
-
// $ref still resolves against it once embedded
|
|
97799
|
+
// own a copy of the resource
|
|
97729
97800
|
const embeddedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(resourceRoot);
|
|
97730
|
-
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(embeddedElement.$id)) {
|
|
97731
|
-
embeddedElement.set('$id', resourceBaseURI);
|
|
97732
|
-
}
|
|
97733
97801
|
|
|
97734
97802
|
// the embedded thing is the WHOLE resource (keyed by its $id), so its name
|
|
97735
97803
|
// is derived from the resource URI
|
|
@@ -97749,22 +97817,37 @@ class Arazzo1BundleVisitor {
|
|
|
97749
97817
|
reference: schemaReference,
|
|
97750
97818
|
options: this.options,
|
|
97751
97819
|
assignments: this.assignments,
|
|
97752
|
-
reservedNames: this.reservedNames
|
|
97820
|
+
reservedNames: this.reservedNames,
|
|
97821
|
+
placements: this.placements,
|
|
97822
|
+
schema$idIndex: this.schema$idIndex
|
|
97753
97823
|
});
|
|
97754
97824
|
const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_7__.traverseAsync)(embeddedElement, visitor, {
|
|
97755
97825
|
mutable: true
|
|
97756
97826
|
});
|
|
97757
97827
|
|
|
97828
|
+
// a resource without its own $id is identified by its retrieval URI; write
|
|
97829
|
+
// it relative to the entry document (the base of components.inputs) so the
|
|
97830
|
+
// bundle carries no absolute filesystem path and stays relocatable. Assigned
|
|
97831
|
+
// after the nested traversal so a reader deriving a schema's base from live
|
|
97832
|
+
// $ids (see #540) never resolves the resource's own $refs against the entry
|
|
97833
|
+
// document.
|
|
97834
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(bundledElement.$id)) {
|
|
97835
|
+
bundledElement.set('$id', _util_url_mjs__WEBPACK_IMPORTED_MODULE_17__.relative(this.entryBaseURI, resourceBaseURI));
|
|
97836
|
+
}
|
|
97837
|
+
|
|
97758
97838
|
// annotate the embedded resource with info about its origin
|
|
97759
97839
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(bundledElement)) {
|
|
97760
97840
|
bundledElement.meta.set('ref-origin', schemaReference.uri);
|
|
97761
97841
|
}
|
|
97762
97842
|
|
|
97763
|
-
//
|
|
97764
|
-
this.
|
|
97843
|
+
// queue the embedded resource for placement into the entry document's components.inputs
|
|
97844
|
+
this.placements.push({
|
|
97845
|
+
name: componentName,
|
|
97846
|
+
element: bundledElement
|
|
97847
|
+
});
|
|
97765
97848
|
|
|
97766
|
-
// the referencing $ref
|
|
97767
|
-
|
|
97849
|
+
// point the referencing $ref at the embedded resource's $id
|
|
97850
|
+
if (rebased$ref !== undefined) referencingElement.set('$ref', rebased$ref);
|
|
97768
97851
|
path.skip();
|
|
97769
97852
|
} catch (error) {
|
|
97770
97853
|
this.handleError(`Error while bundling JSON Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
@@ -100076,43 +100159,44 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
100076
100159
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87009);
|
|
100077
100160
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
|
|
100078
100161
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25162);
|
|
100079
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
100080
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
100081
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
100082
|
-
/* harmony import */ var
|
|
100083
|
-
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
100084
|
-
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
100085
|
-
/* harmony import */ var
|
|
100086
|
-
/* harmony import */ var
|
|
100087
|
-
/* harmony import */ var
|
|
100088
|
-
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
|
|
100089
|
-
/* harmony import */ var
|
|
100090
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(
|
|
100091
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(
|
|
100092
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(
|
|
100093
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(
|
|
100094
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(
|
|
100095
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(
|
|
100096
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(
|
|
100097
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(
|
|
100098
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(
|
|
100099
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(
|
|
100100
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(
|
|
100101
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(
|
|
100102
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(
|
|
100103
|
-
/* harmony import */ var
|
|
100104
|
-
/* harmony import */ var
|
|
100105
|
-
/* harmony import */ var
|
|
100106
|
-
/* harmony import */ var
|
|
100107
|
-
/* harmony import */ var
|
|
100108
|
-
/* harmony import */ var
|
|
100109
|
-
/* harmony import */ var
|
|
100110
|
-
/* harmony import */ var
|
|
100111
|
-
/* harmony import */ var
|
|
100112
|
-
/* harmony import */ var
|
|
100113
|
-
/* harmony import */ var
|
|
100114
|
-
/* harmony import */ var
|
|
100115
|
-
/* harmony import */ var
|
|
100162
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96911);
|
|
100163
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12111);
|
|
100164
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97071);
|
|
100165
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84660);
|
|
100166
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(37205);
|
|
100167
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(44673);
|
|
100168
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(16280);
|
|
100169
|
+
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(44641);
|
|
100170
|
+
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(80796);
|
|
100171
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(12020);
|
|
100172
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(61198);
|
|
100173
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(21314);
|
|
100174
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(24329);
|
|
100175
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(29881);
|
|
100176
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(76332);
|
|
100177
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(23806);
|
|
100178
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(52645);
|
|
100179
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(23031);
|
|
100180
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(63842);
|
|
100181
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(87455);
|
|
100182
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(16363);
|
|
100183
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(55122);
|
|
100184
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(71117);
|
|
100185
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(72257);
|
|
100186
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(69511);
|
|
100187
|
+
/* harmony import */ var _errors_BundleError_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(89693);
|
|
100188
|
+
/* harmony import */ var _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(34968);
|
|
100189
|
+
/* harmony import */ var _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(55086);
|
|
100190
|
+
/* harmony import */ var _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(10476);
|
|
100191
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(22820);
|
|
100192
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(18917);
|
|
100193
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(85533);
|
|
100194
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(82302);
|
|
100195
|
+
/* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(29217);
|
|
100196
|
+
/* harmony import */ var _dereference_strategies_openapi_3_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(10533);
|
|
100197
|
+
/* harmony import */ var _dereference_strategies_openapi_3_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(92500);
|
|
100198
|
+
/* harmony import */ var _dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(29587);
|
|
100199
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(78814);
|
|
100116
100200
|
|
|
100117
100201
|
|
|
100118
100202
|
|
|
@@ -100139,7 +100223,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
100139
100223
|
* Field names are sourced from the Components Object fixed fields so they
|
|
100140
100224
|
* cannot drift from the namespace definition.
|
|
100141
100225
|
*/
|
|
100142
|
-
const cf = (0,
|
|
100226
|
+
const cf = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__.fixedFields)(_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.ComponentsElement, {
|
|
100143
100227
|
indexed: true
|
|
100144
100228
|
});
|
|
100145
100229
|
const componentFieldByReferencedElement = {
|
|
@@ -100162,18 +100246,24 @@ const componentFieldByReferencedElement = {
|
|
|
100162
100246
|
* object.
|
|
100163
100247
|
*/
|
|
100164
100248
|
const componentFieldElementByField = {
|
|
100165
|
-
[cf.schemas.name]:
|
|
100166
|
-
[cf.responses.name]:
|
|
100167
|
-
[cf.parameters.name]:
|
|
100168
|
-
[cf.examples.name]:
|
|
100169
|
-
[cf.requestBodies.name]:
|
|
100170
|
-
[cf.headers.name]:
|
|
100171
|
-
[cf.securitySchemes.name]:
|
|
100172
|
-
[cf.links.name]:
|
|
100173
|
-
[cf.callbacks.name]:
|
|
100174
|
-
[cf.pathItems.name]:
|
|
100249
|
+
[cf.schemas.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_26__["default"],
|
|
100250
|
+
[cf.responses.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_25__["default"],
|
|
100251
|
+
[cf.parameters.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_22__["default"],
|
|
100252
|
+
[cf.examples.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__["default"],
|
|
100253
|
+
[cf.requestBodies.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_24__["default"],
|
|
100254
|
+
[cf.headers.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_20__["default"],
|
|
100255
|
+
[cf.securitySchemes.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_27__["default"],
|
|
100256
|
+
[cf.links.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_21__["default"],
|
|
100257
|
+
[cf.callbacks.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__["default"],
|
|
100258
|
+
[cf.pathItems.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_23__["default"]
|
|
100175
100259
|
};
|
|
100176
100260
|
|
|
100261
|
+
/**
|
|
100262
|
+
* A bundled element awaiting placement into the entry document's Components
|
|
100263
|
+
* Object field.
|
|
100264
|
+
* @public
|
|
100265
|
+
*/
|
|
100266
|
+
|
|
100177
100267
|
/**
|
|
100178
100268
|
* @public
|
|
100179
100269
|
*/
|
|
@@ -100191,7 +100281,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100191
100281
|
* Derived from the shared refSet's root reference.
|
|
100192
100282
|
*/
|
|
100193
100283
|
get entryURI() {
|
|
100194
|
-
return
|
|
100284
|
+
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(this.reference.refSet?.rootRef?.uri ?? '');
|
|
100195
100285
|
}
|
|
100196
100286
|
|
|
100197
100287
|
/**
|
|
@@ -100231,18 +100321,50 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100231
100321
|
* generic object referenced once as a Parameter and once as a Response).
|
|
100232
100322
|
*/
|
|
100233
100323
|
refractCache;
|
|
100324
|
+
|
|
100325
|
+
/**
|
|
100326
|
+
* Index of `$id`-bearing schemas per document, shared across the entry document
|
|
100327
|
+
* and every external document visitor of a single bundle run so it never
|
|
100328
|
+
* outlives mutations of the documents (e.g. the final placement of components).
|
|
100329
|
+
*/
|
|
100330
|
+
schema$idIndex;
|
|
100331
|
+
|
|
100332
|
+
/**
|
|
100333
|
+
* Bundled fragments waiting to be placed into the entry document's
|
|
100334
|
+
* Components Object, shared across the entry document and every external
|
|
100335
|
+
* document visitor. Placement is deferred until the entry document traversal
|
|
100336
|
+
* completes: the traversal walks live content, so placing a fragment mid-way
|
|
100337
|
+
* would make it descend into the fragment and re-bundle its `$ref`s against
|
|
100338
|
+
* the entry document's base URI instead of the fragment's own.
|
|
100339
|
+
*/
|
|
100340
|
+
placements;
|
|
100341
|
+
|
|
100342
|
+
/**
|
|
100343
|
+
* The base URI the traversed content will have once placed into the entry
|
|
100344
|
+
* document, when placement changes it: content hoisted out of a non-schema
|
|
100345
|
+
* document (a Response, Parameter, Path Item, ...) trades that document's
|
|
100346
|
+
* base URI for the entry document's. Unset for the entry document itself and
|
|
100347
|
+
* for embedded schema resources, whose `$id` carries their base along.
|
|
100348
|
+
*/
|
|
100349
|
+
relocationBaseURI;
|
|
100234
100350
|
constructor({
|
|
100235
100351
|
reference,
|
|
100236
100352
|
options,
|
|
100237
100353
|
assignments = new Map(),
|
|
100238
100354
|
reservedNames = new Map(),
|
|
100239
|
-
refractCache = new WeakMap()
|
|
100355
|
+
refractCache = new WeakMap(),
|
|
100356
|
+
schema$idIndex = new WeakMap(),
|
|
100357
|
+
placements = [],
|
|
100358
|
+
relocationBaseURI
|
|
100240
100359
|
}) {
|
|
100241
100360
|
this.reference = reference;
|
|
100242
100361
|
this.options = options;
|
|
100243
100362
|
this.assignments = assignments;
|
|
100244
100363
|
this.reservedNames = reservedNames;
|
|
100245
100364
|
this.refractCache = refractCache;
|
|
100365
|
+
this.schema$idIndex = schema$idIndex;
|
|
100366
|
+
this.placements = placements;
|
|
100367
|
+
this.relocationBaseURI = relocationBaseURI;
|
|
100246
100368
|
}
|
|
100247
100369
|
getRefracted(source, type) {
|
|
100248
100370
|
return this.refractCache.get(source)?.get(type);
|
|
@@ -100256,12 +100378,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100256
100378
|
byType.set(type, refracted);
|
|
100257
100379
|
}
|
|
100258
100380
|
toBaseURI(uri) {
|
|
100259
|
-
return
|
|
100381
|
+
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.resolve(this.reference.uri, _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(uri)));
|
|
100260
100382
|
}
|
|
100261
100383
|
async toReference(uri) {
|
|
100262
100384
|
// detect maximum depth of resolution
|
|
100263
100385
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
100264
|
-
throw new
|
|
100386
|
+
throw new _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_31__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`, {
|
|
100265
100387
|
maxDepth: this.options.resolve.maxDepth,
|
|
100266
100388
|
uri: this.reference.uri
|
|
100267
100389
|
});
|
|
@@ -100275,14 +100397,14 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100275
100397
|
if (refSet.has(baseURI)) {
|
|
100276
100398
|
return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(baseURI, 'uri'));
|
|
100277
100399
|
}
|
|
100278
|
-
const parseResult = await (0,
|
|
100400
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_34__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.unsanitize(baseURI), {
|
|
100279
100401
|
...this.options,
|
|
100280
100402
|
parse: {
|
|
100281
100403
|
...this.options.parse,
|
|
100282
100404
|
mediaType: 'text/plain'
|
|
100283
100405
|
}
|
|
100284
100406
|
});
|
|
100285
|
-
const reference = new
|
|
100407
|
+
const reference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_35__["default"]({
|
|
100286
100408
|
uri: baseURI,
|
|
100287
100409
|
value: parseResult,
|
|
100288
100410
|
depth: this.reference.depth + 1
|
|
@@ -100297,7 +100419,23 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100297
100419
|
* transferable. Bare fragments are returned unchanged.
|
|
100298
100420
|
*/
|
|
100299
100421
|
normalizeSelfReference(ref) {
|
|
100300
|
-
return ref.startsWith('#') ? ref :
|
|
100422
|
+
return ref.startsWith('#') ? ref : _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.getHash(ref);
|
|
100423
|
+
}
|
|
100424
|
+
|
|
100425
|
+
/**
|
|
100426
|
+
* The base URI the given Schema Object's `$ref` will be resolved against once
|
|
100427
|
+
* the content is placed into the entry document, or `undefined` when the
|
|
100428
|
+
* `$ref` as written resolves to `$refBaseURI` from there as well: the content
|
|
100429
|
+
* isn't relocated, an absolute `$id` on the schema's ancestor chain pins its
|
|
100430
|
+
* base, or the hoisted document sits next to the entry document.
|
|
100431
|
+
*/
|
|
100432
|
+
relocatedSchemaBaseURI(path, $refBaseURI) {
|
|
100433
|
+
if (this.relocationBaseURI === undefined) return undefined;
|
|
100434
|
+
const relocatedBaseURI = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.resolveSchemaBaseURI)(this.relocationBaseURI, path);
|
|
100435
|
+
if ((0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.resolveSchema$refField)(relocatedBaseURI, path.node) === $refBaseURI) {
|
|
100436
|
+
return undefined;
|
|
100437
|
+
}
|
|
100438
|
+
return relocatedBaseURI;
|
|
100301
100439
|
}
|
|
100302
100440
|
|
|
100303
100441
|
/**
|
|
@@ -100316,16 +100454,16 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100316
100454
|
// breach (MaximumBundleDepthError, which also extends BundleError) is a
|
|
100317
100455
|
// resolution failure and flows through below — wrapped and subject to
|
|
100318
100456
|
// continueOnError, like dereferencing.
|
|
100319
|
-
if (error instanceof
|
|
100457
|
+
if (error instanceof _errors_BundleError_mjs__WEBPACK_IMPORTED_MODULE_28__["default"] && !(error instanceof _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_30__["default"])) {
|
|
100320
100458
|
throw error;
|
|
100321
100459
|
}
|
|
100322
100460
|
const {
|
|
100323
100461
|
continueOnError
|
|
100324
100462
|
} = this.options.bundle;
|
|
100325
|
-
const isEntryDocument =
|
|
100463
|
+
const isEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
|
|
100326
100464
|
const uri = this.reference.uri;
|
|
100327
100465
|
const type = referencingElement.element;
|
|
100328
|
-
const codeFrame = (0,
|
|
100466
|
+
const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement);
|
|
100329
100467
|
const location = visitorPath.formatPath();
|
|
100330
100468
|
const hop = {
|
|
100331
100469
|
uri,
|
|
@@ -100336,12 +100474,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100336
100474
|
codeFrame
|
|
100337
100475
|
};
|
|
100338
100476
|
let unresolvedError;
|
|
100339
|
-
if (error instanceof
|
|
100477
|
+
if (error instanceof _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_29__["default"]) {
|
|
100340
100478
|
// @ts-ignore
|
|
100341
100479
|
error.trace = [hop, ...error.trace];
|
|
100342
100480
|
unresolvedError = error;
|
|
100343
100481
|
} else {
|
|
100344
|
-
unresolvedError = new
|
|
100482
|
+
unresolvedError = new _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_29__["default"](message, {
|
|
100345
100483
|
cause: error,
|
|
100346
100484
|
type,
|
|
100347
100485
|
uri,
|
|
@@ -100364,12 +100502,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100364
100502
|
const entryResult = this.entryResult;
|
|
100365
100503
|
let components = entryResult.components;
|
|
100366
100504
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(components)) {
|
|
100367
|
-
components = new
|
|
100505
|
+
components = new _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__.ComponentsElement();
|
|
100368
100506
|
entryResult.components = components;
|
|
100369
100507
|
}
|
|
100370
100508
|
let fieldElement = components.get(field);
|
|
100371
100509
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(fieldElement)) {
|
|
100372
|
-
const FieldElement = componentFieldElementByField[field] ??
|
|
100510
|
+
const FieldElement = componentFieldElementByField[field] ?? _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"];
|
|
100373
100511
|
fieldElement = new FieldElement();
|
|
100374
100512
|
components.set(field, fieldElement);
|
|
100375
100513
|
}
|
|
@@ -100381,9 +100519,9 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100381
100519
|
* falling back to the referenced file's basename.
|
|
100382
100520
|
*/
|
|
100383
100521
|
basenameOf(jsonPointer, baseURI) {
|
|
100384
|
-
const tokens = (0,
|
|
100522
|
+
const tokens = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.parse)(jsonPointer).tree;
|
|
100385
100523
|
const lastToken = tokens.length > 0 ? tokens[tokens.length - 1] : '';
|
|
100386
|
-
return lastToken ||
|
|
100524
|
+
return lastToken || _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.getBasename(baseURI) || 'Schema';
|
|
100387
100525
|
}
|
|
100388
100526
|
|
|
100389
100527
|
/**
|
|
@@ -100406,9 +100544,9 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100406
100544
|
return this.basenameOf(jsonPointer, baseURI);
|
|
100407
100545
|
}
|
|
100408
100546
|
if (componentNamesStrategy === 'title') {
|
|
100409
|
-
const title = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(element) ? (0,
|
|
100547
|
+
const title = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(element) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(element.get('title')) : undefined;
|
|
100410
100548
|
if (typeof title === 'string' && title.trim() !== '') {
|
|
100411
|
-
const name = (0,
|
|
100549
|
+
const name = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_40__.sanitizeComponentName)((0,_util_mjs__WEBPACK_IMPORTED_MODULE_40__.toPascalCase)(title));
|
|
100412
100550
|
if (name !== '') return name;
|
|
100413
100551
|
}
|
|
100414
100552
|
// fall back to basename when no usable title is present
|
|
@@ -100418,13 +100556,16 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100418
100556
|
|
|
100419
100557
|
/**
|
|
100420
100558
|
* Computes a collision-free component name within the target field. A name is
|
|
100421
|
-
* taken if it's already
|
|
100422
|
-
* is still being bundled (reserved before recursion).
|
|
100559
|
+
* taken if it's already present in the entry document's components or reserved
|
|
100560
|
+
* by a component that is still being bundled (reserved before recursion).
|
|
100423
100561
|
*/
|
|
100424
100562
|
uniqueName(candidate, field) {
|
|
100425
|
-
const
|
|
100563
|
+
const {
|
|
100564
|
+
components
|
|
100565
|
+
} = this.entryResult;
|
|
100566
|
+
const fieldElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(components) ? components.get(field) : undefined;
|
|
100426
100567
|
const reserved = this.reservedNames.get(field) ?? new Set();
|
|
100427
|
-
return (0,
|
|
100568
|
+
return (0,_util_mjs__WEBPACK_IMPORTED_MODULE_40__.uniqueName)(candidate, name => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(fieldElement) && fieldElement.hasKey(name) || reserved.has(name));
|
|
100428
100569
|
}
|
|
100429
100570
|
|
|
100430
100571
|
/**
|
|
@@ -100440,17 +100581,39 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100440
100581
|
}
|
|
100441
100582
|
const message = `Component "${preferredName}" in components/${field} is referenced with the same name but different content. Renamed to "${componentName}".`;
|
|
100442
100583
|
if (onComponentNameCollision === 'error') {
|
|
100443
|
-
throw new
|
|
100584
|
+
throw new _errors_BundleError_mjs__WEBPACK_IMPORTED_MODULE_28__["default"](message);
|
|
100444
100585
|
}
|
|
100445
|
-
const annotation = new
|
|
100586
|
+
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"](message);
|
|
100446
100587
|
annotation.classes.push('warning');
|
|
100447
100588
|
annotation.code = 'bundle-component-name-collision';
|
|
100448
100589
|
// append (never prepend) so the result element stays ahead of annotations
|
|
100449
100590
|
this.entryParseResult.content.push(annotation);
|
|
100450
100591
|
}
|
|
100592
|
+
|
|
100593
|
+
/**
|
|
100594
|
+
* The entry document traversal is rooted at its Parse Result (nested
|
|
100595
|
+
* traversals are rooted at fragments), so leaving it marks the moment the
|
|
100596
|
+
* whole entry document has been visited and the collected fragments can be
|
|
100597
|
+
* placed into its Components Object without the traversal descending into them.
|
|
100598
|
+
* Guarded on the node so that a traversal rooted at any other Parse Result
|
|
100599
|
+
* never flushes the shared placements early.
|
|
100600
|
+
*/
|
|
100601
|
+
ParseResultElement = {
|
|
100602
|
+
leave: path => {
|
|
100603
|
+
if (path.node !== this.entryParseResult) return;
|
|
100604
|
+
for (const {
|
|
100605
|
+
field,
|
|
100606
|
+
name,
|
|
100607
|
+
element
|
|
100608
|
+
} of this.placements) {
|
|
100609
|
+
this.ensureComponentsField(field).set(name, element);
|
|
100610
|
+
}
|
|
100611
|
+
this.placements.length = 0;
|
|
100612
|
+
}
|
|
100613
|
+
};
|
|
100451
100614
|
async ReferenceElement(path) {
|
|
100452
100615
|
const referencingElement = path.node;
|
|
100453
|
-
const $ref = (0,
|
|
100616
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
100454
100617
|
const retrievalURI = this.toBaseURI($ref);
|
|
100455
100618
|
const isInternalReference = this.entryURI === retrievalURI;
|
|
100456
100619
|
const isExternalReference = !isInternalReference;
|
|
@@ -100467,8 +100630,8 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100467
100630
|
path.skip();
|
|
100468
100631
|
return;
|
|
100469
100632
|
}
|
|
100470
|
-
const $refBaseURI =
|
|
100471
|
-
const jsonPointer =
|
|
100633
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.resolve(retrievalURI, $ref);
|
|
100634
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
100472
100635
|
|
|
100473
100636
|
// the target bucket depends on the referencing context, so it's part of the
|
|
100474
100637
|
// identity: the same external target referenced as e.g. both a parameter and
|
|
@@ -100496,7 +100659,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100496
100659
|
try {
|
|
100497
100660
|
// detect maximum depth of bundling
|
|
100498
100661
|
if (this.reference.depth >= this.options.bundle.maxDepth) {
|
|
100499
|
-
throw new
|
|
100662
|
+
throw new _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_30__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
100500
100663
|
maxDepth: this.options.bundle.maxDepth,
|
|
100501
100664
|
uri: this.reference.uri
|
|
100502
100665
|
});
|
|
@@ -100504,21 +100667,21 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100504
100667
|
const reference = await this.toReference($ref);
|
|
100505
100668
|
|
|
100506
100669
|
// possibly non-semantic fragment
|
|
100507
|
-
let referencedElement = (0,
|
|
100670
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
100508
100671
|
|
|
100509
100672
|
// apply semantics to the fragment so nested references become Reference Objects
|
|
100510
|
-
if (referencedElement.element !== referencedElementType && !(0,
|
|
100673
|
+
if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isReferenceElement)(referencedElement)) {
|
|
100511
100674
|
const cached = this.getRefracted(referencedElement, referencedElementType);
|
|
100512
100675
|
if (cached !== undefined) {
|
|
100513
100676
|
referencedElement = cached;
|
|
100514
|
-
} else if ((0,
|
|
100677
|
+
} else if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isReferenceLikeElement)(referencedElement)) {
|
|
100515
100678
|
const sourceElement = referencedElement;
|
|
100516
|
-
referencedElement = (0,
|
|
100679
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.refractReference)(referencedElement);
|
|
100517
100680
|
referencedElement.meta.set('referenced-element', referencedElementType);
|
|
100518
100681
|
this.setRefracted(sourceElement, referencedElementType, referencedElement);
|
|
100519
100682
|
} else {
|
|
100520
100683
|
const sourceElement = referencedElement;
|
|
100521
|
-
referencedElement = (0,
|
|
100684
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__["default"])(referencedElement, {
|
|
100522
100685
|
element: referencedElementType
|
|
100523
100686
|
});
|
|
100524
100687
|
this.setRefracted(sourceElement, referencedElementType, referencedElement);
|
|
@@ -100526,7 +100689,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100526
100689
|
}
|
|
100527
100690
|
const preferredName = this.baseName(referencedElement, field, jsonPointer, retrievalURI);
|
|
100528
100691
|
const componentName = this.uniqueName(preferredName, field);
|
|
100529
|
-
const internalPointer = `#/components/${field}/${(0,
|
|
100692
|
+
const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.escape)(componentName)}`;
|
|
100530
100693
|
this.reportNameCollision(preferredName, componentName, field);
|
|
100531
100694
|
|
|
100532
100695
|
// reserve the assignment and component name before recursing so cyclic
|
|
@@ -100535,16 +100698,21 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100535
100698
|
if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
|
|
100536
100699
|
this.reservedNames.get(field).add(componentName);
|
|
100537
100700
|
|
|
100538
|
-
// own a copy of the fragment and bundle its own external references
|
|
100539
|
-
|
|
100701
|
+
// own a copy of the fragment and bundle its own external references; the
|
|
100702
|
+
// fragment ends up in the entry document, so that is where its content
|
|
100703
|
+
// resolves relative references from
|
|
100704
|
+
const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(referencedElement);
|
|
100540
100705
|
const visitor = new OpenAPI3_1BundleVisitor({
|
|
100541
100706
|
reference,
|
|
100542
100707
|
options: this.options,
|
|
100543
100708
|
assignments: this.assignments,
|
|
100544
100709
|
reservedNames: this.reservedNames,
|
|
100545
|
-
refractCache: this.refractCache
|
|
100710
|
+
refractCache: this.refractCache,
|
|
100711
|
+
schema$idIndex: this.schema$idIndex,
|
|
100712
|
+
placements: this.placements,
|
|
100713
|
+
relocationBaseURI: this.entryURI
|
|
100546
100714
|
});
|
|
100547
|
-
const bundledElement = await (0,
|
|
100715
|
+
const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(hoistedElement, visitor, {
|
|
100548
100716
|
mutable: true
|
|
100549
100717
|
});
|
|
100550
100718
|
|
|
@@ -100553,8 +100721,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100553
100721
|
bundledElement.meta.set('ref-origin', reference.uri);
|
|
100554
100722
|
}
|
|
100555
100723
|
|
|
100556
|
-
//
|
|
100557
|
-
this.
|
|
100724
|
+
// queue the bundled fragment for placement into the entry document's components
|
|
100725
|
+
this.placements.push({
|
|
100726
|
+
field,
|
|
100727
|
+
name: componentName,
|
|
100728
|
+
element: bundledElement
|
|
100729
|
+
});
|
|
100558
100730
|
|
|
100559
100731
|
// rewrite the referencing element to point at the hoisted fragment
|
|
100560
100732
|
referencingElement.set('$ref', internalPointer);
|
|
@@ -100580,7 +100752,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100580
100752
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(pathItemElement.$ref)) {
|
|
100581
100753
|
return;
|
|
100582
100754
|
}
|
|
100583
|
-
const $ref = (0,
|
|
100755
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(pathItemElement.$ref);
|
|
100584
100756
|
const retrievalURI = this.toBaseURI($ref);
|
|
100585
100757
|
const isInternalReference = this.entryURI === retrievalURI;
|
|
100586
100758
|
const isExternalReference = !isInternalReference;
|
|
@@ -100597,8 +100769,8 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100597
100769
|
path.skip();
|
|
100598
100770
|
return;
|
|
100599
100771
|
}
|
|
100600
|
-
const $refBaseURI =
|
|
100601
|
-
const jsonPointer =
|
|
100772
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.resolve(retrievalURI, $ref);
|
|
100773
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
100602
100774
|
const field = cf.pathItems.name;
|
|
100603
100775
|
const canonicalKey = `${field}\t${retrievalURI}#${jsonPointer}`;
|
|
100604
100776
|
|
|
@@ -100613,28 +100785,28 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100613
100785
|
try {
|
|
100614
100786
|
// detect maximum depth of bundling
|
|
100615
100787
|
if (this.reference.depth >= this.options.bundle.maxDepth) {
|
|
100616
|
-
throw new
|
|
100788
|
+
throw new _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_30__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
100617
100789
|
maxDepth: this.options.bundle.maxDepth,
|
|
100618
100790
|
uri: this.reference.uri
|
|
100619
100791
|
});
|
|
100620
100792
|
}
|
|
100621
100793
|
const reference = await this.toReference($ref);
|
|
100622
|
-
let referencedElement = (0,
|
|
100794
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
100623
100795
|
|
|
100624
100796
|
// apply Path Item semantics to the referenced fragment
|
|
100625
|
-
if (!(0,
|
|
100797
|
+
if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement)) {
|
|
100626
100798
|
const cached = this.getRefracted(referencedElement, 'pathItem');
|
|
100627
100799
|
if (cached !== undefined) {
|
|
100628
100800
|
referencedElement = cached;
|
|
100629
100801
|
} else {
|
|
100630
100802
|
const sourceElement = referencedElement;
|
|
100631
|
-
referencedElement = (0,
|
|
100803
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.refractPathItem)(referencedElement);
|
|
100632
100804
|
this.setRefracted(sourceElement, 'pathItem', referencedElement);
|
|
100633
100805
|
}
|
|
100634
100806
|
}
|
|
100635
100807
|
const preferredName = this.baseName(referencedElement, field, jsonPointer, retrievalURI);
|
|
100636
100808
|
const componentName = this.uniqueName(preferredName, field);
|
|
100637
|
-
const internalPointer = `#/components/${field}/${(0,
|
|
100809
|
+
const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.escape)(componentName)}`;
|
|
100638
100810
|
this.reportNameCollision(preferredName, componentName, field);
|
|
100639
100811
|
|
|
100640
100812
|
// reserve the assignment and component name before recursing so cyclic
|
|
@@ -100643,16 +100815,21 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100643
100815
|
if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
|
|
100644
100816
|
this.reservedNames.get(field).add(componentName);
|
|
100645
100817
|
|
|
100646
|
-
// own a copy of the fragment and bundle its own external references
|
|
100647
|
-
|
|
100818
|
+
// own a copy of the fragment and bundle its own external references; the
|
|
100819
|
+
// Path Item ends up in the entry document, so that is where its content
|
|
100820
|
+
// resolves relative references from
|
|
100821
|
+
const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(referencedElement);
|
|
100648
100822
|
const visitor = new OpenAPI3_1BundleVisitor({
|
|
100649
100823
|
reference,
|
|
100650
100824
|
options: this.options,
|
|
100651
100825
|
assignments: this.assignments,
|
|
100652
100826
|
reservedNames: this.reservedNames,
|
|
100653
|
-
refractCache: this.refractCache
|
|
100827
|
+
refractCache: this.refractCache,
|
|
100828
|
+
schema$idIndex: this.schema$idIndex,
|
|
100829
|
+
placements: this.placements,
|
|
100830
|
+
relocationBaseURI: this.entryURI
|
|
100654
100831
|
});
|
|
100655
|
-
const bundledElement = await (0,
|
|
100832
|
+
const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(hoistedElement, visitor, {
|
|
100656
100833
|
mutable: true
|
|
100657
100834
|
});
|
|
100658
100835
|
|
|
@@ -100661,8 +100838,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100661
100838
|
// internal `#/components/pathItems/...` pointer by the child traversal
|
|
100662
100839
|
bundledElement.meta.set('ref-origin', reference.uri);
|
|
100663
100840
|
|
|
100664
|
-
//
|
|
100665
|
-
this.
|
|
100841
|
+
// queue the bundled Path Item for placement into the entry document's components
|
|
100842
|
+
this.placements.push({
|
|
100843
|
+
field,
|
|
100844
|
+
name: componentName,
|
|
100845
|
+
element: bundledElement
|
|
100846
|
+
});
|
|
100666
100847
|
|
|
100667
100848
|
// rewrite the referencing Path Item to point at the hoisted one, keeping
|
|
100668
100849
|
// any sibling fields (e.g. summary, description) next to the $ref
|
|
@@ -100690,21 +100871,22 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100690
100871
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(referencingElement.$ref)) {
|
|
100691
100872
|
return;
|
|
100692
100873
|
}
|
|
100693
|
-
const $ref = (0,
|
|
100874
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
100694
100875
|
try {
|
|
100695
100876
|
// compute baseURI using rules around $id and $ref keywords. The current
|
|
100696
100877
|
// document's URI is the retrieval URI — derive it directly (not via
|
|
100697
100878
|
// toReference) so an internal $ref needs no resolution and never trips the
|
|
100698
100879
|
// resolve.maxDepth guard, matching how ReferenceElement returns early.
|
|
100699
100880
|
const retrievalURI = this.reference.uri;
|
|
100700
|
-
const
|
|
100701
|
-
const $
|
|
100702
|
-
const
|
|
100881
|
+
const schemaBaseURI = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.resolveSchemaBaseURI)(retrievalURI, path);
|
|
100882
|
+
const $refBaseURI = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
100883
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash($refBaseURI);
|
|
100884
|
+
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_36__["default"]({
|
|
100703
100885
|
uri: $refBaseURIStrippedHash
|
|
100704
100886
|
});
|
|
100705
100887
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
|
|
100706
100888
|
const isURL = !isUnknownURI;
|
|
100707
|
-
const isInternalReference =
|
|
100889
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(this.reference.uri) === $refBaseURIStrippedHash;
|
|
100708
100890
|
const isExternalReference = !isInternalReference;
|
|
100709
100891
|
|
|
100710
100892
|
// internal Schema Object $refs resolve against the in-document $id graph;
|
|
@@ -100722,7 +100904,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100722
100904
|
// detect maximum depth of bundling before fetching the external resource,
|
|
100723
100905
|
// matching ReferenceElement/PathItemElement (which check before toReference)
|
|
100724
100906
|
if (this.reference.depth >= this.options.bundle.maxDepth) {
|
|
100725
|
-
throw new
|
|
100907
|
+
throw new _errors_MaximumBundleDepthError_mjs__WEBPACK_IMPORTED_MODULE_30__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
100726
100908
|
maxDepth: this.options.bundle.maxDepth,
|
|
100727
100909
|
uri: this.reference.uri
|
|
100728
100910
|
});
|
|
@@ -100733,59 +100915,95 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100733
100915
|
// as a canonical URI / URL against the current document's $id graph; if
|
|
100734
100916
|
// that fails, fall back to fetching the external document and resolving
|
|
100735
100917
|
// the fragment there as a $anchor or JSON Pointer.
|
|
100918
|
+
//
|
|
100919
|
+
// the fragment being traversed is searched before the whole document:
|
|
100920
|
+
// content hoisted out of an external document (a Response, Parameter, Path
|
|
100921
|
+
// Item, ...) is refracted with its own semantics, so the Schema Objects it
|
|
100922
|
+
// contains are indexed, whereas the external document as a whole is parsed
|
|
100923
|
+
// generically and refracted as a bare JSON Schema, which leaves those Schema
|
|
100924
|
+
// Objects (under `content`, `schema`, ...) unrecognized and their `$id`s out
|
|
100925
|
+
// of the index
|
|
100926
|
+
const documentElement = this.reference.value.result;
|
|
100927
|
+
const rootNode = path.getAncestorNodes().at(-1) ?? path.node;
|
|
100928
|
+
const fragmentElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isParseResultElement)(rootNode) ? rootNode.result : rootNode;
|
|
100929
|
+
const uriEvaluateOptions = {
|
|
100930
|
+
baseURI: retrievalURI,
|
|
100931
|
+
index: this.schema$idIndex
|
|
100932
|
+
};
|
|
100736
100933
|
let schemaReference = this.reference;
|
|
100934
|
+
let resourceRoot;
|
|
100935
|
+
let resourceBaseURI;
|
|
100737
100936
|
try {
|
|
100738
|
-
|
|
100739
|
-
|
|
100937
|
+
try {
|
|
100938
|
+
(0,_dereference_strategies_openapi_3_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_38__.evaluate)($refBaseURI, (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.maybeRefractToSchemaElement)(fragmentElement), uriEvaluateOptions);
|
|
100939
|
+
// a $ref that resolves (by $id/$anchor/pointer) within the traversed
|
|
100940
|
+
// content is internal even when its URI form (e.g. a URN or absolute
|
|
100941
|
+
// $id) is not a bare fragment: the $id resource travels with the content
|
|
100942
|
+
// wherever it is placed. Leave it untouched — it resolves against the
|
|
100943
|
+
// in-content $id graph, and embedding the content into itself would be
|
|
100944
|
+
// wrong.
|
|
100945
|
+
return;
|
|
100946
|
+
} catch (error) {
|
|
100947
|
+
if (!(error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_32__["default"]) || fragmentElement === documentElement) {
|
|
100948
|
+
throw error;
|
|
100949
|
+
}
|
|
100950
|
+
const documentAsSchema = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.maybeRefractToSchemaElement)(documentElement);
|
|
100951
|
+
(0,_dereference_strategies_openapi_3_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_38__.evaluate)($refBaseURI, documentAsSchema, uriEvaluateOptions);
|
|
100952
|
+
// the $id resource sits in the current document but outside the
|
|
100953
|
+
// traversed fragment, so it stays behind once the fragment is placed
|
|
100954
|
+
// into the entry document. The resource to embed is that $id-bearing
|
|
100955
|
+
// schema, addressed by its canonical URI (the $ref without fragment).
|
|
100956
|
+
resourceRoot = (0,_dereference_strategies_openapi_3_1_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_38__.evaluate)($refBaseURIStrippedHash, documentAsSchema, uriEvaluateOptions);
|
|
100957
|
+
resourceBaseURI = $refBaseURIStrippedHash;
|
|
100958
|
+
}
|
|
100740
100959
|
} catch (error) {
|
|
100741
|
-
if (isURL && error instanceof
|
|
100742
|
-
|
|
100743
|
-
|
|
100744
|
-
|
|
100745
|
-
const
|
|
100746
|
-
(0,_dereference_strategies_openapi_3_1_selectors_$
|
|
100960
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_32__["default"]) {
|
|
100961
|
+
schemaReference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.unsanitize($refBaseURI));
|
|
100962
|
+
const referenceAsSchema = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.maybeRefractToSchemaElement)(schemaReference.value.result);
|
|
100963
|
+
if ((0,_dereference_strategies_openapi_3_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_37__.isAnchor)((0,_dereference_strategies_openapi_3_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_37__.uriToAnchor)($refBaseURI))) {
|
|
100964
|
+
const selector = (0,_dereference_strategies_openapi_3_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_37__.uriToAnchor)($refBaseURI);
|
|
100965
|
+
(0,_dereference_strategies_openapi_3_1_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_37__.evaluate)(selector, referenceAsSchema);
|
|
100747
100966
|
} else {
|
|
100748
|
-
|
|
100749
|
-
|
|
100750
|
-
const referenceAsSchema = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
|
|
100751
|
-
(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.evaluate)(referenceAsSchema, selector);
|
|
100967
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
100968
|
+
(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(referenceAsSchema, selector);
|
|
100752
100969
|
}
|
|
100970
|
+
|
|
100971
|
+
// the resource to embed is the WHOLE external document (its root
|
|
100972
|
+
// schema), identified by its $id. A $ref into a fragment of the
|
|
100973
|
+
// document embeds the entire document resource once; the fragment
|
|
100974
|
+
// keeps resolving against the embedded $id.
|
|
100975
|
+
resourceRoot = referenceAsSchema;
|
|
100976
|
+
resourceBaseURI = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_39__.resolveSchema$idField)(_util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(schemaReference.uri), resourceRoot) ?? _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.stripHash(schemaReference.uri);
|
|
100753
100977
|
} else {
|
|
100754
100978
|
throw error;
|
|
100755
100979
|
}
|
|
100756
100980
|
}
|
|
100757
|
-
|
|
100758
|
-
// a $ref that resolves (by $id/$anchor/pointer) within the current document
|
|
100759
|
-
// is internal even when its URI form (e.g. a URN or absolute $id) is not a
|
|
100760
|
-
// bare fragment. Leave it untouched — it resolves against the in-document
|
|
100761
|
-
// $id graph, and embedding the current document into itself would be wrong.
|
|
100762
|
-
if (_util_url_mjs__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri) === _util_url_mjs__WEBPACK_IMPORTED_MODULE_32__.stripHash(this.reference.uri)) {
|
|
100763
|
-
return;
|
|
100764
|
-
}
|
|
100765
|
-
|
|
100766
|
-
// the resource to embed is the WHOLE external document (its root schema),
|
|
100767
|
-
// identified by its $id. A $ref into a fragment of the document embeds the
|
|
100768
|
-
// entire document resource once; the fragment keeps resolving against the
|
|
100769
|
-
// embedded $id.
|
|
100770
|
-
const resourceRoot = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
|
|
100771
|
-
const resourceBaseURI = (0,_dereference_strategies_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_38__.resolveSchema$idField)(_util_url_mjs__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri), resourceRoot) ?? _util_url_mjs__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri);
|
|
100772
100981
|
const field = cf.schemas.name;
|
|
100773
100982
|
const canonicalKey = `${field}\t${resourceBaseURI}`;
|
|
100774
100983
|
|
|
100775
|
-
//
|
|
100776
|
-
// $
|
|
100984
|
+
// a location-based $ref to a self-identifying resource is rebased onto the
|
|
100985
|
+
// resource's $id (keeping its fragment) — once embedded, the resource is
|
|
100986
|
+
// reachable only by its $id. A $ref already resolving to that $id is left
|
|
100987
|
+
// as written. See rebaseSchema$ref for the spec trade-off.
|
|
100988
|
+
//
|
|
100989
|
+
// a $ref whose base URI changes on relocation into the entry document
|
|
100990
|
+
// (inside a hoisted Response, Parameter, Path Item, ...) is instead
|
|
100991
|
+
// rewritten to address the embedded resource from the base it will have
|
|
100992
|
+
// there, otherwise it dangles once placed. See relocateSchema$ref.
|
|
100993
|
+
const relocatedBaseURI = this.relocatedSchemaBaseURI(path, $refBaseURI);
|
|
100994
|
+
const rebased$ref = relocatedBaseURI === undefined ? (0,_util_mjs__WEBPACK_IMPORTED_MODULE_40__.rebaseSchema$ref)($refBaseURI, resourceBaseURI) : (0,_util_mjs__WEBPACK_IMPORTED_MODULE_40__.relocateSchema$ref)($refBaseURI, resourceBaseURI, relocatedBaseURI, (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(resourceRoot.$id));
|
|
100995
|
+
|
|
100996
|
+
// resource already embedded (or being embedded) — point the referencing
|
|
100997
|
+
// $ref at it and stop. This also terminates circular external schema
|
|
100777
100998
|
// references, since the assignment is reserved BEFORE recursion.
|
|
100778
100999
|
if (this.assignments.has(canonicalKey)) {
|
|
101000
|
+
if (rebased$ref !== undefined) referencingElement.set('$ref', rebased$ref);
|
|
100779
101001
|
path.skip();
|
|
100780
101002
|
return;
|
|
100781
101003
|
}
|
|
100782
101004
|
|
|
100783
|
-
// own a copy of the resource
|
|
100784
|
-
|
|
100785
|
-
const embeddedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(resourceRoot);
|
|
100786
|
-
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(embeddedElement.$id)) {
|
|
100787
|
-
embeddedElement.set('$id', resourceBaseURI);
|
|
100788
|
-
}
|
|
101005
|
+
// own a copy of the resource
|
|
101006
|
+
const embeddedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(resourceRoot);
|
|
100789
101007
|
|
|
100790
101008
|
// the embedded thing is the WHOLE resource (keyed by its $id), so its name
|
|
100791
101009
|
// is derived from the resource URI, not the $ref fragment — passing a root
|
|
@@ -100796,7 +101014,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100796
101014
|
|
|
100797
101015
|
// reserve the assignment and component name before recursing so circular
|
|
100798
101016
|
// external schema references terminate
|
|
100799
|
-
this.assignments.set(canonicalKey, `#/components/${field}/${(0,
|
|
101017
|
+
this.assignments.set(canonicalKey, `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.escape)(componentName)}`);
|
|
100800
101018
|
if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
|
|
100801
101019
|
this.reservedNames.get(field).add(componentName);
|
|
100802
101020
|
|
|
@@ -100807,20 +101025,36 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100807
101025
|
options: this.options,
|
|
100808
101026
|
assignments: this.assignments,
|
|
100809
101027
|
reservedNames: this.reservedNames,
|
|
100810
|
-
refractCache: this.refractCache
|
|
101028
|
+
refractCache: this.refractCache,
|
|
101029
|
+
schema$idIndex: this.schema$idIndex,
|
|
101030
|
+
placements: this.placements
|
|
100811
101031
|
});
|
|
100812
|
-
const bundledElement = await (0,
|
|
101032
|
+
const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(embeddedElement, visitor, {
|
|
100813
101033
|
mutable: true
|
|
100814
101034
|
});
|
|
100815
101035
|
|
|
101036
|
+
// a resource without its own $id is identified by its retrieval URI; write
|
|
101037
|
+
// it relative to the entry document (the base of components.schemas) so the
|
|
101038
|
+
// bundle carries no absolute filesystem path and stays relocatable. Assigned
|
|
101039
|
+
// after the nested traversal so a reader deriving a schema's base from live
|
|
101040
|
+
// $ids (see #540) never resolves the resource's own $refs against the entry
|
|
101041
|
+
// document.
|
|
101042
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(bundledElement.$id)) {
|
|
101043
|
+
bundledElement.set('$id', _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.relative(this.entryURI, resourceBaseURI));
|
|
101044
|
+
}
|
|
101045
|
+
|
|
100816
101046
|
// annotate the embedded resource with info about its origin
|
|
100817
101047
|
bundledElement.meta.set('ref-origin', schemaReference.uri);
|
|
100818
101048
|
|
|
100819
|
-
//
|
|
100820
|
-
this.
|
|
101049
|
+
// queue the embedded resource for placement into the entry document's components
|
|
101050
|
+
this.placements.push({
|
|
101051
|
+
field,
|
|
101052
|
+
name: componentName,
|
|
101053
|
+
element: bundledElement
|
|
101054
|
+
});
|
|
100821
101055
|
|
|
100822
|
-
// the referencing $ref
|
|
100823
|
-
|
|
101056
|
+
// point the referencing $ref at the embedded resource's $id
|
|
101057
|
+
if (rebased$ref !== undefined) referencingElement.set('$ref', rebased$ref);
|
|
100824
101058
|
path.skip();
|
|
100825
101059
|
} catch (error) {
|
|
100826
101060
|
this.handleError(`Error while bundling Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
@@ -100843,12 +101077,12 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100843
101077
|
|
|
100844
101078
|
// value and externalValue fields are mutually exclusive
|
|
100845
101079
|
if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(exampleElement.externalValue)) {
|
|
100846
|
-
throw new
|
|
100847
|
-
value: (0,
|
|
100848
|
-
externalValue: (0,
|
|
101080
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
|
|
101081
|
+
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.value),
|
|
101082
|
+
externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue)
|
|
100849
101083
|
});
|
|
100850
101084
|
}
|
|
100851
|
-
const externalValue = (0,
|
|
101085
|
+
const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue);
|
|
100852
101086
|
const retrievalURI = this.toBaseURI(externalValue);
|
|
100853
101087
|
const isInternalReference = this.entryURI === retrievalURI;
|
|
100854
101088
|
const isExternalReference = !isInternalReference;
|
|
@@ -100859,9 +101093,9 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100859
101093
|
}
|
|
100860
101094
|
try {
|
|
100861
101095
|
const reference = await this.toReference(externalValue);
|
|
100862
|
-
const valueElement = (0,
|
|
101096
|
+
const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(reference.value.result);
|
|
100863
101097
|
valueElement.meta.set('ref-origin', reference.uri);
|
|
100864
|
-
const exampleElementCopy = (0,
|
|
101098
|
+
const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(exampleElement);
|
|
100865
101099
|
exampleElementCopy.value = valueElement;
|
|
100866
101100
|
exampleElementCopy.remove('externalValue');
|
|
100867
101101
|
path.replaceWith(exampleElementCopy);
|
|
@@ -100882,9 +101116,9 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100882
101116
|
|
|
100883
101117
|
// operationRef and operationId fields are mutually exclusive
|
|
100884
101118
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationRef) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationId)) {
|
|
100885
|
-
throw new
|
|
100886
|
-
operationRef: (0,
|
|
100887
|
-
operationId: (0,
|
|
101119
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
|
|
101120
|
+
operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef),
|
|
101121
|
+
operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId)
|
|
100888
101122
|
});
|
|
100889
101123
|
}
|
|
100890
101124
|
|
|
@@ -100892,7 +101126,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100892
101126
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationRef)) {
|
|
100893
101127
|
return;
|
|
100894
101128
|
}
|
|
100895
|
-
const operationRef = (0,
|
|
101129
|
+
const operationRef = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef);
|
|
100896
101130
|
const retrievalURI = this.toBaseURI(operationRef);
|
|
100897
101131
|
const isInternalReference = this.entryURI === retrievalURI;
|
|
100898
101132
|
if (isInternalReference) {
|
|
@@ -100909,7 +101143,7 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100909
101143
|
|
|
100910
101144
|
// rewrite to an absolute URI so the link keeps resolving once the document
|
|
100911
101145
|
// is treated as self-contained
|
|
100912
|
-
const absoluteURI =
|
|
101146
|
+
const absoluteURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_33__.resolve(this.reference.uri, operationRef);
|
|
100913
101147
|
if (absoluteURI !== operationRef) {
|
|
100914
101148
|
linkElement.set('operationRef', absoluteURI);
|
|
100915
101149
|
}
|
|
@@ -100928,6 +101162,8 @@ class OpenAPI3_1BundleVisitor {
|
|
|
100928
101162
|
|
|
100929
101163
|
"use strict";
|
|
100930
101164
|
__webpack_require__.r(__webpack_exports__);
|
|
101165
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18917);
|
|
101166
|
+
|
|
100931
101167
|
/**
|
|
100932
101168
|
* Upper-cases the first letter of each whitespace-separated word and joins
|
|
100933
101169
|
* them, e.g. `pet model` -> `PetModel`.
|
|
@@ -100961,7 +101197,60 @@ const uniqueName = (candidate, isTaken) => {
|
|
|
100961
101197
|
}
|
|
100962
101198
|
return `${candidate}-${counter}`;
|
|
100963
101199
|
};
|
|
101200
|
+
|
|
101201
|
+
/**
|
|
101202
|
+
* Computes the `$ref` value addressing an embedded JSON Schema resource by its
|
|
101203
|
+
* canonical `$id`. `$refURI` is the `$ref` resolved against the referencing
|
|
101204
|
+
* document's base URI; `resourceURI` is the embedded resource's canonical URI
|
|
101205
|
+
* (its `$id`, or the retrieval URI when it has none).
|
|
101206
|
+
*
|
|
101207
|
+
* When the two differ — a location-based `$ref` (e.g. `./ex.json#/$defs/Pet`)
|
|
101208
|
+
* to a resource that identifies itself differently (`$id: https://example.com/pets`)
|
|
101209
|
+
* — the `$ref` is rebased onto the resource URI, keeping its `$anchor` or JSON
|
|
101210
|
+
* Pointer fragment. Once embedded, the resource is reachable only by its `$id`,
|
|
101211
|
+
* so an unchanged `$ref` would dangle. When they already agree, `undefined` is
|
|
101212
|
+
* returned and the `$ref` is to be left as written.
|
|
101213
|
+
*
|
|
101214
|
+
* This knowingly departs from the letter of JSON Schema 2020-12 §9.3.1
|
|
101215
|
+
* ("references ... MUST NOT be changed"), which presumes `$ref`s are written
|
|
101216
|
+
* against `$id`s. The target schema — and thus evaluation output — is unchanged;
|
|
101217
|
+
* only the alias the loader knew the resource by is normalized to its canonical URI.
|
|
101218
|
+
*
|
|
101219
|
+
* @public
|
|
101220
|
+
*/
|
|
101221
|
+
const rebaseSchema$ref = ($refURI, resourceURI) => {
|
|
101222
|
+
if (_util_url_mjs__WEBPACK_IMPORTED_MODULE_0__.stripHash($refURI) === resourceURI) {
|
|
101223
|
+
return undefined;
|
|
101224
|
+
}
|
|
101225
|
+
const fragment = _util_url_mjs__WEBPACK_IMPORTED_MODULE_0__.getHash($refURI);
|
|
101226
|
+
return fragment === '#' ? resourceURI : `${resourceURI}${fragment}`;
|
|
101227
|
+
};
|
|
101228
|
+
|
|
101229
|
+
/**
|
|
101230
|
+
* Computes the `$ref` value addressing an embedded JSON Schema resource from a
|
|
101231
|
+
* Schema Object whose base URI changes when it is relocated into the entry
|
|
101232
|
+
* document — one carried inside a hoisted Response, Parameter, Path Item, etc.
|
|
101233
|
+
* `$refURI` and `resourceURI` are as in `rebaseSchema$ref`; `baseURI` is the
|
|
101234
|
+
* base the `$ref` resolves against after relocation.
|
|
101235
|
+
*
|
|
101236
|
+
* A resource that identifies itself (`isResourceIdentified`, i.e. it declares a
|
|
101237
|
+
* `$id`) is addressed by that `$id`, exactly as `rebaseSchema$ref` does. A
|
|
101238
|
+
* resource identified only by its retrieval URI is addressed by a URI reference
|
|
101239
|
+
* relative to `baseURI`: it then resolves to the `$id` assigned from that
|
|
101240
|
+
* retrieval URI wherever the bundle is placed, and no absolute retrieval
|
|
101241
|
+
* location leaks into the `$ref`. The `$anchor` or JSON Pointer fragment is
|
|
101242
|
+
* kept in both cases.
|
|
101243
|
+
*
|
|
101244
|
+
* @public
|
|
101245
|
+
*/
|
|
101246
|
+
const relocateSchema$ref = ($refURI, resourceURI, baseURI, isResourceIdentified) => {
|
|
101247
|
+
const target = isResourceIdentified ? resourceURI : _util_url_mjs__WEBPACK_IMPORTED_MODULE_0__.relative(baseURI, resourceURI);
|
|
101248
|
+
const fragment = _util_url_mjs__WEBPACK_IMPORTED_MODULE_0__.getHash($refURI);
|
|
101249
|
+
return fragment === '#' ? target : `${target}${fragment}`;
|
|
101250
|
+
};
|
|
100964
101251
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
101252
|
+
/* harmony export */ "rebaseSchema$ref", 0, /* binding */ rebaseSchema$ref,
|
|
101253
|
+
/* harmony export */ "relocateSchema$ref", 0, /* binding */ relocateSchema$ref,
|
|
100965
101254
|
/* harmony export */ "sanitizeComponentName", 0, /* binding */ sanitizeComponentName,
|
|
100966
101255
|
/* harmony export */ "toPascalCase", 0, /* binding */ toPascalCase,
|
|
100967
101256
|
/* harmony export */ "uniqueName", 0, /* binding */ uniqueName
|
|
@@ -101764,7 +102053,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
101764
102053
|
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(82302);
|
|
101765
102054
|
/* harmony import */ var _ReferenceSet_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(88526);
|
|
101766
102055
|
/* harmony import */ var _visitor_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55890);
|
|
101767
|
-
/* harmony import */ var
|
|
102056
|
+
/* harmony import */ var _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29587);
|
|
102057
|
+
/* harmony import */ var _source_descriptions_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(54553);
|
|
102058
|
+
|
|
101768
102059
|
|
|
101769
102060
|
|
|
101770
102061
|
|
|
@@ -101826,7 +102117,8 @@ class Arazzo1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IMPOR
|
|
|
101826
102117
|
const shouldDetectCircular = ['error', 'replace'].includes(options.dereference.circular);
|
|
101827
102118
|
const visitor = new _visitor_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
101828
102119
|
reference,
|
|
101829
|
-
options
|
|
102120
|
+
options,
|
|
102121
|
+
ancestorSchema$ids: (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_11__.detachedRootSchema$ids)(refSet.rootRef.value.result)
|
|
101830
102122
|
});
|
|
101831
102123
|
const dereferencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.traverseAsync)(refSet.rootRef.value, visitor, {
|
|
101832
102124
|
mutable: true,
|
|
@@ -101835,6 +102127,17 @@ class Arazzo1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IMPOR
|
|
|
101835
102127
|
})
|
|
101836
102128
|
});
|
|
101837
102129
|
|
|
102130
|
+
/**
|
|
102131
|
+
* If immutable option is set, replay refs from the refSet.
|
|
102132
|
+
* Replayed before source descriptions are dereferenced, so they can reuse the refs.
|
|
102133
|
+
*/
|
|
102134
|
+
if (options.dereference.immutable) {
|
|
102135
|
+
mutableRefSet.refs.filter(ref => ref.uri.startsWith('immutable://')).map(ref => new _Reference_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
|
|
102136
|
+
...ref,
|
|
102137
|
+
uri: ref.uri.replace(/^immutable:\/\//, '')
|
|
102138
|
+
})).forEach(ref => immutableRefSet.add(ref));
|
|
102139
|
+
}
|
|
102140
|
+
|
|
101838
102141
|
/**
|
|
101839
102142
|
* Dereference source descriptions if option is enabled.
|
|
101840
102143
|
*/
|
|
@@ -101845,20 +102148,10 @@ class Arazzo1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IMPOR
|
|
|
101845
102148
|
// drop any existing parse-phase source description results before pushing
|
|
101846
102149
|
const cleaned = parseResult.reject(item => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isParseResultElement)(item) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses)(item, ['source-description']));
|
|
101847
102150
|
parseResult.content = cleaned.content;
|
|
101848
|
-
const sourceDescriptions = await (0,
|
|
102151
|
+
const sourceDescriptions = await (0,_source_descriptions_mjs__WEBPACK_IMPORTED_MODULE_12__.dereferenceSourceDescriptions)(parseResult, reference.uri, options, this.name);
|
|
101849
102152
|
parseResult.push(...sourceDescriptions);
|
|
101850
102153
|
}
|
|
101851
102154
|
|
|
101852
|
-
/**
|
|
101853
|
-
* If immutable option is set, replay refs from the refSet.
|
|
101854
|
-
*/
|
|
101855
|
-
if (options.dereference.immutable) {
|
|
101856
|
-
mutableRefSet.refs.filter(ref => ref.uri.startsWith('immutable://')).map(ref => new _Reference_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
|
|
101857
|
-
...ref,
|
|
101858
|
-
uri: ref.uri.replace(/^immutable:\/\//, '')
|
|
101859
|
-
})).forEach(ref => immutableRefSet.add(ref));
|
|
101860
|
-
}
|
|
101861
|
-
|
|
101862
102155
|
/**
|
|
101863
102156
|
* Release all memory if this refSet was not provided as a configuration option.
|
|
101864
102157
|
* If provided as configuration option, then provider is responsible for cleanup.
|
|
@@ -101895,10 +102188,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
101895
102188
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4823);
|
|
101896
102189
|
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28839);
|
|
101897
102190
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(44673);
|
|
101898
|
-
/* harmony import */ var
|
|
101899
|
-
/* harmony import */ var
|
|
101900
|
-
/* harmony import */ var
|
|
101901
|
-
/* harmony import */ var
|
|
102191
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(164);
|
|
102192
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(18917);
|
|
102193
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82302);
|
|
102194
|
+
/* harmony import */ var _ReferenceSet_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(88526);
|
|
102195
|
+
/* harmony import */ var _options_util_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7778);
|
|
102196
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(85533);
|
|
102197
|
+
/* harmony import */ var _index_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(79920);
|
|
102198
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(42424);
|
|
102199
|
+
|
|
102200
|
+
|
|
102201
|
+
|
|
102202
|
+
|
|
101902
102203
|
|
|
101903
102204
|
|
|
101904
102205
|
|
|
@@ -101932,7 +102233,7 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
101932
102233
|
}
|
|
101933
102234
|
|
|
101934
102235
|
// normalize URI for consistent cycle detection and refSet cache key matching
|
|
101935
|
-
const retrievalURI =
|
|
102236
|
+
const retrievalURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_7__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_7__.stripHash(_util_url_mjs__WEBPACK_IMPORTED_MODULE_7__.resolve(ctx.baseURI, sourceDescriptionURI)));
|
|
101936
102237
|
parseResult.setMetaProperty('retrievalURI', retrievalURI);
|
|
101937
102238
|
|
|
101938
102239
|
// skip if the document is still being dereferenced higher up the chain (cycle detection)
|
|
@@ -101951,58 +102252,69 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
101951
102252
|
annotation.classes.push('info');
|
|
101952
102253
|
parseResult.push(annotation);
|
|
101953
102254
|
parseResult.meta.set('parseResult', sharedDereferenceResult);
|
|
101954
|
-
(0,
|
|
102255
|
+
(0,_util_mjs__WEBPACK_IMPORTED_MODULE_13__.validateSourceDescriptionAPI)(parseResult, sourceDescription, sharedDereferenceResult.api, retrievalURI);
|
|
101955
102256
|
return parseResult;
|
|
101956
102257
|
}
|
|
101957
102258
|
|
|
101958
102259
|
// check if source description was already parsed (e.g., during parse phase with sourceDescriptions: true)
|
|
101959
102260
|
const existingParseResult = sourceDescription.meta.get('parseResult');
|
|
102261
|
+
const parentRefSet = ctx.options.dereference.refSet;
|
|
102262
|
+
let refSet = null;
|
|
101960
102263
|
try {
|
|
101961
|
-
|
|
101962
|
-
|
|
101963
|
-
|
|
101964
|
-
|
|
101965
|
-
|
|
101966
|
-
|
|
101967
|
-
|
|
101968
|
-
|
|
101969
|
-
|
|
101970
|
-
},
|
|
101971
|
-
dereference: {
|
|
101972
|
-
strategyOpts: {
|
|
101973
|
-
// nested documents should dereference all their source descriptions
|
|
101974
|
-
// (parent's name filter doesn't apply to nested documents)
|
|
101975
|
-
// set at strategy-specific level to override any inherited filters
|
|
101976
|
-
[ctx.strategyName]: {
|
|
101977
|
-
sourceDescriptions: true,
|
|
101978
|
-
sourceDescriptionsDepth: ctx.currentDepth + 1,
|
|
101979
|
-
sourceDescriptionsAncestors: ctx.ancestors,
|
|
101980
|
-
sourceDescriptionsDereferenced: ctx.dereferenced
|
|
101981
|
-
}
|
|
101982
|
-
}
|
|
101983
|
-
}
|
|
101984
|
-
}));
|
|
102264
|
+
// source description document comes from, in order of preference:
|
|
102265
|
+
// caller-supplied refSet, parse phase, or is fetched and parsed now
|
|
102266
|
+
const cachedReference = parentRefSet?.find(ref => ref.uri === retrievalURI);
|
|
102267
|
+
let sourceDescriptionParseResult;
|
|
102268
|
+
let isFreshlyParsed = false;
|
|
102269
|
+
if (cachedReference !== undefined) {
|
|
102270
|
+
sourceDescriptionParseResult = cachedReference.value;
|
|
102271
|
+
} else if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement)(existingParseResult)) {
|
|
102272
|
+
sourceDescriptionParseResult = existingParseResult;
|
|
101985
102273
|
} else {
|
|
101986
|
-
|
|
101987
|
-
sourceDescriptionDereferenced = await (0,_index_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])(retrievalURI, (0,_options_util_mjs__WEBPACK_IMPORTED_MODULE_7__.merge)(ctx.options, {
|
|
102274
|
+
sourceDescriptionParseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_11__["default"])(retrievalURI, (0,_options_util_mjs__WEBPACK_IMPORTED_MODULE_10__.merge)(ctx.options, {
|
|
101988
102275
|
parse: {
|
|
101989
|
-
mediaType: 'text/plain'
|
|
101990
|
-
}
|
|
101991
|
-
dereference: {
|
|
101992
|
-
strategyOpts: {
|
|
101993
|
-
// nested documents should dereference all their source descriptions
|
|
101994
|
-
// (parent's name filter doesn't apply to nested documents)
|
|
101995
|
-
// set at strategy-specific level to override any inherited filters
|
|
101996
|
-
[ctx.strategyName]: {
|
|
101997
|
-
sourceDescriptions: true,
|
|
101998
|
-
sourceDescriptionsDepth: ctx.currentDepth + 1,
|
|
101999
|
-
sourceDescriptionsAncestors: ctx.ancestors,
|
|
102000
|
-
sourceDescriptionsDereferenced: ctx.dereferenced
|
|
102001
|
-
}
|
|
102002
|
-
}
|
|
102003
|
-
}
|
|
102276
|
+
mediaType: 'text/plain'
|
|
102277
|
+
} // allow parser plugin detection
|
|
102004
102278
|
}));
|
|
102279
|
+
isFreshlyParsed = true;
|
|
102280
|
+
}
|
|
102281
|
+
|
|
102282
|
+
// caller-supplied refSet is rooted at the entry document, but strategies dereference
|
|
102283
|
+
// the root of the refSet; re-root its references at the source description
|
|
102284
|
+
if (parentRefSet !== null) {
|
|
102285
|
+
refSet = new _ReferenceSet_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
102286
|
+
refs: [new _Reference_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
|
|
102287
|
+
uri: retrievalURI,
|
|
102288
|
+
value: sourceDescriptionParseResult
|
|
102289
|
+
}), ...parentRefSet.refs.map(ref => new _Reference_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
|
|
102290
|
+
...ref,
|
|
102291
|
+
refSet: undefined
|
|
102292
|
+
}))]
|
|
102293
|
+
});
|
|
102005
102294
|
}
|
|
102295
|
+
const sourceDescriptionDereferenced = await (0,_index_mjs__WEBPACK_IMPORTED_MODULE_12__.dereferenceApiDOM)(sourceDescriptionParseResult, (0,_options_util_mjs__WEBPACK_IMPORTED_MODULE_10__.merge)((0,ramda__WEBPACK_IMPORTED_MODULE_6__["default"])(['dereference', 'refSet'], refSet, ctx.options), {
|
|
102296
|
+
parse: {
|
|
102297
|
+
mediaType: 'text/plain' // allow dereference strategy detection via ApiDOM inspection
|
|
102298
|
+
},
|
|
102299
|
+
resolve: {
|
|
102300
|
+
baseURI: retrievalURI
|
|
102301
|
+
},
|
|
102302
|
+
dereference: {
|
|
102303
|
+
// freshly parsed document not reported to any refSet can be dereferenced in mutable mode
|
|
102304
|
+
immutable: ctx.options.dereference.immutable && !(isFreshlyParsed && parentRefSet === null),
|
|
102305
|
+
strategyOpts: {
|
|
102306
|
+
// nested documents should dereference all their source descriptions
|
|
102307
|
+
// (parent's name filter doesn't apply to nested documents)
|
|
102308
|
+
// set at strategy-specific level to override any inherited filters
|
|
102309
|
+
[ctx.strategyName]: {
|
|
102310
|
+
sourceDescriptions: true,
|
|
102311
|
+
sourceDescriptionsDepth: ctx.currentDepth + 1,
|
|
102312
|
+
sourceDescriptionsAncestors: ctx.ancestors,
|
|
102313
|
+
sourceDescriptionsDereferenced: ctx.dereferenced
|
|
102314
|
+
}
|
|
102315
|
+
}
|
|
102316
|
+
}
|
|
102317
|
+
}));
|
|
102006
102318
|
|
|
102007
102319
|
// merge dereferenced result into our parse result
|
|
102008
102320
|
for (const item of sourceDescriptionDereferenced) {
|
|
@@ -102015,16 +102327,23 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
102015
102327
|
annotation.classes.push('error');
|
|
102016
102328
|
parseResult.push(annotation);
|
|
102017
102329
|
return parseResult;
|
|
102330
|
+
} finally {
|
|
102331
|
+
// report documents reached through the source description to the caller-supplied refSet,
|
|
102332
|
+
// even when dereferencing it failed
|
|
102333
|
+
if (parentRefSet !== null && refSet !== null) {
|
|
102334
|
+
parentRefSet.merge(refSet);
|
|
102335
|
+
parentRefSet.circular ||= refSet.circular;
|
|
102336
|
+
}
|
|
102018
102337
|
}
|
|
102019
102338
|
|
|
102020
102339
|
// register dereferenced document for later references to it
|
|
102021
102340
|
const {
|
|
102022
102341
|
api: sourceDescriptionAPI
|
|
102023
102342
|
} = parseResult;
|
|
102024
|
-
for (const documentURI of (0,
|
|
102343
|
+
for (const documentURI of (0,_util_mjs__WEBPACK_IMPORTED_MODULE_13__.arazzoDocumentURIs)(retrievalURI, sourceDescriptionAPI)) {
|
|
102025
102344
|
ctx.dereferenced.set(documentURI, parseResult);
|
|
102026
102345
|
}
|
|
102027
|
-
;(0,
|
|
102346
|
+
;(0,_util_mjs__WEBPACK_IMPORTED_MODULE_13__.validateSourceDescriptionAPI)(parseResult, sourceDescription, sourceDescriptionAPI, retrievalURI);
|
|
102028
102347
|
return parseResult;
|
|
102029
102348
|
}
|
|
102030
102349
|
|
|
@@ -102077,7 +102396,7 @@ async function dereferenceSourceDescription(sourceDescription, ctx) {
|
|
|
102077
102396
|
* @public
|
|
102078
102397
|
*/
|
|
102079
102398
|
async function dereferenceSourceDescriptions(parseResult, parseResultRetrievalURI, options, strategyName = 'arazzo-1') {
|
|
102080
|
-
const retrievalURI =
|
|
102399
|
+
const retrievalURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_7__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_7__.stripHash(parseResultRetrievalURI));
|
|
102081
102400
|
const results = [];
|
|
102082
102401
|
|
|
102083
102402
|
// get API from dereferenced parse result
|
|
@@ -102108,7 +102427,7 @@ async function dereferenceSourceDescriptions(parseResult, parseResultRetrievalUR
|
|
|
102108
102427
|
const currentDepth = sharedOpts.sourceDescriptionsDepth ?? 0;
|
|
102109
102428
|
const dereferenced = sharedOpts.sourceDescriptionsDereferenced ?? new Map();
|
|
102110
102429
|
// current file is an ancestor of everything dereferenced below
|
|
102111
|
-
const ancestors = [...(sharedOpts.sourceDescriptionsAncestors ?? []), ...(0,
|
|
102430
|
+
const ancestors = [...(sharedOpts.sourceDescriptionsAncestors ?? []), ...(0,_util_mjs__WEBPACK_IMPORTED_MODULE_13__.arazzoDocumentURIs)(retrievalURI, api)];
|
|
102112
102431
|
if (currentDepth >= maxDepth) {
|
|
102113
102432
|
const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"](`Maximum dereference depth of ${maxDepth} has been exceeded by file "${retrievalURI}"`);
|
|
102114
102433
|
annotation.classes.push('error');
|
|
@@ -102118,7 +102437,7 @@ async function dereferenceSourceDescriptions(parseResult, parseResultRetrievalUR
|
|
|
102118
102437
|
}
|
|
102119
102438
|
const ctx = {
|
|
102120
102439
|
// base URI for resolving source description URLs honors Arazzo `$self` field
|
|
102121
|
-
baseURI: (0,
|
|
102440
|
+
baseURI: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_13__.resolveArazzo$selfField)(retrievalURI, api),
|
|
102122
102441
|
options,
|
|
102123
102442
|
strategyName,
|
|
102124
102443
|
currentDepth,
|
|
@@ -102154,7 +102473,8 @@ async function dereferenceSourceDescriptions(parseResult, parseResultRetrievalUR
|
|
|
102154
102473
|
__webpack_require__.r(__webpack_exports__);
|
|
102155
102474
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
102156
102475
|
/* harmony export */ resolveSchema$idField: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchema$idField),
|
|
102157
|
-
/* harmony export */ resolveSchema$refField: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchema$refField)
|
|
102476
|
+
/* harmony export */ resolveSchema$refField: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchema$refField),
|
|
102477
|
+
/* harmony export */ resolveSchemaBaseURI: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchemaBaseURI)
|
|
102158
102478
|
/* harmony export */ });
|
|
102159
102479
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
|
|
102160
102480
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84660);
|
|
@@ -102294,31 +102614,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
102294
102614
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87009);
|
|
102295
102615
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
|
|
102296
102616
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25162);
|
|
102297
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
102298
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
102299
|
-
/* harmony import */ var
|
|
102300
|
-
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
102301
|
-
/* harmony import */ var
|
|
102302
|
-
/* harmony import */ var
|
|
102303
|
-
/* harmony import */ var
|
|
102304
|
-
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
|
|
102305
|
-
/* harmony import */ var
|
|
102306
|
-
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
|
|
102307
|
-
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(
|
|
102308
|
-
/* harmony import */ var
|
|
102309
|
-
/* harmony import */ var
|
|
102310
|
-
/* harmony import */ var
|
|
102311
|
-
/* harmony import */ var
|
|
102312
|
-
/* harmony import */ var
|
|
102313
|
-
/* harmony import */ var
|
|
102314
|
-
/* harmony import */ var
|
|
102315
|
-
/* harmony import */ var
|
|
102316
|
-
/* harmony import */ var
|
|
102317
|
-
/* harmony import */ var
|
|
102318
|
-
/* harmony import */ var
|
|
102319
|
-
/* harmony import */ var
|
|
102320
|
-
/* harmony import */ var
|
|
102321
|
-
/* harmony import */ var
|
|
102617
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96911);
|
|
102618
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12111);
|
|
102619
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78894);
|
|
102620
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(44673);
|
|
102621
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16280);
|
|
102622
|
+
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(44641);
|
|
102623
|
+
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(80796);
|
|
102624
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(12020);
|
|
102625
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(61198);
|
|
102626
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(7557);
|
|
102627
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(96681);
|
|
102628
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(28839);
|
|
102629
|
+
/* harmony import */ var _swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(26847);
|
|
102630
|
+
/* harmony import */ var _selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10533);
|
|
102631
|
+
/* harmony import */ var _selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(92500);
|
|
102632
|
+
/* harmony import */ var _openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(40388);
|
|
102633
|
+
/* harmony import */ var _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(29587);
|
|
102634
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(42424);
|
|
102635
|
+
/* harmony import */ var _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(34968);
|
|
102636
|
+
/* harmony import */ var _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(86072);
|
|
102637
|
+
/* harmony import */ var _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(10476);
|
|
102638
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(18917);
|
|
102639
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(85533);
|
|
102640
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(82302);
|
|
102641
|
+
/* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(29217);
|
|
102642
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(14520);
|
|
102643
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(22820);
|
|
102644
|
+
|
|
102322
102645
|
|
|
102323
102646
|
|
|
102324
102647
|
|
|
@@ -102357,8 +102680,23 @@ class Arazzo1DereferenceVisitor {
|
|
|
102357
102680
|
*/
|
|
102358
102681
|
baseURI;
|
|
102359
102682
|
options;
|
|
102683
|
+
|
|
102684
|
+
/**
|
|
102685
|
+
* Index of `$id`-bearing schemas per document, shared across nested visitors
|
|
102686
|
+
* of a single dereference run so it never outlives mutations of the documents.
|
|
102687
|
+
*/
|
|
102688
|
+
schema$idIndex;
|
|
102360
102689
|
visited;
|
|
102361
102690
|
|
|
102691
|
+
/**
|
|
102692
|
+
* `$id`s of the JSON Schema elements enclosing the traversal root within its
|
|
102693
|
+
* document (outermost first). Empty when the root is the document itself; a
|
|
102694
|
+
* nested visitor traversing a fragment is seeded with the `$id`s of the
|
|
102695
|
+
* schemas the fragment sits under, so the `$ref`s and `$id`s within resolve
|
|
102696
|
+
* against the same base as they would from the document root.
|
|
102697
|
+
*/
|
|
102698
|
+
ancestorSchema$ids;
|
|
102699
|
+
|
|
102362
102700
|
/**
|
|
102363
102701
|
* Tracks element ancestors across dive-deep traversal boundaries.
|
|
102364
102702
|
* Used for cycle detection: if a referenced element is found in
|
|
@@ -102369,29 +102707,33 @@ class Arazzo1DereferenceVisitor {
|
|
|
102369
102707
|
reference,
|
|
102370
102708
|
options,
|
|
102371
102709
|
indirections = [],
|
|
102372
|
-
|
|
102373
|
-
|
|
102710
|
+
schema$idIndex = new WeakMap(),
|
|
102711
|
+
ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(),
|
|
102712
|
+
visited = new WeakSet(),
|
|
102713
|
+
ancestorSchema$ids = []
|
|
102374
102714
|
}) {
|
|
102375
102715
|
this.indirections = indirections;
|
|
102376
102716
|
this.reference = reference;
|
|
102377
|
-
this.baseURI = (0,
|
|
102717
|
+
this.baseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.resolveArazzo$selfField)(reference.uri, reference.value?.result);
|
|
102378
102718
|
this.options = options;
|
|
102379
|
-
this.
|
|
102719
|
+
this.schema$idIndex = schema$idIndex;
|
|
102720
|
+
this.ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(...ancestors);
|
|
102380
102721
|
this.visited = visited;
|
|
102722
|
+
this.ancestorSchema$ids = ancestorSchema$ids;
|
|
102381
102723
|
}
|
|
102382
102724
|
toAncestorLineage(path) {
|
|
102383
102725
|
const ancestorNodes = path.getAncestorNodes();
|
|
102384
102726
|
const directAncestors = new Set(ancestorNodes.filter(_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement));
|
|
102385
|
-
const ancestorsLineage = new
|
|
102727
|
+
const ancestorsLineage = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(...this.ancestors, directAncestors);
|
|
102386
102728
|
return [ancestorsLineage, directAncestors];
|
|
102387
102729
|
}
|
|
102388
102730
|
toBaseURI(uri) {
|
|
102389
|
-
return
|
|
102731
|
+
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.resolve(this.baseURI, _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash(uri)));
|
|
102390
102732
|
}
|
|
102391
102733
|
async toReference(uri) {
|
|
102392
102734
|
// detect maximum depth of resolution
|
|
102393
102735
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
102394
|
-
throw new
|
|
102736
|
+
throw new _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_23__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`, {
|
|
102395
102737
|
maxDepth: this.options.resolve.maxDepth,
|
|
102396
102738
|
uri: this.reference.uri
|
|
102397
102739
|
});
|
|
@@ -102407,11 +102749,11 @@ class Arazzo1DereferenceVisitor {
|
|
|
102407
102749
|
}
|
|
102408
102750
|
|
|
102409
102751
|
// identity-based referencing: URI matches `$self` of an already processed Arazzo document
|
|
102410
|
-
const referenceBy$self = refSet.find((0,
|
|
102752
|
+
const referenceBy$self = refSet.find((0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.identifiedBy$self)(baseURI));
|
|
102411
102753
|
if (referenceBy$self !== undefined) {
|
|
102412
102754
|
return referenceBy$self;
|
|
102413
102755
|
}
|
|
102414
|
-
const parseResult = await (0,
|
|
102756
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_25__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize(baseURI), {
|
|
102415
102757
|
...this.options,
|
|
102416
102758
|
parse: {
|
|
102417
102759
|
...this.options.parse,
|
|
@@ -102434,15 +102776,15 @@ class Arazzo1DereferenceVisitor {
|
|
|
102434
102776
|
// context always sees raw, unresolved elements and processes them with its own
|
|
102435
102777
|
// ancestors/indirections. The trade-off is that elements referenced by multiple
|
|
102436
102778
|
// documents would be resolved once per context instead of being reused.
|
|
102437
|
-
const mutableReference = new
|
|
102779
|
+
const mutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__["default"]({
|
|
102438
102780
|
uri: baseURI,
|
|
102439
|
-
value: this.options.dereference.immutable ? (0,
|
|
102781
|
+
value: this.options.dereference.immutable ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(parseResult) : parseResult,
|
|
102440
102782
|
depth: this.reference.depth + 1
|
|
102441
102783
|
});
|
|
102442
102784
|
refSet.add(mutableReference);
|
|
102443
102785
|
if (this.options.dereference.immutable) {
|
|
102444
102786
|
// register new immutable reference with a refSet
|
|
102445
|
-
const immutableReference = new
|
|
102787
|
+
const immutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__["default"]({
|
|
102446
102788
|
uri: `immutable://${baseURI}`,
|
|
102447
102789
|
value: parseResult,
|
|
102448
102790
|
depth: this.reference.depth + 1
|
|
@@ -102466,10 +102808,10 @@ class Arazzo1DereferenceVisitor {
|
|
|
102466
102808
|
const {
|
|
102467
102809
|
continueOnError
|
|
102468
102810
|
} = this.options.dereference;
|
|
102469
|
-
const isEntryDocument =
|
|
102811
|
+
const isEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
|
|
102470
102812
|
const uri = this.reference.uri;
|
|
102471
102813
|
const type = referencingElement.element;
|
|
102472
|
-
const codeFrame = (0,
|
|
102814
|
+
const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(referencingElement);
|
|
102473
102815
|
|
|
102474
102816
|
// find element location by identity in the document tree.
|
|
102475
102817
|
// guarded: this.reference.value may not be a ParseResultElement or may lack a result.
|
|
@@ -102478,7 +102820,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102478
102820
|
let location;
|
|
102479
102821
|
const root = this.reference.value.result;
|
|
102480
102822
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement)(root)) {
|
|
102481
|
-
(0,
|
|
102823
|
+
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverse)(root, {
|
|
102482
102824
|
enter(p) {
|
|
102483
102825
|
if (p.node === referencingElement) {
|
|
102484
102826
|
location = p.formatPath();
|
|
@@ -102499,10 +102841,10 @@ class Arazzo1DereferenceVisitor {
|
|
|
102499
102841
|
|
|
102500
102842
|
// enrich existing error from nested visitor or create new one
|
|
102501
102843
|
let unresolvedError;
|
|
102502
|
-
if (error instanceof
|
|
102844
|
+
if (error instanceof _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"]) {
|
|
102503
102845
|
// prefix relative locations for entries belonging to the referenced document
|
|
102504
102846
|
const refBaseURI = this.toBaseURI(refFieldValue);
|
|
102505
|
-
const fragment =
|
|
102847
|
+
const fragment = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference(refFieldValue);
|
|
102506
102848
|
if (fragment) {
|
|
102507
102849
|
if (refBaseURI === error.uri && error.location) {
|
|
102508
102850
|
error.location = fragment + error.location;
|
|
@@ -102515,7 +102857,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102515
102857
|
error.trace = [hop, ...error.trace];
|
|
102516
102858
|
unresolvedError = error;
|
|
102517
102859
|
} else {
|
|
102518
|
-
unresolvedError = new
|
|
102860
|
+
unresolvedError = new _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"](message, {
|
|
102519
102861
|
cause: error,
|
|
102520
102862
|
type,
|
|
102521
102863
|
uri,
|
|
@@ -102543,52 +102885,56 @@ class Arazzo1DereferenceVisitor {
|
|
|
102543
102885
|
path.skip();
|
|
102544
102886
|
return;
|
|
102545
102887
|
}
|
|
102546
|
-
const runtimeExpression = (0,
|
|
102547
|
-
|
|
102548
|
-
// parse the runtime expression
|
|
102549
|
-
const {
|
|
102550
|
-
result,
|
|
102551
|
-
tree
|
|
102552
|
-
} = (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_14__.parse)(runtimeExpression);
|
|
102553
|
-
if (!result.success) {
|
|
102554
|
-
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_7__["default"](`Invalid Reusable Object reference format: "${runtimeExpression}"`, {
|
|
102555
|
-
runtimeExpression
|
|
102556
|
-
});
|
|
102557
|
-
}
|
|
102558
|
-
|
|
102559
|
-
// ReusableElement can only reference components
|
|
102560
|
-
if (tree.type !== 'ComponentsExpression') {
|
|
102561
|
-
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_7__["default"](`Reusable Object reference "${runtimeExpression}" must be a components expression`, {
|
|
102562
|
-
runtimeExpression
|
|
102563
|
-
});
|
|
102564
|
-
}
|
|
102565
|
-
|
|
102566
|
-
// evaluate runtime expression as JSON Pointer to get the referenced element
|
|
102567
|
-
const jsonPointer = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.compile)(['components', tree.componentType, tree.componentName]);
|
|
102888
|
+
const runtimeExpression = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.reference);
|
|
102568
102889
|
let referencedElement;
|
|
102569
102890
|
try {
|
|
102570
|
-
|
|
102571
|
-
|
|
102572
|
-
|
|
102573
|
-
|
|
102574
|
-
});
|
|
102891
|
+
// parse the runtime expression
|
|
102892
|
+
const {
|
|
102893
|
+
result,
|
|
102894
|
+
tree
|
|
102895
|
+
} = (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_15__.parse)(runtimeExpression);
|
|
102896
|
+
if (!result.success) {
|
|
102897
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Invalid Reusable Object reference format: "${runtimeExpression}"`, {
|
|
102898
|
+
runtimeExpression
|
|
102899
|
+
});
|
|
102900
|
+
}
|
|
102901
|
+
|
|
102902
|
+
// ReusableElement can only reference components
|
|
102903
|
+
if (tree.type !== 'ComponentsExpression') {
|
|
102904
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Reusable Object reference "${runtimeExpression}" must be a components expression`, {
|
|
102905
|
+
runtimeExpression
|
|
102906
|
+
});
|
|
102907
|
+
}
|
|
102908
|
+
|
|
102909
|
+
// evaluate runtime expression as JSON Pointer to get the referenced element
|
|
102910
|
+
const jsonPointer = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.compile)(['components', tree.componentType, tree.componentName]);
|
|
102911
|
+
try {
|
|
102912
|
+
referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(this.reference.value.result, jsonPointer);
|
|
102913
|
+
} catch {
|
|
102914
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Reusable Object reference "${runtimeExpression}" cannot be resolved`, {
|
|
102915
|
+
runtimeExpression
|
|
102916
|
+
});
|
|
102917
|
+
}
|
|
102918
|
+
} catch (error) {
|
|
102919
|
+
this.handleError(`Error while dereferencing Reusable Object. Cannot resolve reference "${runtimeExpression}": ${error.message}`, error, referencingElement, 'reference', runtimeExpression, path);
|
|
102920
|
+
return;
|
|
102575
102921
|
}
|
|
102576
102922
|
|
|
102577
102923
|
/**
|
|
102578
102924
|
* Create a shallow clone of the referenced element to avoid modifying the original.
|
|
102579
102925
|
*/
|
|
102580
|
-
const mergedElement = (0,
|
|
102926
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(referencedElement);
|
|
102581
102927
|
// annotate with info about original referencing element
|
|
102582
102928
|
mergedElement.meta.set('ref-fields', {
|
|
102583
102929
|
reference: runtimeExpression,
|
|
102584
|
-
value: (0,
|
|
102930
|
+
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.value)
|
|
102585
102931
|
});
|
|
102586
102932
|
// annotate with info about origin
|
|
102587
102933
|
mergedElement.meta.set('ref-origin', this.reference.uri);
|
|
102588
102934
|
mergedElement.meta.set('ref-type', referencingElement.element);
|
|
102589
102935
|
|
|
102590
102936
|
// override value field if present for Parameter Objects
|
|
102591
|
-
if ((0,
|
|
102937
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_14__.isParameterElement)(mergedElement) && referencingElement.hasKey('value')) {
|
|
102592
102938
|
mergedElement.remove('value');
|
|
102593
102939
|
mergedElement.set('value', referencingElement.get('value'));
|
|
102594
102940
|
}
|
|
@@ -102615,13 +102961,17 @@ class Arazzo1DereferenceVisitor {
|
|
|
102615
102961
|
const indirectionsSize = this.indirections.length;
|
|
102616
102962
|
try {
|
|
102617
102963
|
// compute baseURI using rules around $self, $id and $ref keywords
|
|
102618
|
-
let reference = await this.toReference(
|
|
102964
|
+
let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize(this.reference.uri));
|
|
102619
102965
|
let {
|
|
102620
102966
|
uri: retrievalURI
|
|
102621
102967
|
} = reference;
|
|
102622
|
-
|
|
102623
|
-
|
|
102624
|
-
const
|
|
102968
|
+
// base URI in effect at the traversal root: the document base refined by
|
|
102969
|
+
// the $ids of the schemas enclosing the root when the root is a fragment
|
|
102970
|
+
const rootBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$ids)(this.baseURI, this.ancestorSchema$ids);
|
|
102971
|
+
const schemaBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchemaBaseURI)(rootBaseURI, path);
|
|
102972
|
+
const $refBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
102973
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash($refBaseURI);
|
|
102974
|
+
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
102625
102975
|
uri: $refBaseURIStrippedHash
|
|
102626
102976
|
});
|
|
102627
102977
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
|
|
@@ -102631,14 +102981,33 @@ class Arazzo1DereferenceVisitor {
|
|
|
102631
102981
|
|
|
102632
102982
|
// determining reference, proper evaluation and selection mechanism
|
|
102633
102983
|
let referencedElement;
|
|
102984
|
+
// $ids of the schemas enclosing the referenced element within its document
|
|
102985
|
+
let ancestorSchema$ids;
|
|
102634
102986
|
try {
|
|
102635
102987
|
if (isUnknownURI || isURL) {
|
|
102636
102988
|
// we're dealing with canonical URI or URL with possible fragment
|
|
102637
102989
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
102638
102990
|
const selector = $refBaseURI;
|
|
102639
|
-
const
|
|
102640
|
-
|
|
102641
|
-
|
|
102991
|
+
const documentElement = reference.value.result;
|
|
102992
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(documentElement);
|
|
102993
|
+
// a document that is itself a fragment detached from its source carries
|
|
102994
|
+
// the $ids enclosing it only as `ancestorSchema$ids`: its $ids are then
|
|
102995
|
+
// indexed against the base that chain leaves in effect, and the chain
|
|
102996
|
+
// prefixes the one of the located schema. A nested visitor rooted at a
|
|
102997
|
+
// fragment of a whole document indexes that document against its own base.
|
|
102998
|
+
const rootNode = path.getAncestorNodes().at(-1) ?? path.node;
|
|
102999
|
+
const isDocumentRoot = ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isParseResultElement)(rootNode) ? rootNode.result : rootNode) === documentElement;
|
|
103000
|
+
({
|
|
103001
|
+
element: referencedElement,
|
|
103002
|
+
ancestorSchema$ids
|
|
103003
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(selector, referenceAsSchema, {
|
|
103004
|
+
baseURI: isDocumentRoot ? rootBaseURI : this.baseURI,
|
|
103005
|
+
index: this.schema$idIndex
|
|
103006
|
+
}));
|
|
103007
|
+
if (isDocumentRoot) {
|
|
103008
|
+
ancestorSchema$ids = [...this.ancestorSchema$ids, ...ancestorSchema$ids];
|
|
103009
|
+
}
|
|
103010
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102642
103011
|
|
|
102643
103012
|
// ignore resolving internal Schema Objects
|
|
102644
103013
|
if (!this.options.resolve.internal && isInternalReference) {
|
|
@@ -102666,19 +103035,22 @@ class Arazzo1DereferenceVisitor {
|
|
|
102666
103035
|
// skip traversing this schema element but traverse all its child elements
|
|
102667
103036
|
return;
|
|
102668
103037
|
}
|
|
102669
|
-
reference = await this.toReference(
|
|
102670
|
-
const selector =
|
|
102671
|
-
const referenceAsSchema = (0,
|
|
102672
|
-
|
|
102673
|
-
|
|
103038
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103039
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
103040
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103041
|
+
({
|
|
103042
|
+
element: referencedElement,
|
|
103043
|
+
ancestorSchema$ids
|
|
103044
|
+
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(referenceAsSchema, selector));
|
|
103045
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102674
103046
|
}
|
|
102675
103047
|
} catch (error) {
|
|
102676
103048
|
/**
|
|
102677
103049
|
* JSONSchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
102678
103050
|
* the URL and assume the returned response is a JSON Schema.
|
|
102679
103051
|
*/
|
|
102680
|
-
if (isURL && error instanceof
|
|
102681
|
-
if ((0,_selectors_$
|
|
103052
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_29__["default"]) {
|
|
103053
|
+
if ((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.isAnchor)((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.uriToAnchor)($refBaseURI))) {
|
|
102682
103054
|
// we're dealing with JSON Schema $anchor here
|
|
102683
103055
|
isInternalReference = this.baseURI === retrievalURI;
|
|
102684
103056
|
isExternalReference = !isInternalReference;
|
|
@@ -102693,11 +103065,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102693
103065
|
// skip traversing this schema element but traverse all its child elements
|
|
102694
103066
|
return;
|
|
102695
103067
|
}
|
|
102696
|
-
reference = await this.toReference(
|
|
102697
|
-
const selector = (0,_selectors_$
|
|
102698
|
-
const referenceAsSchema = (0,
|
|
102699
|
-
|
|
102700
|
-
|
|
103068
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103069
|
+
const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.uriToAnchor)($refBaseURI);
|
|
103070
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103071
|
+
({
|
|
103072
|
+
element: referencedElement,
|
|
103073
|
+
ancestorSchema$ids
|
|
103074
|
+
} = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.locate)(selector, referenceAsSchema));
|
|
103075
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102701
103076
|
} else {
|
|
102702
103077
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
102703
103078
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
@@ -102714,11 +103089,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102714
103089
|
// skip traversing this schema element but traverse all its child elements
|
|
102715
103090
|
return;
|
|
102716
103091
|
}
|
|
102717
|
-
reference = await this.toReference(
|
|
102718
|
-
const selector =
|
|
102719
|
-
const referenceAsSchema = (0,
|
|
102720
|
-
|
|
102721
|
-
|
|
103092
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103093
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
103094
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103095
|
+
({
|
|
103096
|
+
element: referencedElement,
|
|
103097
|
+
ancestorSchema$ids
|
|
103098
|
+
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(referenceAsSchema, selector));
|
|
103099
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102722
103100
|
}
|
|
102723
103101
|
} else {
|
|
102724
103102
|
throw error;
|
|
@@ -102728,14 +103106,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102728
103106
|
|
|
102729
103107
|
// detect direct or indirect reference
|
|
102730
103108
|
if (referencingElement === referencedElement) {
|
|
102731
|
-
throw new
|
|
102732
|
-
$ref: (0,
|
|
103109
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('Recursive JSON Schema reference detected', {
|
|
103110
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102733
103111
|
});
|
|
102734
103112
|
}
|
|
102735
103113
|
|
|
102736
103114
|
// detect maximum depth of dereferencing
|
|
102737
103115
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
102738
|
-
throw new
|
|
103116
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
102739
103117
|
maxDepth: this.options.dereference.maxDepth,
|
|
102740
103118
|
uri: this.reference.uri
|
|
102741
103119
|
});
|
|
@@ -102746,14 +103124,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102746
103124
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
102747
103125
|
reference.refSet.circular = true;
|
|
102748
103126
|
if (this.options.dereference.circular === 'error') {
|
|
102749
|
-
throw new
|
|
102750
|
-
$ref: (0,
|
|
103127
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('Circular reference detected', {
|
|
103128
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102751
103129
|
});
|
|
102752
103130
|
} else if (this.options.dereference.circular === 'replace') {
|
|
102753
|
-
const refElement = new
|
|
103131
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"]($refBaseURI, {
|
|
102754
103132
|
type: referencingElement.element,
|
|
102755
103133
|
uri: reference.uri,
|
|
102756
|
-
$ref: (0,
|
|
103134
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102757
103135
|
});
|
|
102758
103136
|
const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
102759
103137
|
const replacement = replacer(refElement);
|
|
@@ -102772,9 +103150,13 @@ class Arazzo1DereferenceVisitor {
|
|
|
102772
103150
|
* 3. Fragment is a JSON Schema with $ref field. We need to follow it to get the eventual value
|
|
102773
103151
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
102774
103152
|
*/
|
|
102775
|
-
const isNonEntryDocument =
|
|
103153
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
102776
103154
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
102777
|
-
|
|
103155
|
+
// content transplanted into the referencing site is traversed under that
|
|
103156
|
+
// site's $id chain; a fragment enclosed by a different chain has its own
|
|
103157
|
+
// $refs resolved in place first, by a nested visitor seeded with that chain
|
|
103158
|
+
const hasDifferentEnclosingBase = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$ids)((0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.resolveArazzo$selfField)(reference.uri, reference.value.result), ancestorSchema$ids) !== (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$ids)(rootBaseURI, (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.schema$idsOf)(path.getAncestorNodes().reverse()));
|
|
103159
|
+
if ((isExternalReference || isNonEntryDocument || hasDifferentEnclosingBase || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__.isJSONSchemaElement)(referencedElement) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(referencedElement.$ref) || shouldDetectCircular && !this.visited.has(referencedElement)) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
102778
103160
|
if (shouldDetectCircular) {
|
|
102779
103161
|
this.visited.add(referencedElement);
|
|
102780
103162
|
}
|
|
@@ -102785,10 +103167,12 @@ class Arazzo1DereferenceVisitor {
|
|
|
102785
103167
|
reference,
|
|
102786
103168
|
indirections: [...this.indirections],
|
|
102787
103169
|
options: this.options,
|
|
103170
|
+
schema$idIndex: this.schema$idIndex,
|
|
102788
103171
|
visited: this.visited,
|
|
102789
|
-
ancestors: ancestorsLineage
|
|
103172
|
+
ancestors: ancestorsLineage,
|
|
103173
|
+
ancestorSchema$ids
|
|
102790
103174
|
});
|
|
102791
|
-
referencedElement = await (0,
|
|
103175
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(referencedElement, visitor, {
|
|
102792
103176
|
mutable: true,
|
|
102793
103177
|
skipVisited: 'skip'
|
|
102794
103178
|
});
|
|
@@ -102798,11 +103182,11 @@ class Arazzo1DereferenceVisitor {
|
|
|
102798
103182
|
}
|
|
102799
103183
|
|
|
102800
103184
|
// Boolean JSON Schemas
|
|
102801
|
-
if ((0,
|
|
102802
|
-
const booleanJsonSchemaElement = (0,
|
|
103185
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_13__.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
103186
|
+
const booleanJsonSchemaElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(referencedElement);
|
|
102803
103187
|
// annotate referenced element with info about original referencing element
|
|
102804
103188
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
102805
|
-
$ref: (0,
|
|
103189
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102806
103190
|
});
|
|
102807
103191
|
// annotate referenced element with info about origin
|
|
102808
103192
|
booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
|
|
@@ -102815,17 +103199,17 @@ class Arazzo1DereferenceVisitor {
|
|
|
102815
103199
|
/**
|
|
102816
103200
|
* Creating a new version of JSON Schema by merging fields from referenced Schema with referencing one.
|
|
102817
103201
|
*/
|
|
102818
|
-
if ((0,
|
|
102819
|
-
const mergedElement = (0,
|
|
103202
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__.isJSONSchemaElement)(referencedElement)) {
|
|
103203
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(referencedElement);
|
|
102820
103204
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
102821
103205
|
referencingElement.forEach((value, keyElement, item) => {
|
|
102822
|
-
mergedElement.remove((0,
|
|
103206
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement));
|
|
102823
103207
|
mergedElement.content.push(item);
|
|
102824
103208
|
});
|
|
102825
103209
|
mergedElement.remove('$ref');
|
|
102826
103210
|
// annotate referenced element with info about original referencing element
|
|
102827
103211
|
mergedElement.meta.set('ref-fields', {
|
|
102828
|
-
$ref: (0,
|
|
103212
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102829
103213
|
});
|
|
102830
103214
|
// annotate fragment with info about origin
|
|
102831
103215
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -102837,7 +103221,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102837
103221
|
*/
|
|
102838
103222
|
path.replaceWith(referencedElement);
|
|
102839
103223
|
} catch (error) {
|
|
102840
|
-
const $ref = (0,
|
|
103224
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref);
|
|
102841
103225
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
102842
103226
|
} finally {
|
|
102843
103227
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105107,6 +105491,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105107
105491
|
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(82302);
|
|
105108
105492
|
/* harmony import */ var _ReferenceSet_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(88526);
|
|
105109
105493
|
/* harmony import */ var _visitor_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(56519);
|
|
105494
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29587);
|
|
105495
|
+
|
|
105110
105496
|
|
|
105111
105497
|
|
|
105112
105498
|
|
|
@@ -105168,7 +105554,8 @@ class OpenAPI3_1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IM
|
|
|
105168
105554
|
const shouldDetectCircular = ['error', 'replace'].includes(options.dereference.circular);
|
|
105169
105555
|
const visitor = new _visitor_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
|
|
105170
105556
|
reference: reference,
|
|
105171
|
-
options
|
|
105557
|
+
options,
|
|
105558
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_10__.detachedRootSchema$ids)(refSet.rootRef.value.result)
|
|
105172
105559
|
});
|
|
105173
105560
|
const dereferencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_2__.traverseAsync)(refSet.rootRef.value, visitor, {
|
|
105174
105561
|
mutable: true,
|
|
@@ -105214,9 +105601,9 @@ class OpenAPI3_1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IM
|
|
|
105214
105601
|
"use strict";
|
|
105215
105602
|
__webpack_require__.r(__webpack_exports__);
|
|
105216
105603
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
105217
|
-
/* harmony export */ EvaluationJsonSchema$anchorError: () => (/* reexport safe */ _errors_EvaluationJsonSchema$
|
|
105218
|
-
/* harmony export */ InvalidJsonSchema$anchorError: () => (/* reexport safe */ _errors_InvalidJsonSchema$
|
|
105219
|
-
/* harmony export */ JsonSchema$anchorError: () => (/* reexport safe */ _errors_JsonSchema$
|
|
105604
|
+
/* harmony export */ EvaluationJsonSchema$anchorError: () => (/* reexport safe */ _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
105605
|
+
/* harmony export */ InvalidJsonSchema$anchorError: () => (/* reexport safe */ _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
105606
|
+
/* harmony export */ JsonSchema$anchorError: () => (/* reexport safe */ _errors_JsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_9__["default"])
|
|
105220
105607
|
/* harmony export */ });
|
|
105221
105608
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33031);
|
|
105222
105609
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64988);
|
|
@@ -105224,9 +105611,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105224
105611
|
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80796);
|
|
105225
105612
|
/* harmony import */ var _speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7557);
|
|
105226
105613
|
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18917);
|
|
105227
|
-
/* harmony import */ var
|
|
105228
|
-
/* harmony import */ var
|
|
105229
|
-
/* harmony import */ var
|
|
105614
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29587);
|
|
105615
|
+
/* harmony import */ var _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(27267);
|
|
105616
|
+
/* harmony import */ var _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82450);
|
|
105617
|
+
/* harmony import */ var _errors_JsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55689);
|
|
105618
|
+
|
|
105230
105619
|
|
|
105231
105620
|
|
|
105232
105621
|
|
|
@@ -105260,35 +105649,82 @@ const uriToAnchor = uri => {
|
|
|
105260
105649
|
*/
|
|
105261
105650
|
const parse = anchor => {
|
|
105262
105651
|
if (!isAnchor(anchor)) {
|
|
105263
|
-
throw new _errors_InvalidJsonSchema$
|
|
105652
|
+
throw new _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"](anchor);
|
|
105264
105653
|
}
|
|
105265
105654
|
return anchor;
|
|
105266
105655
|
};
|
|
105267
105656
|
|
|
105268
105657
|
/**
|
|
105269
|
-
*
|
|
105658
|
+
* Locates the schema identified by JSON Schema $anchor within ApiDOM fragment,
|
|
105659
|
+
* along with the `$id`s of the schemas enclosing it, the search root included.
|
|
105270
105660
|
* @public
|
|
105271
105661
|
*/
|
|
105272
|
-
const
|
|
105662
|
+
const locate = (anchor, element) => {
|
|
105273
105663
|
const token = parse(anchor);
|
|
105274
105664
|
const resultPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.find)(element,
|
|
105275
105665
|
// @ts-ignore
|
|
105276
105666
|
path => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__.isJSONSchemaElement)(path.node) && (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(path.node.$anchor) === token);
|
|
105277
105667
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(resultPath)) {
|
|
105278
|
-
throw new _errors_EvaluationJsonSchema$
|
|
105668
|
+
throw new _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"](`Evaluation failed on token: "${token}"`);
|
|
105279
105669
|
}
|
|
105280
|
-
return
|
|
105670
|
+
return {
|
|
105671
|
+
element: resultPath.node,
|
|
105672
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_6__.schema$idsOf)(resultPath.getAncestorNodes().reverse())
|
|
105673
|
+
};
|
|
105281
105674
|
};
|
|
105282
105675
|
|
|
105676
|
+
/**
|
|
105677
|
+
* Evaluates JSON Schema $anchor against ApiDOM fragment.
|
|
105678
|
+
* @public
|
|
105679
|
+
*/
|
|
105680
|
+
const evaluate = (anchor, element) => locate(anchor, element).element;
|
|
105681
|
+
|
|
105283
105682
|
|
|
105284
105683
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105285
105684
|
/* harmony export */ "evaluate", 0, /* binding */ evaluate,
|
|
105286
105685
|
/* harmony export */ "isAnchor", 0, /* binding */ isAnchor,
|
|
105686
|
+
/* harmony export */ "locate", 0, /* binding */ locate,
|
|
105287
105687
|
/* harmony export */ "parse", 0, /* binding */ parse,
|
|
105288
105688
|
/* harmony export */ "uriToAnchor", 0, /* binding */ uriToAnchor
|
|
105289
105689
|
/* harmony export */ ]);
|
|
105290
105690
|
|
|
105291
105691
|
|
|
105692
|
+
/***/ },
|
|
105693
|
+
|
|
105694
|
+
/***/ 40388
|
|
105695
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
105696
|
+
|
|
105697
|
+
"use strict";
|
|
105698
|
+
__webpack_require__.r(__webpack_exports__);
|
|
105699
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12020);
|
|
105700
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29587);
|
|
105701
|
+
|
|
105702
|
+
|
|
105703
|
+
/**
|
|
105704
|
+
* Locates the element addressed by JSON Pointer within ApiDOM fragment, along
|
|
105705
|
+
* with the `$id`s of the schemas enclosing it: the elements the pointer walks
|
|
105706
|
+
* through on its way to the target, the search root included.
|
|
105707
|
+
*/
|
|
105708
|
+
const locate = (element, jsonPointer) => {
|
|
105709
|
+
const trace = {
|
|
105710
|
+
steps: []
|
|
105711
|
+
};
|
|
105712
|
+
const result = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_0__.evaluate)(element, jsonPointer, {
|
|
105713
|
+
trace
|
|
105714
|
+
});
|
|
105715
|
+
|
|
105716
|
+
// each step's input is the node the token was applied to, so the inputs are
|
|
105717
|
+
// exactly the walked nodes minus the target
|
|
105718
|
+
return {
|
|
105719
|
+
element: result,
|
|
105720
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_1__.schema$idsOf)(trace.steps.map(step => step.input))
|
|
105721
|
+
};
|
|
105722
|
+
};
|
|
105723
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105724
|
+
/* harmony export */ "locate", 0, /* binding */ locate
|
|
105725
|
+
/* harmony export */ ]);
|
|
105726
|
+
|
|
105727
|
+
|
|
105292
105728
|
/***/ },
|
|
105293
105729
|
|
|
105294
105730
|
/***/ 92500
|
|
@@ -105297,19 +105733,18 @@ const evaluate = (anchor, element) => {
|
|
|
105297
105733
|
"use strict";
|
|
105298
105734
|
__webpack_require__.r(__webpack_exports__);
|
|
105299
105735
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
105300
|
-
/* harmony export */ EvaluationJsonSchemaUriError: () => (/* reexport safe */
|
|
105301
|
-
/* harmony export */ JsonSchemaUriError: () => (/* reexport safe */
|
|
105736
|
+
/* harmony export */ EvaluationJsonSchemaUriError: () => (/* reexport safe */ _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
|
|
105737
|
+
/* harmony export */ JsonSchemaUriError: () => (/* reexport safe */ _errors_JsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])
|
|
105302
105738
|
/* harmony export */ });
|
|
105303
105739
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33031);
|
|
105304
105740
|
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80796);
|
|
105305
|
-
/* harmony import */ var
|
|
105306
|
-
/* harmony import */ var
|
|
105307
|
-
/* harmony import */ var
|
|
105308
|
-
/* harmony import */ var
|
|
105309
|
-
/* harmony import */ var
|
|
105310
|
-
/* harmony import */ var
|
|
105311
|
-
/* harmony import */ var
|
|
105312
|
-
/* harmony import */ var _errors_JsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3438);
|
|
105741
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61198);
|
|
105742
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18917);
|
|
105743
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22820);
|
|
105744
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29587);
|
|
105745
|
+
/* harmony import */ var _$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10533);
|
|
105746
|
+
/* harmony import */ var _json_pointer_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40388);
|
|
105747
|
+
/* harmony import */ var _errors_JsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3438);
|
|
105313
105748
|
|
|
105314
105749
|
|
|
105315
105750
|
|
|
@@ -105319,41 +105754,66 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105319
105754
|
|
|
105320
105755
|
|
|
105321
105756
|
/**
|
|
105322
|
-
*
|
|
105757
|
+
* Index of `$id`-bearing schemas per indexed element (a document root, or the
|
|
105758
|
+
* fragment a visitor traverses). Each entry pairs a schema with the `$id`s of its
|
|
105759
|
+
* enclosing schema resources (outermost first, including its own). The index is
|
|
105760
|
+
* populated once per element and never refreshed, so callers scope it
|
|
105761
|
+
* to a single dereference/bundle run instead of sharing it globally. Within a run the
|
|
105762
|
+
* `$id` graph of an indexed document is stable: the bundle strategies mutate deep
|
|
105763
|
+
* clones and place components only after the entry traversal ends, and the
|
|
105764
|
+
* dereference strategies only replace `$ref`-bearing schemas.
|
|
105323
105765
|
* @public
|
|
105324
105766
|
*/
|
|
105325
|
-
|
|
105326
|
-
|
|
105327
|
-
|
|
105328
|
-
|
|
105329
|
-
|
|
105330
|
-
|
|
105767
|
+
/**
|
|
105768
|
+
* @public
|
|
105769
|
+
*/
|
|
105770
|
+
const indexSchema$ids = element => (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__.filter)(element, path => (0,_util_mjs__WEBPACK_IMPORTED_MODULE_5__.isJSONSchemaElementWith$id)(path.node)).map(path => ({
|
|
105771
|
+
schema: path.node,
|
|
105772
|
+
$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_5__.collectSchema$ids)(path)
|
|
105773
|
+
}));
|
|
105331
105774
|
|
|
105332
|
-
|
|
105333
|
-
|
|
105334
|
-
|
|
105335
|
-
|
|
105775
|
+
/**
|
|
105776
|
+
* Locates the schema addressed by JSON Schema $ref containing unknown URI within
|
|
105777
|
+
* ApiDOM fragment, along with the `$id`s of the schemas enclosing it.
|
|
105778
|
+
* @public
|
|
105779
|
+
*/
|
|
105780
|
+
const locate = (uri, element, options = {}) => {
|
|
105781
|
+
const uriStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_3__.stripHash(uri);
|
|
105782
|
+
const {
|
|
105783
|
+
baseURI = uriStrippedHash,
|
|
105784
|
+
index = new WeakMap()
|
|
105785
|
+
} = options;
|
|
105786
|
+
if (!index.has(element)) {
|
|
105787
|
+
index.set(element, indexSchema$ids(element));
|
|
105336
105788
|
}
|
|
105337
105789
|
|
|
105338
|
-
// search for the
|
|
105339
|
-
const
|
|
105340
|
-
|
|
105341
|
-
|
|
105342
|
-
|
|
105343
|
-
|
|
105344
|
-
throw new _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"](`Evaluation failed on URI: "${uri}"`);
|
|
105345
|
-
}
|
|
105346
|
-
if ((0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_7__.isAnchor)((0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_7__.uriToAnchor)(uri))) {
|
|
105347
|
-
// we're dealing with JSON Schema $anchor here
|
|
105348
|
-
return (0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_7__.evaluate)((0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_7__.uriToAnchor)(uri), result);
|
|
105790
|
+
// search for the schema whose canonical URI matches
|
|
105791
|
+
const entry = index.get(element).find(({
|
|
105792
|
+
$ids
|
|
105793
|
+
}) => (0,_util_mjs__WEBPACK_IMPORTED_MODULE_5__.resolveSchema$ids)(baseURI, $ids) === uriStrippedHash);
|
|
105794
|
+
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(entry)) {
|
|
105795
|
+
throw new _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"](`Evaluation failed on URI: "${uri}"`);
|
|
105349
105796
|
}
|
|
105350
|
-
|
|
105797
|
+
|
|
105798
|
+
// the fragment is resolved within the matched schema, whose own $id is the
|
|
105799
|
+
// last of its chain; the fragment walk contributes it again when descending
|
|
105800
|
+
const fragmentLocation = (0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__.isAnchor)((0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__.uriToAnchor)(uri)) ? (0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__.locate)((0,_$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__.uriToAnchor)(uri), entry.schema) : (0,_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_7__.locate)(entry.schema, _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_2__.URIFragmentIdentifier.fromURIReference(uri));
|
|
105801
|
+
return {
|
|
105802
|
+
element: fragmentLocation.element,
|
|
105803
|
+
ancestorSchema$ids: [...entry.$ids.slice(0, -1), ...fragmentLocation.ancestorSchema$ids]
|
|
105804
|
+
};
|
|
105351
105805
|
};
|
|
105352
|
-
|
|
105806
|
+
|
|
105807
|
+
/**
|
|
105808
|
+
* Evaluates JSON Schema $ref containing unknown URI against ApiDOM fragment.
|
|
105809
|
+
* @public
|
|
105810
|
+
*/
|
|
105811
|
+
const evaluate = (uri, element, options = {}) => locate(uri, element, options).element;
|
|
105353
105812
|
|
|
105354
105813
|
|
|
105355
105814
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105356
|
-
/* harmony export */ "evaluate", 0, /* binding */ evaluate
|
|
105815
|
+
/* harmony export */ "evaluate", 0, /* binding */ evaluate,
|
|
105816
|
+
/* harmony export */ "locate", 0, /* binding */ locate
|
|
105357
105817
|
/* harmony export */ ]);
|
|
105358
105818
|
|
|
105359
105819
|
|
|
@@ -105365,41 +105825,97 @@ evaluate.cache = new WeakMap();
|
|
|
105365
105825
|
"use strict";
|
|
105366
105826
|
__webpack_require__.r(__webpack_exports__);
|
|
105367
105827
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97797);
|
|
105368
|
-
/* harmony import */ var
|
|
105369
|
-
/* harmony import */ var
|
|
105370
|
-
/* harmony import */ var
|
|
105371
|
-
/* harmony import */ var
|
|
105828
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85102);
|
|
105829
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25162);
|
|
105830
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44673);
|
|
105831
|
+
/* harmony import */ var _speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7557);
|
|
105832
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24329);
|
|
105833
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(18917);
|
|
105834
|
+
|
|
105835
|
+
|
|
105836
|
+
|
|
105837
|
+
|
|
105372
105838
|
|
|
105373
105839
|
|
|
105374
105840
|
|
|
105841
|
+
/**
|
|
105842
|
+
* A schema located within a document, together with the `$id`s of the JSON Schema
|
|
105843
|
+
* elements enclosing it (outermost first; the located schema's own `$id` excluded).
|
|
105844
|
+
* @public
|
|
105845
|
+
*/
|
|
105846
|
+
/**
|
|
105847
|
+
* Whether the element is a JSON Schema element declaring a `$id`.
|
|
105848
|
+
*/
|
|
105849
|
+
const isJSONSchemaElementWith$id = element => (0,_speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__.isJSONSchemaElement)(element) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(element.$id);
|
|
105850
|
+
|
|
105851
|
+
/**
|
|
105852
|
+
* `$id`s declared by the JSON Schema elements among `nodes`, in order.
|
|
105853
|
+
*/
|
|
105854
|
+
const schema$idsOf = nodes => nodes.filter(isJSONSchemaElementWith$id).map(node => (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(node.$id));
|
|
105855
|
+
|
|
105856
|
+
/**
|
|
105857
|
+
* `$id`s of the JSON Schema elements on `path` (outermost first, the node itself
|
|
105858
|
+
* included). The `$id`s are read from the elements themselves rather than from
|
|
105859
|
+
* refraction-time metadata, so a `$id` assigned after refraction (e.g. by the
|
|
105860
|
+
* bundler) is honored.
|
|
105861
|
+
*/
|
|
105862
|
+
const collectSchema$ids = path => schema$idsOf([...path.getAncestorNodes().reverse(), path.node]);
|
|
105863
|
+
|
|
105864
|
+
/**
|
|
105865
|
+
* `$id`s of the schemas enclosing a traversal root that is a fragment detached
|
|
105866
|
+
* from its document, read from the `ancestorsSchemaIdentifiers` meta the JSON
|
|
105867
|
+
* Schema refractors record. The meta also carries the root's own `$id`, which
|
|
105868
|
+
* the ancestor walk contributes itself, so it is dropped. A detached fragment
|
|
105869
|
+
* has no live ancestors, so the meta is the only carrier of its lexical
|
|
105870
|
+
* context; this is the one reader of it the refractors must keep serving.
|
|
105871
|
+
*/
|
|
105872
|
+
const detachedRootSchema$ids = root => {
|
|
105873
|
+
const meta = root?.meta.get('ancestorsSchemaIdentifiers');
|
|
105874
|
+
const $ids = Array.isArray(meta) ? meta.filter(ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"]) : [];
|
|
105875
|
+
const own$id = isJSONSchemaElementWith$id(root) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(root.$id) : undefined;
|
|
105876
|
+
return $ids.length > 0 && $ids.at(-1) === own$id ? $ids.slice(0, -1) : $ids;
|
|
105877
|
+
};
|
|
105878
|
+
|
|
105879
|
+
/**
|
|
105880
|
+
* Resolves a chain of `$id`s (outermost first) against `baseURI`, each `$id`
|
|
105881
|
+
* refining the base the next one resolves against.
|
|
105882
|
+
*/
|
|
105883
|
+
const resolveSchema$ids = (baseURI, $ids) => (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])((acc, $id) => _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.resolve(acc, _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.stripHash($id))), baseURI, $ids);
|
|
105375
105884
|
|
|
105885
|
+
/**
|
|
105886
|
+
* Resolves the base URI of the schema at `path`: `baseURI` (the base URI in
|
|
105887
|
+
* effect at the traversal root) refined by each `$id` on the schema's ancestor
|
|
105888
|
+
* chain in turn, the schema's own `$id` included.
|
|
105889
|
+
*/
|
|
105890
|
+
const resolveSchemaBaseURI = (baseURI, path) => resolveSchema$ids(baseURI, collectSchema$ids(path));
|
|
105376
105891
|
|
|
105377
105892
|
/**
|
|
105893
|
+
* Resolves the `$ref` of the schema against its base URI (see
|
|
105894
|
+
* `resolveSchemaBaseURI`), or returns `undefined` when the schema has no string `$ref`.
|
|
105895
|
+
*
|
|
105378
105896
|
* @public
|
|
105379
105897
|
*/
|
|
105380
|
-
const resolveSchema$refField = (
|
|
105381
|
-
if (
|
|
105898
|
+
const resolveSchema$refField = (schemaBaseURI, schemaElement) => {
|
|
105899
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(schemaElement.$ref)) {
|
|
105382
105900
|
return undefined;
|
|
105383
105901
|
}
|
|
105384
|
-
const
|
|
105385
|
-
const
|
|
105386
|
-
const $refBaseURI = (
|
|
105387
|
-
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.resolve(acc, _util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.stripHash(uri)));
|
|
105388
|
-
}, retrievalURI, [...ancestorsSchemaIdentifiers, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_2__["default"])(schemaElement.$ref)]);
|
|
105902
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaElement.$ref);
|
|
105903
|
+
const hash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.getHash($ref);
|
|
105904
|
+
const $refBaseURI = resolveSchema$ids(schemaBaseURI, [$ref]);
|
|
105389
105905
|
return `${$refBaseURI}${hash === '#' ? '' : hash}`;
|
|
105390
105906
|
};
|
|
105391
105907
|
|
|
105392
105908
|
/**
|
|
105909
|
+
* Resolves the `$id` of the schema against `baseURI`, the base URI in effect
|
|
105910
|
+
* where the schema sits, or returns `undefined` when the schema declares no string `$id`.
|
|
105911
|
+
*
|
|
105393
105912
|
* @public
|
|
105394
105913
|
*/
|
|
105395
|
-
const resolveSchema$idField = (
|
|
105396
|
-
if (
|
|
105914
|
+
const resolveSchema$idField = (baseURI, schemaElement) => {
|
|
105915
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(schemaElement.$id)) {
|
|
105397
105916
|
return undefined;
|
|
105398
105917
|
}
|
|
105399
|
-
|
|
105400
|
-
return (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])((acc, $id) => {
|
|
105401
|
-
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.resolve(acc, _util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_4__.stripHash($id)));
|
|
105402
|
-
}, retrievalURI, ancestorsSchemaIdentifiers);
|
|
105918
|
+
return resolveSchema$ids(baseURI, [(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaElement.$id)]);
|
|
105403
105919
|
};
|
|
105404
105920
|
|
|
105405
105921
|
/**
|
|
@@ -105409,7 +105925,7 @@ const refractToSchemaElement = element => {
|
|
|
105409
105925
|
if (refractToSchemaElement.cache.has(element)) {
|
|
105410
105926
|
return refractToSchemaElement.cache.get(element);
|
|
105411
105927
|
}
|
|
105412
|
-
const refracted = (0,
|
|
105928
|
+
const refracted = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__.refractSchema)(element);
|
|
105413
105929
|
refractToSchemaElement.cache.set(element, refracted);
|
|
105414
105930
|
return refracted;
|
|
105415
105931
|
};
|
|
@@ -105423,16 +105939,22 @@ const maybeRefractToSchemaElement = element => {
|
|
|
105423
105939
|
* Conditional version of refractToSchemaElement, that acts as an identity
|
|
105424
105940
|
* function for all non-primitive Element instances.
|
|
105425
105941
|
*/
|
|
105426
|
-
if ((0,
|
|
105942
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isPrimitiveElement)(element)) {
|
|
105427
105943
|
return refractToSchemaElement(element);
|
|
105428
105944
|
}
|
|
105429
105945
|
return element;
|
|
105430
105946
|
};
|
|
105431
105947
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105948
|
+
/* harmony export */ "collectSchema$ids", 0, /* binding */ collectSchema$ids,
|
|
105949
|
+
/* harmony export */ "detachedRootSchema$ids", 0, /* binding */ detachedRootSchema$ids,
|
|
105950
|
+
/* harmony export */ "isJSONSchemaElementWith$id", 0, /* binding */ isJSONSchemaElementWith$id,
|
|
105432
105951
|
/* harmony export */ "maybeRefractToSchemaElement", 0, /* binding */ maybeRefractToSchemaElement,
|
|
105433
105952
|
/* harmony export */ "refractToSchemaElement", 0, /* binding */ refractToSchemaElement,
|
|
105434
105953
|
/* harmony export */ "resolveSchema$idField", 0, /* binding */ resolveSchema$idField,
|
|
105435
|
-
/* harmony export */ "resolveSchema$
|
|
105954
|
+
/* harmony export */ "resolveSchema$ids", 0, /* binding */ resolveSchema$ids,
|
|
105955
|
+
/* harmony export */ "resolveSchema$refField", 0, /* binding */ resolveSchema$refField,
|
|
105956
|
+
/* harmony export */ "resolveSchemaBaseURI", 0, /* binding */ resolveSchemaBaseURI,
|
|
105957
|
+
/* harmony export */ "schema$idsOf", 0, /* binding */ schema$idsOf
|
|
105436
105958
|
/* harmony export */ ]);
|
|
105437
105959
|
|
|
105438
105960
|
|
|
@@ -105447,31 +105969,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105447
105969
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
|
|
105448
105970
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33031);
|
|
105449
105971
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25162);
|
|
105450
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
105451
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
105452
|
-
/* harmony import */ var
|
|
105453
|
-
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
105454
|
-
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
105455
|
-
/* harmony import */ var
|
|
105456
|
-
/* harmony import */ var
|
|
105457
|
-
/* harmony import */ var
|
|
105458
|
-
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
|
|
105459
|
-
/* harmony import */ var
|
|
105460
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(
|
|
105461
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(
|
|
105462
|
-
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(
|
|
105463
|
-
/* harmony import */ var
|
|
105464
|
-
/* harmony import */ var
|
|
105465
|
-
/* harmony import */ var
|
|
105466
|
-
/* harmony import */ var
|
|
105467
|
-
/* harmony import */ var
|
|
105468
|
-
/* harmony import */ var
|
|
105469
|
-
/* harmony import */ var
|
|
105470
|
-
/* harmony import */ var
|
|
105471
|
-
/* harmony import */ var
|
|
105472
|
-
/* harmony import */ var
|
|
105473
|
-
/* harmony import */ var
|
|
105474
|
-
/* harmony import */ var
|
|
105972
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(96911);
|
|
105973
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(12111);
|
|
105974
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(78894);
|
|
105975
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(37205);
|
|
105976
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(44673);
|
|
105977
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(16280);
|
|
105978
|
+
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(44641);
|
|
105979
|
+
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(80796);
|
|
105980
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(12020);
|
|
105981
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(61198);
|
|
105982
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(96681);
|
|
105983
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(21314);
|
|
105984
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(24329);
|
|
105985
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(76332);
|
|
105986
|
+
/* harmony import */ var _selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(10533);
|
|
105987
|
+
/* harmony import */ var _selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(92500);
|
|
105988
|
+
/* harmony import */ var _selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(40388);
|
|
105989
|
+
/* harmony import */ var _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(86072);
|
|
105990
|
+
/* harmony import */ var _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(10476);
|
|
105991
|
+
/* harmony import */ var _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(34968);
|
|
105992
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(22820);
|
|
105993
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(18917);
|
|
105994
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(85533);
|
|
105995
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(82302);
|
|
105996
|
+
/* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(29217);
|
|
105997
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(29587);
|
|
105998
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(14520);
|
|
105999
|
+
|
|
105475
106000
|
|
|
105476
106001
|
|
|
105477
106002
|
|
|
@@ -105503,8 +106028,23 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105503
106028
|
reference;
|
|
105504
106029
|
options;
|
|
105505
106030
|
refractCache;
|
|
106031
|
+
|
|
106032
|
+
/**
|
|
106033
|
+
* Index of `$id`-bearing schemas per document, shared across nested visitors
|
|
106034
|
+
* of a single dereference run so it never outlives mutations of the documents.
|
|
106035
|
+
*/
|
|
106036
|
+
schema$idIndex;
|
|
105506
106037
|
visited;
|
|
105507
106038
|
|
|
106039
|
+
/**
|
|
106040
|
+
* `$id`s of the JSON Schema elements enclosing the traversal root within its
|
|
106041
|
+
* document (outermost first). Empty when the root is the document itself; a
|
|
106042
|
+
* nested visitor traversing a fragment is seeded with the `$id`s of the
|
|
106043
|
+
* schemas the fragment sits under, so the `$ref`s and `$id`s within resolve
|
|
106044
|
+
* against the same base as they would from the document root.
|
|
106045
|
+
*/
|
|
106046
|
+
ancestorSchema$ids;
|
|
106047
|
+
|
|
105508
106048
|
/**
|
|
105509
106049
|
* Tracks element ancestors across dive-deep traversal boundaries.
|
|
105510
106050
|
* Used for cycle detection: if a referenced element is found in
|
|
@@ -105516,29 +106056,33 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105516
106056
|
options,
|
|
105517
106057
|
indirections = [],
|
|
105518
106058
|
refractCache = new WeakMap(),
|
|
105519
|
-
|
|
105520
|
-
|
|
106059
|
+
schema$idIndex = new WeakMap(),
|
|
106060
|
+
ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(),
|
|
106061
|
+
visited = new WeakSet(),
|
|
106062
|
+
ancestorSchema$ids = []
|
|
105521
106063
|
}) {
|
|
105522
106064
|
this.indirections = indirections;
|
|
105523
106065
|
this.reference = reference;
|
|
105524
106066
|
this.options = options;
|
|
105525
106067
|
this.refractCache = refractCache;
|
|
105526
|
-
this.
|
|
106068
|
+
this.schema$idIndex = schema$idIndex;
|
|
106069
|
+
this.ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(...ancestors);
|
|
105527
106070
|
this.visited = visited;
|
|
106071
|
+
this.ancestorSchema$ids = ancestorSchema$ids;
|
|
105528
106072
|
}
|
|
105529
106073
|
toAncestorLineage(path) {
|
|
105530
106074
|
const ancestorNodes = path.getAncestorNodes();
|
|
105531
106075
|
const directAncestors = new Set(ancestorNodes.filter(_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement));
|
|
105532
|
-
const ancestorsLineage = new
|
|
106076
|
+
const ancestorsLineage = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(...this.ancestors, directAncestors);
|
|
105533
106077
|
return [ancestorsLineage, directAncestors];
|
|
105534
106078
|
}
|
|
105535
106079
|
toBaseURI(uri) {
|
|
105536
|
-
return
|
|
106080
|
+
return _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.resolve(this.reference.uri, _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.sanitize(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(uri)));
|
|
105537
106081
|
}
|
|
105538
106082
|
async toReference(uri) {
|
|
105539
106083
|
// detect maximum depth of resolution
|
|
105540
106084
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
105541
|
-
throw new
|
|
106085
|
+
throw new _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`, {
|
|
105542
106086
|
maxDepth: this.options.resolve.maxDepth,
|
|
105543
106087
|
uri: this.reference.uri
|
|
105544
106088
|
});
|
|
@@ -105552,7 +106096,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105552
106096
|
if (refSet.has(baseURI)) {
|
|
105553
106097
|
return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(baseURI, 'uri'));
|
|
105554
106098
|
}
|
|
105555
|
-
const parseResult = await (0,
|
|
106099
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_26__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(baseURI), {
|
|
105556
106100
|
...this.options,
|
|
105557
106101
|
parse: {
|
|
105558
106102
|
...this.options.parse,
|
|
@@ -105575,15 +106119,15 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105575
106119
|
// context always sees raw, unresolved elements and processes them with its own
|
|
105576
106120
|
// ancestors/indirections. The trade-off is that elements referenced by multiple
|
|
105577
106121
|
// documents would be resolved once per context instead of being reused.
|
|
105578
|
-
const mutableReference = new
|
|
106122
|
+
const mutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
105579
106123
|
uri: baseURI,
|
|
105580
|
-
value: this.options.dereference.immutable ? (0,
|
|
106124
|
+
value: this.options.dereference.immutable ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneDeep)(parseResult) : parseResult,
|
|
105581
106125
|
depth: this.reference.depth + 1
|
|
105582
106126
|
});
|
|
105583
106127
|
refSet.add(mutableReference);
|
|
105584
106128
|
if (this.options.dereference.immutable) {
|
|
105585
106129
|
// register new immutable reference with original parseResult
|
|
105586
|
-
const immutableReference = new
|
|
106130
|
+
const immutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
105587
106131
|
uri: `immutable://${baseURI}`,
|
|
105588
106132
|
value: parseResult,
|
|
105589
106133
|
depth: this.reference.depth + 1
|
|
@@ -105607,10 +106151,10 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105607
106151
|
const {
|
|
105608
106152
|
continueOnError
|
|
105609
106153
|
} = this.options.dereference;
|
|
105610
|
-
const isEntryDocument =
|
|
106154
|
+
const isEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
|
|
105611
106155
|
const uri = this.reference.uri;
|
|
105612
106156
|
const type = referencingElement.element;
|
|
105613
|
-
const codeFrame = (0,
|
|
106157
|
+
const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement);
|
|
105614
106158
|
|
|
105615
106159
|
// find element location by identity in the document tree.
|
|
105616
106160
|
// guarded: this.reference.value may not be a ParseResultElement or may lack a result.
|
|
@@ -105619,7 +106163,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105619
106163
|
let location;
|
|
105620
106164
|
const root = this.reference.value.result;
|
|
105621
106165
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement)(root)) {
|
|
105622
|
-
(0,
|
|
106166
|
+
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverse)(root, {
|
|
105623
106167
|
enter: p => {
|
|
105624
106168
|
if (p.node === referencingElement || this.refractCache.get(p.node) === referencingElement) {
|
|
105625
106169
|
location = p.formatPath();
|
|
@@ -105640,10 +106184,10 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105640
106184
|
|
|
105641
106185
|
// enrich existing error from nested visitor or create new one
|
|
105642
106186
|
let unresolvedError;
|
|
105643
|
-
if (error instanceof
|
|
106187
|
+
if (error instanceof _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__["default"]) {
|
|
105644
106188
|
// prefix relative locations for entries belonging to the referenced document
|
|
105645
106189
|
const refBaseURI = this.toBaseURI(refFieldValue);
|
|
105646
|
-
const fragment =
|
|
106190
|
+
const fragment = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference(refFieldValue);
|
|
105647
106191
|
if (fragment) {
|
|
105648
106192
|
if (refBaseURI === error.uri && error.location) {
|
|
105649
106193
|
error.location = fragment + error.location;
|
|
@@ -105656,7 +106200,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105656
106200
|
error.trace = [hop, ...error.trace];
|
|
105657
106201
|
unresolvedError = error;
|
|
105658
106202
|
} else {
|
|
105659
|
-
unresolvedError = new
|
|
106203
|
+
unresolvedError = new _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__["default"](message, {
|
|
105660
106204
|
cause: error,
|
|
105661
106205
|
type,
|
|
105662
106206
|
uri,
|
|
@@ -105678,8 +106222,8 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105678
106222
|
path.skip();
|
|
105679
106223
|
return;
|
|
105680
106224
|
}
|
|
105681
|
-
const retrievalURI = this.toBaseURI((0,
|
|
105682
|
-
const isInternalReference =
|
|
106225
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
106226
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
105683
106227
|
const isExternalReference = !isInternalReference;
|
|
105684
106228
|
|
|
105685
106229
|
// ignore resolving internal Reference Objects
|
|
@@ -105694,31 +106238,31 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105694
106238
|
path.skip();
|
|
105695
106239
|
return;
|
|
105696
106240
|
}
|
|
105697
|
-
const $refBaseURI =
|
|
106241
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105698
106242
|
const indirectionsSize = this.indirections.length;
|
|
105699
106243
|
try {
|
|
105700
|
-
const reference = await this.toReference((0,
|
|
106244
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105701
106245
|
this.indirections.push(referencingElement);
|
|
105702
|
-
const jsonPointer =
|
|
106246
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
105703
106247
|
|
|
105704
106248
|
// possibly non-semantic fragment
|
|
105705
|
-
let referencedElement = (0,
|
|
106249
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
105706
106250
|
|
|
105707
106251
|
// applying semantics to a fragment
|
|
105708
106252
|
const referencedElementType = referencingElement.meta.get('referenced-element');
|
|
105709
|
-
if (referencedElement.element !== referencedElementType && !(0,
|
|
106253
|
+
if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isReferenceElement)(referencedElement)) {
|
|
105710
106254
|
if (this.refractCache.has(referencedElement)) {
|
|
105711
106255
|
referencedElement = this.refractCache.get(referencedElement);
|
|
105712
|
-
} else if ((0,
|
|
106256
|
+
} else if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.isReferenceLikeElement)(referencedElement)) {
|
|
105713
106257
|
// handling generic indirect references
|
|
105714
106258
|
const sourceElement = referencedElement;
|
|
105715
|
-
referencedElement = (0,
|
|
106259
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractReference)(referencedElement);
|
|
105716
106260
|
referencedElement.meta.set('referenced-element', referencedElementType);
|
|
105717
106261
|
this.refractCache.set(sourceElement, referencedElement);
|
|
105718
106262
|
} else {
|
|
105719
106263
|
// handling direct references
|
|
105720
106264
|
const sourceElement = referencedElement;
|
|
105721
|
-
referencedElement = (0,
|
|
106265
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__["default"])(referencedElement, {
|
|
105722
106266
|
element: referencedElementType
|
|
105723
106267
|
});
|
|
105724
106268
|
this.refractCache.set(sourceElement, referencedElement);
|
|
@@ -105727,14 +106271,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105727
106271
|
|
|
105728
106272
|
// detect direct or indirect reference
|
|
105729
106273
|
if (referencingElement === referencedElement) {
|
|
105730
|
-
throw new
|
|
105731
|
-
$ref: (0,
|
|
106274
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Reference Object detected', {
|
|
106275
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105732
106276
|
});
|
|
105733
106277
|
}
|
|
105734
106278
|
|
|
105735
106279
|
// detect maximum depth of dereferencing
|
|
105736
106280
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
105737
|
-
throw new
|
|
106281
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
105738
106282
|
maxDepth: this.options.dereference.maxDepth,
|
|
105739
106283
|
uri: this.reference.uri
|
|
105740
106284
|
});
|
|
@@ -105745,14 +106289,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105745
106289
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
105746
106290
|
reference.refSet.circular = true;
|
|
105747
106291
|
if (this.options.dereference.circular === 'error') {
|
|
105748
|
-
throw new
|
|
105749
|
-
$ref: (0,
|
|
106292
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106293
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105750
106294
|
});
|
|
105751
106295
|
} else if (this.options.dereference.circular === 'replace') {
|
|
105752
|
-
const refElement = new
|
|
106296
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
105753
106297
|
type: referencingElement.element,
|
|
105754
106298
|
uri: reference.uri,
|
|
105755
|
-
$ref: (0,
|
|
106299
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105756
106300
|
});
|
|
105757
106301
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
105758
106302
|
const replacement = replacer(refElement);
|
|
@@ -105771,9 +106315,9 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105771
106315
|
* 3. Fragment is a Reference Object. We need to follow it to get the eventual value
|
|
105772
106316
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
105773
106317
|
*/
|
|
105774
|
-
const isNonEntryDocument =
|
|
106318
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
105775
106319
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
105776
|
-
if ((isExternalReference || isNonEntryDocument || (0,
|
|
106320
|
+
if ((isExternalReference || isNonEntryDocument || (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isReferenceElement)(referencedElement) || shouldDetectCircular && !this.visited.has(referencedElement)) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
105777
106321
|
if (shouldDetectCircular) {
|
|
105778
106322
|
this.visited.add(referencedElement);
|
|
105779
106323
|
}
|
|
@@ -105783,10 +106327,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105783
106327
|
indirections: [...this.indirections],
|
|
105784
106328
|
options: this.options,
|
|
105785
106329
|
refractCache: this.refractCache,
|
|
106330
|
+
schema$idIndex: this.schema$idIndex,
|
|
105786
106331
|
visited: this.visited,
|
|
105787
106332
|
ancestors: ancestorsLineage
|
|
105788
106333
|
});
|
|
105789
|
-
referencedElement = await (0,
|
|
106334
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
105790
106335
|
mutable: true,
|
|
105791
106336
|
skipVisited: 'skip'
|
|
105792
106337
|
});
|
|
@@ -105796,14 +106341,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105796
106341
|
/**
|
|
105797
106342
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
105798
106343
|
*/
|
|
105799
|
-
const mergedElement = (0,
|
|
106344
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
105800
106345
|
// annotate fragment with info about original Reference element
|
|
105801
106346
|
mergedElement.meta.set('ref-fields', {
|
|
105802
|
-
$ref: (0,
|
|
106347
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref),
|
|
105803
106348
|
// @ts-ignore
|
|
105804
|
-
description: (0,
|
|
106349
|
+
description: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.description),
|
|
105805
106350
|
// @ts-ignore
|
|
105806
|
-
summary: (0,
|
|
106351
|
+
summary: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.summary)
|
|
105807
106352
|
});
|
|
105808
106353
|
// annotate fragment with info about origin and type
|
|
105809
106354
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -105811,7 +106356,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105811
106356
|
|
|
105812
106357
|
// override description and summary (outer has higher priority then inner)
|
|
105813
106358
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isObjectElement)(referencedElement) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isObjectElement)(mergedElement)) {
|
|
105814
|
-
const fields = (0,
|
|
106359
|
+
const fields = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__.fixedFields)(referencedElement, {
|
|
105815
106360
|
indexed: true
|
|
105816
106361
|
});
|
|
105817
106362
|
if (referencingElement.hasKey('description') && Object.hasOwn(fields, 'description')) {
|
|
@@ -105829,7 +106374,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105829
106374
|
*/
|
|
105830
106375
|
path.replaceWith(mergedElement);
|
|
105831
106376
|
} catch (error) {
|
|
105832
|
-
const $ref = (0,
|
|
106377
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
105833
106378
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
105834
106379
|
} finally {
|
|
105835
106380
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105848,8 +106393,8 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105848
106393
|
path.skip();
|
|
105849
106394
|
return;
|
|
105850
106395
|
}
|
|
105851
|
-
const retrievalURI = this.toBaseURI((0,
|
|
105852
|
-
const isInternalReference =
|
|
106396
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
106397
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
105853
106398
|
const isExternalReference = !isInternalReference;
|
|
105854
106399
|
|
|
105855
106400
|
// ignore resolving internal Path Item Objects
|
|
@@ -105862,37 +106407,37 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105862
106407
|
// skip traversing this Path Item element but traverse all it's child elements
|
|
105863
106408
|
return;
|
|
105864
106409
|
}
|
|
105865
|
-
const $refBaseURI =
|
|
106410
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105866
106411
|
const indirectionsSize = this.indirections.length;
|
|
105867
106412
|
try {
|
|
105868
|
-
const reference = await this.toReference((0,
|
|
106413
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105869
106414
|
this.indirections.push(referencingElement);
|
|
105870
|
-
const jsonPointer =
|
|
106415
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
105871
106416
|
|
|
105872
106417
|
// possibly non-semantic referenced element
|
|
105873
|
-
let referencedElement = (0,
|
|
106418
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
105874
106419
|
|
|
105875
106420
|
// applying semantics to a referenced element
|
|
105876
|
-
if (!(0,
|
|
106421
|
+
if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement)) {
|
|
105877
106422
|
if (this.refractCache.has(referencedElement)) {
|
|
105878
106423
|
referencedElement = this.refractCache.get(referencedElement);
|
|
105879
106424
|
} else {
|
|
105880
106425
|
const sourceElement = referencedElement;
|
|
105881
|
-
referencedElement = (0,
|
|
106426
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractPathItem)(referencedElement);
|
|
105882
106427
|
this.refractCache.set(sourceElement, referencedElement);
|
|
105883
106428
|
}
|
|
105884
106429
|
}
|
|
105885
106430
|
|
|
105886
106431
|
// detect direct or indirect reference
|
|
105887
106432
|
if (referencingElement === referencedElement) {
|
|
105888
|
-
throw new
|
|
105889
|
-
$ref: (0,
|
|
106433
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Path Item Object reference detected', {
|
|
106434
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105890
106435
|
});
|
|
105891
106436
|
}
|
|
105892
106437
|
|
|
105893
106438
|
// detect maximum depth of dereferencing
|
|
105894
106439
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
105895
|
-
throw new
|
|
106440
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
105896
106441
|
maxDepth: this.options.dereference.maxDepth,
|
|
105897
106442
|
uri: this.reference.uri
|
|
105898
106443
|
});
|
|
@@ -105903,14 +106448,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105903
106448
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
105904
106449
|
reference.refSet.circular = true;
|
|
105905
106450
|
if (this.options.dereference.circular === 'error') {
|
|
105906
|
-
throw new
|
|
105907
|
-
$ref: (0,
|
|
106451
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106452
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105908
106453
|
});
|
|
105909
106454
|
} else if (this.options.dereference.circular === 'replace') {
|
|
105910
|
-
const refElement = new
|
|
106455
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
105911
106456
|
type: referencingElement.element,
|
|
105912
106457
|
uri: reference.uri,
|
|
105913
|
-
$ref: (0,
|
|
106458
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105914
106459
|
});
|
|
105915
106460
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
105916
106461
|
const replacement = replacer(refElement);
|
|
@@ -105929,9 +106474,9 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105929
106474
|
* 3. Fragment is a Path Item Object with $ref field. We need to follow it to get the eventual value
|
|
105930
106475
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
105931
106476
|
*/
|
|
105932
|
-
const isNonEntryDocument =
|
|
106477
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
105933
106478
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
105934
|
-
if ((isExternalReference || isNonEntryDocument || (0,
|
|
106479
|
+
if ((isExternalReference || isNonEntryDocument || (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(referencedElement.$ref) || shouldDetectCircular && !this.visited.has(referencedElement)) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
105935
106480
|
if (shouldDetectCircular) {
|
|
105936
106481
|
this.visited.add(referencedElement);
|
|
105937
106482
|
}
|
|
@@ -105941,10 +106486,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105941
106486
|
indirections: [...this.indirections],
|
|
105942
106487
|
options: this.options,
|
|
105943
106488
|
refractCache: this.refractCache,
|
|
106489
|
+
schema$idIndex: this.schema$idIndex,
|
|
105944
106490
|
visited: this.visited,
|
|
105945
106491
|
ancestors: ancestorsLineage
|
|
105946
106492
|
});
|
|
105947
|
-
referencedElement = await (0,
|
|
106493
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
105948
106494
|
mutable: true,
|
|
105949
106495
|
skipVisited: 'skip'
|
|
105950
106496
|
});
|
|
@@ -105954,18 +106500,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105954
106500
|
/**
|
|
105955
106501
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
105956
106502
|
*/
|
|
105957
|
-
if ((0,
|
|
105958
|
-
const mergedElement = (0,
|
|
106503
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement)) {
|
|
106504
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
105959
106505
|
// existing keywords from referencing PathItemElement overrides ones from referenced element
|
|
105960
106506
|
referencingElement.forEach((value, keyElement, item) => {
|
|
105961
|
-
mergedElement.remove((0,
|
|
106507
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(keyElement));
|
|
105962
106508
|
mergedElement.content.push(item);
|
|
105963
106509
|
});
|
|
105964
106510
|
mergedElement.remove('$ref');
|
|
105965
106511
|
|
|
105966
106512
|
// annotate referenced element with info about original referencing element
|
|
105967
106513
|
mergedElement.meta.set('ref-fields', {
|
|
105968
|
-
$ref: (0,
|
|
106514
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105969
106515
|
});
|
|
105970
106516
|
// annotate referenced element with info about origin and type
|
|
105971
106517
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -105978,7 +106524,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105978
106524
|
*/
|
|
105979
106525
|
path.replaceWith(referencedElement);
|
|
105980
106526
|
} catch (error) {
|
|
105981
|
-
const $ref = (0,
|
|
106527
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
105982
106528
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
105983
106529
|
} finally {
|
|
105984
106530
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105994,18 +106540,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105994
106540
|
|
|
105995
106541
|
// operationRef and operationId fields are mutually exclusive
|
|
105996
106542
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationId)) {
|
|
105997
|
-
throw new
|
|
105998
|
-
operationRef: (0,
|
|
105999
|
-
operationId: (0,
|
|
106543
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
|
|
106544
|
+
operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef),
|
|
106545
|
+
operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId)
|
|
106000
106546
|
});
|
|
106001
106547
|
}
|
|
106002
106548
|
try {
|
|
106003
106549
|
let operationElement;
|
|
106004
106550
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef)) {
|
|
106005
106551
|
// possibly non-semantic referenced element
|
|
106006
|
-
const jsonPointer =
|
|
106007
|
-
const retrievalURI = this.toBaseURI((0,
|
|
106008
|
-
const isInternalReference =
|
|
106552
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106553
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106554
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106009
106555
|
const isExternalReference = !isInternalReference;
|
|
106010
106556
|
|
|
106011
106557
|
// ignore resolving internal Operation Object reference
|
|
@@ -106018,24 +106564,24 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106018
106564
|
// skip traversing this Link element but traverse all it's child elements
|
|
106019
106565
|
return;
|
|
106020
106566
|
}
|
|
106021
|
-
const reference = await this.toReference((0,
|
|
106022
|
-
operationElement = (0,
|
|
106567
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106568
|
+
operationElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
106023
106569
|
// applying semantics to a referenced element
|
|
106024
|
-
if (!(0,
|
|
106570
|
+
if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isOperationElement)(operationElement)) {
|
|
106025
106571
|
if (this.refractCache.has(operationElement)) {
|
|
106026
106572
|
operationElement = this.refractCache.get(operationElement);
|
|
106027
106573
|
} else {
|
|
106028
106574
|
const sourceElement = operationElement;
|
|
106029
|
-
operationElement = (0,
|
|
106575
|
+
operationElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractOperation)(operationElement);
|
|
106030
106576
|
this.refractCache.set(sourceElement, operationElement);
|
|
106031
106577
|
}
|
|
106032
106578
|
}
|
|
106033
106579
|
// create shallow clone to be able to annotate with metadata
|
|
106034
|
-
operationElement = (0,
|
|
106580
|
+
operationElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(operationElement);
|
|
106035
106581
|
// annotate operation element with info about origin and type
|
|
106036
106582
|
operationElement.meta.set('ref-origin', reference.uri);
|
|
106037
106583
|
operationElement.meta.set('ref-type', linkElement.element);
|
|
106038
|
-
const linkElementCopy = (0,
|
|
106584
|
+
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(linkElement);
|
|
106039
106585
|
linkElementCopy.operationRef?.meta.set('operation', operationElement);
|
|
106040
106586
|
|
|
106041
106587
|
/**
|
|
@@ -106045,17 +106591,17 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106045
106591
|
return;
|
|
106046
106592
|
}
|
|
106047
106593
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationId)) {
|
|
106048
|
-
const operationId = (0,
|
|
106049
|
-
const reference = await this.toReference(
|
|
106050
|
-
const operationPath = (0,
|
|
106594
|
+
const operationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId);
|
|
106595
|
+
const reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(this.reference.uri));
|
|
106596
|
+
const operationPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.find)(reference.value.result, path => (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isOperationElement)(path.node) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement)(path.node.operationId) && path.node.operationId.equals(operationId));
|
|
106051
106597
|
operationElement = operationPath?.node;
|
|
106052
106598
|
// OperationElement not found by its operationId
|
|
106053
106599
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(operationElement)) {
|
|
106054
|
-
throw new
|
|
106600
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"](`OperationElement(operationId=${operationId}) not found`, {
|
|
106055
106601
|
operationId
|
|
106056
106602
|
});
|
|
106057
106603
|
}
|
|
106058
|
-
const linkElementCopy = (0,
|
|
106604
|
+
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(linkElement);
|
|
106059
106605
|
linkElementCopy.operationId?.meta.set('operation', operationElement);
|
|
106060
106606
|
|
|
106061
106607
|
/**
|
|
@@ -106065,7 +106611,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106065
106611
|
}
|
|
106066
106612
|
} catch (error) {
|
|
106067
106613
|
const refFieldName = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef) ? 'operationRef' : 'operationId';
|
|
106068
|
-
const refFieldValue = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef) ? (0,
|
|
106614
|
+
const refFieldValue = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef) : (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId);
|
|
106069
106615
|
this.handleError(`Error while dereferencing Link Object. Cannot resolve ${refFieldName} "${refFieldValue}": ${error.message}`, error, linkElement, refFieldName, refFieldValue, path);
|
|
106070
106616
|
}
|
|
106071
106617
|
}
|
|
@@ -106079,13 +106625,13 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106079
106625
|
|
|
106080
106626
|
// value and externalValue fields are mutually exclusive
|
|
106081
106627
|
if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(exampleElement.externalValue)) {
|
|
106082
|
-
throw new
|
|
106083
|
-
value: (0,
|
|
106084
|
-
externalValue: (0,
|
|
106628
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
|
|
106629
|
+
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.value),
|
|
106630
|
+
externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue)
|
|
106085
106631
|
});
|
|
106086
106632
|
}
|
|
106087
|
-
const retrievalURI = this.toBaseURI((0,
|
|
106088
|
-
const isInternalReference =
|
|
106633
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue));
|
|
106634
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106089
106635
|
const isExternalReference = !isInternalReference;
|
|
106090
106636
|
|
|
106091
106637
|
// ignore resolving internal Example Objects
|
|
@@ -106099,14 +106645,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106099
106645
|
return;
|
|
106100
106646
|
}
|
|
106101
106647
|
try {
|
|
106102
|
-
const reference = await this.toReference((0,
|
|
106648
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue));
|
|
106103
106649
|
|
|
106104
106650
|
// shallow clone of the referenced element
|
|
106105
|
-
const valueElement = (0,
|
|
106651
|
+
const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(reference.value.result);
|
|
106106
106652
|
// annotate element with info about origin and type
|
|
106107
106653
|
valueElement.meta.set('ref-origin', reference.uri);
|
|
106108
106654
|
valueElement.meta.set('ref-type', exampleElement.element);
|
|
106109
|
-
const exampleElementCopy = (0,
|
|
106655
|
+
const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(exampleElement);
|
|
106110
106656
|
exampleElementCopy.value = valueElement;
|
|
106111
106657
|
|
|
106112
106658
|
/**
|
|
@@ -106114,7 +106660,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106114
106660
|
*/
|
|
106115
106661
|
path.replaceWith(exampleElementCopy);
|
|
106116
106662
|
} catch (error) {
|
|
106117
|
-
const externalValue = (0,
|
|
106663
|
+
const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue);
|
|
106118
106664
|
this.handleError(`Error while dereferencing Example Object. Cannot resolve externalValue "${externalValue}": ${error.message}`, error, exampleElement, 'externalValue', externalValue, path);
|
|
106119
106665
|
}
|
|
106120
106666
|
}
|
|
@@ -106134,30 +106680,69 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106134
106680
|
const indirectionsSize = this.indirections.length;
|
|
106135
106681
|
try {
|
|
106136
106682
|
// compute baseURI using rules around $id and $ref keywords
|
|
106137
|
-
let reference = await this.toReference(
|
|
106683
|
+
let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(this.reference.uri));
|
|
106138
106684
|
let {
|
|
106139
106685
|
uri: retrievalURI
|
|
106140
106686
|
} = reference;
|
|
106141
|
-
|
|
106142
|
-
|
|
106143
|
-
const
|
|
106687
|
+
// base URI in effect at the traversal root: the document base refined by
|
|
106688
|
+
// the $ids of the schemas enclosing the root when the root is a fragment
|
|
106689
|
+
const rootBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$ids)(retrievalURI, this.ancestorSchema$ids);
|
|
106690
|
+
const schemaBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchemaBaseURI)(rootBaseURI, path);
|
|
106691
|
+
const $refBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
106692
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash($refBaseURI);
|
|
106693
|
+
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_28__["default"]({
|
|
106144
106694
|
uri: $refBaseURIStrippedHash
|
|
106145
106695
|
});
|
|
106146
106696
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
|
|
106147
106697
|
const isURL = !isUnknownURI;
|
|
106148
|
-
let isInternalReference =
|
|
106698
|
+
let isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === $refBaseURI;
|
|
106149
106699
|
let isExternalReference = !isInternalReference;
|
|
106150
106700
|
|
|
106151
106701
|
// determining reference, proper evaluation and selection mechanism
|
|
106152
106702
|
let referencedElement;
|
|
106703
|
+
// $ids of the schemas enclosing the referenced element within its document
|
|
106704
|
+
let ancestorSchema$ids;
|
|
106153
106705
|
try {
|
|
106154
106706
|
if (isUnknownURI || isURL) {
|
|
106155
106707
|
// we're dealing with canonical URI or URL with possible fragment
|
|
106156
106708
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106157
106709
|
const selector = $refBaseURI;
|
|
106158
|
-
|
|
106159
|
-
|
|
106160
|
-
|
|
106710
|
+
// the fragment being traversed is searched before the whole document: a
|
|
106711
|
+
// fragment referenced from another document (a Response, Parameter, Path
|
|
106712
|
+
// Item, ...) is refracted with its own semantics, so the Schema Objects it
|
|
106713
|
+
// contains are indexed, whereas the referenced document as a whole is
|
|
106714
|
+
// parsed generically and refracted as a bare JSON Schema, which leaves
|
|
106715
|
+
// those Schema Objects (under `content`, `schema`, ...) unrecognized and
|
|
106716
|
+
// their `$id`s out of the index
|
|
106717
|
+
const documentElement = reference.value.result;
|
|
106718
|
+
const rootNode = path.getAncestorNodes().at(-1) ?? path.node;
|
|
106719
|
+
const fragmentElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isParseResultElement)(rootNode) ? rootNode.result : rootNode;
|
|
106720
|
+
try {
|
|
106721
|
+
// the fragment's $ids resolve against the base its enclosing chain
|
|
106722
|
+
// leaves in effect, which then also prefixes the located schema's chain
|
|
106723
|
+
({
|
|
106724
|
+
element: referencedElement,
|
|
106725
|
+
ancestorSchema$ids
|
|
106726
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__.locate)(selector, (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(fragmentElement), {
|
|
106727
|
+
baseURI: rootBaseURI,
|
|
106728
|
+
index: this.schema$idIndex
|
|
106729
|
+
}));
|
|
106730
|
+
ancestorSchema$ids = [...this.ancestorSchema$ids, ...ancestorSchema$ids];
|
|
106731
|
+
} catch (error) {
|
|
106732
|
+
if (!(error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__["default"]) || fragmentElement === documentElement) {
|
|
106733
|
+
throw error;
|
|
106734
|
+
}
|
|
106735
|
+
// the document index is rooted at the document, so the located chain
|
|
106736
|
+
// is already document-relative and takes no prefix
|
|
106737
|
+
({
|
|
106738
|
+
element: referencedElement,
|
|
106739
|
+
ancestorSchema$ids
|
|
106740
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__.locate)(selector, (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(documentElement), {
|
|
106741
|
+
baseURI: reference.uri,
|
|
106742
|
+
index: this.schema$idIndex
|
|
106743
|
+
}));
|
|
106744
|
+
}
|
|
106745
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106161
106746
|
|
|
106162
106747
|
// ignore resolving internal Schema Objects
|
|
106163
106748
|
if (!this.options.resolve.internal && isInternalReference) {
|
|
@@ -106172,7 +106757,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106172
106757
|
} else {
|
|
106173
106758
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
106174
106759
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106175
|
-
isInternalReference =
|
|
106760
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106176
106761
|
isExternalReference = !isInternalReference;
|
|
106177
106762
|
|
|
106178
106763
|
// ignore resolving internal Schema Objects
|
|
@@ -106185,21 +106770,24 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106185
106770
|
// skip traversing this schema element but traverse all it's child elements
|
|
106186
106771
|
return;
|
|
106187
106772
|
}
|
|
106188
|
-
reference = await this.toReference(
|
|
106189
|
-
const selector =
|
|
106190
|
-
const referenceAsSchema = (0,
|
|
106191
|
-
|
|
106192
|
-
|
|
106773
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106774
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
106775
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106776
|
+
({
|
|
106777
|
+
element: referencedElement,
|
|
106778
|
+
ancestorSchema$ids
|
|
106779
|
+
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__.locate)(referenceAsSchema, selector));
|
|
106780
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106193
106781
|
}
|
|
106194
106782
|
} catch (error) {
|
|
106195
106783
|
/**
|
|
106196
106784
|
* SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
106197
106785
|
* the URL and assume the returned response is a JSON Schema.
|
|
106198
106786
|
*/
|
|
106199
|
-
if (isURL && error instanceof
|
|
106200
|
-
if ((0,_selectors_$
|
|
106787
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__["default"]) {
|
|
106788
|
+
if ((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.isAnchor)((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.uriToAnchor)($refBaseURI))) {
|
|
106201
106789
|
// we're dealing with JSON Schema $anchor here
|
|
106202
|
-
isInternalReference =
|
|
106790
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106203
106791
|
isExternalReference = !isInternalReference;
|
|
106204
106792
|
|
|
106205
106793
|
// ignore resolving internal Schema Objects
|
|
@@ -106212,15 +106800,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106212
106800
|
// skip traversing this schema element but traverse all it's child elements
|
|
106213
106801
|
return;
|
|
106214
106802
|
}
|
|
106215
|
-
reference = await this.toReference(
|
|
106216
|
-
const selector = (0,_selectors_$
|
|
106217
|
-
const referenceAsSchema = (0,
|
|
106218
|
-
|
|
106219
|
-
|
|
106803
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106804
|
+
const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.uriToAnchor)($refBaseURI);
|
|
106805
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106806
|
+
({
|
|
106807
|
+
element: referencedElement,
|
|
106808
|
+
ancestorSchema$ids
|
|
106809
|
+
} = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(selector, referenceAsSchema));
|
|
106810
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106220
106811
|
} else {
|
|
106221
106812
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
106222
106813
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106223
|
-
isInternalReference =
|
|
106814
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106224
106815
|
isExternalReference = !isInternalReference;
|
|
106225
106816
|
|
|
106226
106817
|
// ignore resolving internal Schema Objects
|
|
@@ -106233,11 +106824,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106233
106824
|
// skip traversing this schema element but traverse all it's child elements
|
|
106234
106825
|
return;
|
|
106235
106826
|
}
|
|
106236
|
-
reference = await this.toReference(
|
|
106237
|
-
const selector =
|
|
106238
|
-
const referenceAsSchema = (0,
|
|
106239
|
-
|
|
106240
|
-
|
|
106827
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106828
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
106829
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106830
|
+
({
|
|
106831
|
+
element: referencedElement,
|
|
106832
|
+
ancestorSchema$ids
|
|
106833
|
+
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__.locate)(referenceAsSchema, selector));
|
|
106834
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106241
106835
|
}
|
|
106242
106836
|
} else {
|
|
106243
106837
|
throw error;
|
|
@@ -106247,14 +106841,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106247
106841
|
|
|
106248
106842
|
// detect direct or indirect reference
|
|
106249
106843
|
if (referencingElement === referencedElement) {
|
|
106250
|
-
throw new
|
|
106251
|
-
$ref: (0,
|
|
106844
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Schema Object reference detected', {
|
|
106845
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106252
106846
|
});
|
|
106253
106847
|
}
|
|
106254
106848
|
|
|
106255
106849
|
// detect maximum depth of dereferencing
|
|
106256
106850
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
106257
|
-
throw new
|
|
106851
|
+
throw new _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"](`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
|
|
106258
106852
|
maxDepth: this.options.dereference.maxDepth,
|
|
106259
106853
|
uri: this.reference.uri
|
|
106260
106854
|
});
|
|
@@ -106265,14 +106859,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106265
106859
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
106266
106860
|
reference.refSet.circular = true;
|
|
106267
106861
|
if (this.options.dereference.circular === 'error') {
|
|
106268
|
-
throw new
|
|
106269
|
-
$ref: (0,
|
|
106862
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106863
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106270
106864
|
});
|
|
106271
106865
|
} else if (this.options.dereference.circular === 'replace') {
|
|
106272
|
-
const refElement = new
|
|
106866
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
106273
106867
|
type: referencingElement.element,
|
|
106274
106868
|
uri: reference.uri,
|
|
106275
|
-
$ref: (0,
|
|
106869
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106276
106870
|
});
|
|
106277
106871
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
106278
106872
|
const replacement = replacer(refElement);
|
|
@@ -106291,9 +106885,13 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106291
106885
|
* 3. Fragment is a Schema Object with $ref field. We need to follow it to get the eventual value
|
|
106292
106886
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
106293
106887
|
*/
|
|
106294
|
-
const isNonEntryDocument =
|
|
106888
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
106295
106889
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
106296
|
-
|
|
106890
|
+
// content transplanted into the referencing site is traversed under that
|
|
106891
|
+
// site's $id chain; a fragment enclosed by a different chain has its own
|
|
106892
|
+
// $refs resolved in place first, by a nested visitor seeded with that chain
|
|
106893
|
+
const hasDifferentEnclosingBase = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$ids)(reference.uri, ancestorSchema$ids) !== (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$ids)(rootBaseURI, (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.schema$idsOf)(path.getAncestorNodes().reverse()));
|
|
106894
|
+
if ((isExternalReference || isNonEntryDocument || hasDifferentEnclosingBase || (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isSchemaElement)(referencedElement) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(referencedElement.$ref) || shouldDetectCircular && !this.visited.has(referencedElement)) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
106297
106895
|
if (shouldDetectCircular) {
|
|
106298
106896
|
this.visited.add(referencedElement);
|
|
106299
106897
|
}
|
|
@@ -106303,10 +106901,12 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106303
106901
|
indirections: [...this.indirections],
|
|
106304
106902
|
options: this.options,
|
|
106305
106903
|
refractCache: this.refractCache,
|
|
106904
|
+
schema$idIndex: this.schema$idIndex,
|
|
106306
106905
|
visited: this.visited,
|
|
106307
|
-
ancestors: ancestorsLineage
|
|
106906
|
+
ancestors: ancestorsLineage,
|
|
106907
|
+
ancestorSchema$ids
|
|
106308
106908
|
});
|
|
106309
|
-
referencedElement = await (0,
|
|
106909
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
106310
106910
|
mutable: true,
|
|
106311
106911
|
skipVisited: 'skip'
|
|
106312
106912
|
});
|
|
@@ -106314,11 +106914,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106314
106914
|
}
|
|
106315
106915
|
|
|
106316
106916
|
// Boolean JSON Schemas
|
|
106317
|
-
if ((0,
|
|
106318
|
-
const booleanJsonSchemaElement = (0,
|
|
106917
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
106918
|
+
const booleanJsonSchemaElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneDeep)(referencedElement);
|
|
106319
106919
|
// annotate referenced element with info about original referencing element
|
|
106320
106920
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
106321
|
-
$ref: (0,
|
|
106921
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106322
106922
|
});
|
|
106323
106923
|
// annotate referenced element with info about origin and type
|
|
106324
106924
|
booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
|
|
@@ -106331,17 +106931,17 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106331
106931
|
/**
|
|
106332
106932
|
* Creating a new version of Schema Object by merging fields from referenced Schema Object with referencing one.
|
|
106333
106933
|
*/
|
|
106334
|
-
if ((0,
|
|
106335
|
-
const mergedElement = (0,
|
|
106934
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isSchemaElement)(referencedElement)) {
|
|
106935
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
106336
106936
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
106337
106937
|
referencingElement.forEach((value, keyElement, item) => {
|
|
106338
|
-
mergedElement.remove((0,
|
|
106938
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(keyElement));
|
|
106339
106939
|
mergedElement.content.push(item);
|
|
106340
106940
|
});
|
|
106341
106941
|
mergedElement.remove('$ref');
|
|
106342
106942
|
// annotate referenced element with info about original referencing element
|
|
106343
106943
|
mergedElement.meta.set('ref-fields', {
|
|
106344
|
-
$ref: (0,
|
|
106944
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106345
106945
|
});
|
|
106346
106946
|
// annotate fragment with info about origin and type
|
|
106347
106947
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -106353,7 +106953,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106353
106953
|
*/
|
|
106354
106954
|
path.replaceWith(referencedElement);
|
|
106355
106955
|
} catch (error) {
|
|
106356
|
-
const $ref = (0,
|
|
106956
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
106357
106957
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
106358
106958
|
} finally {
|
|
106359
106959
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -110351,6 +110951,38 @@ const resolve = (from, to) => {
|
|
|
110351
110951
|
return resolvedUrl.toString();
|
|
110352
110952
|
};
|
|
110353
110953
|
|
|
110954
|
+
/**
|
|
110955
|
+
* Computes the URI reference that resolves to `to` against `from` — the inverse
|
|
110956
|
+
* of `resolve`: `resolve(from, relative(from, to)) === to`. The reference is
|
|
110957
|
+
* relative to the directory of `from` (its last path segment is the document,
|
|
110958
|
+
* not a directory). When the two URIs differ in scheme or authority, or either
|
|
110959
|
+
* has no hierarchical path (e.g. a URN), no relative form exists and `to` is
|
|
110960
|
+
* returned unchanged.
|
|
110961
|
+
* @public
|
|
110962
|
+
*/
|
|
110963
|
+
const relative = (from, to) => {
|
|
110964
|
+
const fromURL = new URL(from, 'resolve://');
|
|
110965
|
+
const toURL = new URL(to, 'resolve://');
|
|
110966
|
+
|
|
110967
|
+
// the authority is host plus userinfo; a relative reference keeps both from `from`
|
|
110968
|
+
if (fromURL.protocol !== toURL.protocol || fromURL.host !== toURL.host || fromURL.username !== toURL.username || fromURL.password !== toURL.password || !fromURL.pathname.startsWith('/') || !toURL.pathname.startsWith('/')) {
|
|
110969
|
+
return to;
|
|
110970
|
+
}
|
|
110971
|
+
const fromSegments = fromURL.pathname.split('/').slice(0, -1);
|
|
110972
|
+
const toSegments = toURL.pathname.split('/');
|
|
110973
|
+
let common = 0;
|
|
110974
|
+
while (common < fromSegments.length && common < toSegments.length - 1 && fromSegments[common] === toSegments[common]) {
|
|
110975
|
+
common += 1;
|
|
110976
|
+
}
|
|
110977
|
+
const segments = [...fromSegments.slice(common).map(() => '..'), ...toSegments.slice(common)];
|
|
110978
|
+
// a leading segment with a colon would be parsed as a scheme, and an empty
|
|
110979
|
+
// reference (`to` is the directory of `from`) would resolve back to `from`
|
|
110980
|
+
if (segments[0].includes(':') || segments.join('/') === '') {
|
|
110981
|
+
segments.unshift('.');
|
|
110982
|
+
}
|
|
110983
|
+
return segments.join('/') + toURL.search + toURL.hash;
|
|
110984
|
+
};
|
|
110985
|
+
|
|
110354
110986
|
/**
|
|
110355
110987
|
* Sanitizes/Encodes URI to it's url encoded form.
|
|
110356
110988
|
*
|
|
@@ -110396,6 +111028,7 @@ const unsanitize = uri => {
|
|
|
110396
111028
|
/* harmony export */ "isFileSystemPath", 0, /* binding */ isFileSystemPath,
|
|
110397
111029
|
/* harmony export */ "isHttpUrl", 0, /* binding */ isHttpUrl,
|
|
110398
111030
|
/* harmony export */ "isURI", 0, /* binding */ isURI,
|
|
111031
|
+
/* harmony export */ "relative", 0, /* binding */ relative,
|
|
110399
111032
|
/* harmony export */ "resolve", 0, /* binding */ resolve,
|
|
110400
111033
|
/* harmony export */ "sanitize", 0, /* binding */ sanitize,
|
|
110401
111034
|
/* harmony export */ "stripHash", 0, /* binding */ stripHash,
|