@speclynx/apidom-overlay 5.2.4 → 5.2.5
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 +4 -0
- package/dist/apidom-overlay.browser.js +1116 -514
- package/dist/apidom-overlay.browser.min.js +1 -1
- package/package.json +8 -8
|
@@ -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,
|
|
@@ -101845,7 +102137,7 @@ class Arazzo1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IMPOR
|
|
|
101845
102137
|
// drop any existing parse-phase source description results before pushing
|
|
101846
102138
|
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
102139
|
parseResult.content = cleaned.content;
|
|
101848
|
-
const sourceDescriptions = await (0,
|
|
102140
|
+
const sourceDescriptions = await (0,_source_descriptions_mjs__WEBPACK_IMPORTED_MODULE_12__.dereferenceSourceDescriptions)(parseResult, reference.uri, options, this.name);
|
|
101849
102141
|
parseResult.push(...sourceDescriptions);
|
|
101850
102142
|
}
|
|
101851
102143
|
|
|
@@ -102154,7 +102446,8 @@ async function dereferenceSourceDescriptions(parseResult, parseResultRetrievalUR
|
|
|
102154
102446
|
__webpack_require__.r(__webpack_exports__);
|
|
102155
102447
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
102156
102448
|
/* 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)
|
|
102449
|
+
/* harmony export */ resolveSchema$refField: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchema$refField),
|
|
102450
|
+
/* harmony export */ resolveSchemaBaseURI: () => (/* reexport safe */ _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_9__.resolveSchemaBaseURI)
|
|
102158
102451
|
/* harmony export */ });
|
|
102159
102452
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
|
|
102160
102453
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84660);
|
|
@@ -102294,31 +102587,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
102294
102587
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87009);
|
|
102295
102588
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
|
|
102296
102589
|
/* 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
|
|
102590
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96911);
|
|
102591
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12111);
|
|
102592
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78894);
|
|
102593
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(44673);
|
|
102594
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16280);
|
|
102595
|
+
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(44641);
|
|
102596
|
+
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(80796);
|
|
102597
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(12020);
|
|
102598
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(61198);
|
|
102599
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(7557);
|
|
102600
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(96681);
|
|
102601
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(28839);
|
|
102602
|
+
/* harmony import */ var _swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(26847);
|
|
102603
|
+
/* harmony import */ var _selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10533);
|
|
102604
|
+
/* harmony import */ var _selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(92500);
|
|
102605
|
+
/* harmony import */ var _openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(40388);
|
|
102606
|
+
/* harmony import */ var _openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(29587);
|
|
102607
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(42424);
|
|
102608
|
+
/* harmony import */ var _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(34968);
|
|
102609
|
+
/* harmony import */ var _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(86072);
|
|
102610
|
+
/* harmony import */ var _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(10476);
|
|
102611
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(18917);
|
|
102612
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(85533);
|
|
102613
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(82302);
|
|
102614
|
+
/* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(29217);
|
|
102615
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(14520);
|
|
102616
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(22820);
|
|
102617
|
+
|
|
102322
102618
|
|
|
102323
102619
|
|
|
102324
102620
|
|
|
@@ -102357,8 +102653,23 @@ class Arazzo1DereferenceVisitor {
|
|
|
102357
102653
|
*/
|
|
102358
102654
|
baseURI;
|
|
102359
102655
|
options;
|
|
102656
|
+
|
|
102657
|
+
/**
|
|
102658
|
+
* Index of `$id`-bearing schemas per document, shared across nested visitors
|
|
102659
|
+
* of a single dereference run so it never outlives mutations of the documents.
|
|
102660
|
+
*/
|
|
102661
|
+
schema$idIndex;
|
|
102360
102662
|
visited;
|
|
102361
102663
|
|
|
102664
|
+
/**
|
|
102665
|
+
* `$id`s of the JSON Schema elements enclosing the traversal root within its
|
|
102666
|
+
* document (outermost first). Empty when the root is the document itself; a
|
|
102667
|
+
* nested visitor traversing a fragment is seeded with the `$id`s of the
|
|
102668
|
+
* schemas the fragment sits under, so the `$ref`s and `$id`s within resolve
|
|
102669
|
+
* against the same base as they would from the document root.
|
|
102670
|
+
*/
|
|
102671
|
+
ancestorSchema$ids;
|
|
102672
|
+
|
|
102362
102673
|
/**
|
|
102363
102674
|
* Tracks element ancestors across dive-deep traversal boundaries.
|
|
102364
102675
|
* Used for cycle detection: if a referenced element is found in
|
|
@@ -102369,29 +102680,33 @@ class Arazzo1DereferenceVisitor {
|
|
|
102369
102680
|
reference,
|
|
102370
102681
|
options,
|
|
102371
102682
|
indirections = [],
|
|
102372
|
-
|
|
102373
|
-
|
|
102683
|
+
schema$idIndex = new WeakMap(),
|
|
102684
|
+
ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(),
|
|
102685
|
+
visited = new WeakSet(),
|
|
102686
|
+
ancestorSchema$ids = []
|
|
102374
102687
|
}) {
|
|
102375
102688
|
this.indirections = indirections;
|
|
102376
102689
|
this.reference = reference;
|
|
102377
|
-
this.baseURI = (0,
|
|
102690
|
+
this.baseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.resolveArazzo$selfField)(reference.uri, reference.value?.result);
|
|
102378
102691
|
this.options = options;
|
|
102379
|
-
this.
|
|
102692
|
+
this.schema$idIndex = schema$idIndex;
|
|
102693
|
+
this.ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(...ancestors);
|
|
102380
102694
|
this.visited = visited;
|
|
102695
|
+
this.ancestorSchema$ids = ancestorSchema$ids;
|
|
102381
102696
|
}
|
|
102382
102697
|
toAncestorLineage(path) {
|
|
102383
102698
|
const ancestorNodes = path.getAncestorNodes();
|
|
102384
102699
|
const directAncestors = new Set(ancestorNodes.filter(_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement));
|
|
102385
|
-
const ancestorsLineage = new
|
|
102700
|
+
const ancestorsLineage = new _util_mjs__WEBPACK_IMPORTED_MODULE_28__.AncestorLineage(...this.ancestors, directAncestors);
|
|
102386
102701
|
return [ancestorsLineage, directAncestors];
|
|
102387
102702
|
}
|
|
102388
102703
|
toBaseURI(uri) {
|
|
102389
|
-
return
|
|
102704
|
+
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
102705
|
}
|
|
102391
102706
|
async toReference(uri) {
|
|
102392
102707
|
// detect maximum depth of resolution
|
|
102393
102708
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
102394
|
-
throw new
|
|
102709
|
+
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
102710
|
maxDepth: this.options.resolve.maxDepth,
|
|
102396
102711
|
uri: this.reference.uri
|
|
102397
102712
|
});
|
|
@@ -102407,11 +102722,11 @@ class Arazzo1DereferenceVisitor {
|
|
|
102407
102722
|
}
|
|
102408
102723
|
|
|
102409
102724
|
// identity-based referencing: URI matches `$self` of an already processed Arazzo document
|
|
102410
|
-
const referenceBy$self = refSet.find((0,
|
|
102725
|
+
const referenceBy$self = refSet.find((0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.identifiedBy$self)(baseURI));
|
|
102411
102726
|
if (referenceBy$self !== undefined) {
|
|
102412
102727
|
return referenceBy$self;
|
|
102413
102728
|
}
|
|
102414
|
-
const parseResult = await (0,
|
|
102729
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_25__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize(baseURI), {
|
|
102415
102730
|
...this.options,
|
|
102416
102731
|
parse: {
|
|
102417
102732
|
...this.options.parse,
|
|
@@ -102434,15 +102749,15 @@ class Arazzo1DereferenceVisitor {
|
|
|
102434
102749
|
// context always sees raw, unresolved elements and processes them with its own
|
|
102435
102750
|
// ancestors/indirections. The trade-off is that elements referenced by multiple
|
|
102436
102751
|
// documents would be resolved once per context instead of being reused.
|
|
102437
|
-
const mutableReference = new
|
|
102752
|
+
const mutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__["default"]({
|
|
102438
102753
|
uri: baseURI,
|
|
102439
|
-
value: this.options.dereference.immutable ? (0,
|
|
102754
|
+
value: this.options.dereference.immutable ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(parseResult) : parseResult,
|
|
102440
102755
|
depth: this.reference.depth + 1
|
|
102441
102756
|
});
|
|
102442
102757
|
refSet.add(mutableReference);
|
|
102443
102758
|
if (this.options.dereference.immutable) {
|
|
102444
102759
|
// register new immutable reference with a refSet
|
|
102445
|
-
const immutableReference = new
|
|
102760
|
+
const immutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_26__["default"]({
|
|
102446
102761
|
uri: `immutable://${baseURI}`,
|
|
102447
102762
|
value: parseResult,
|
|
102448
102763
|
depth: this.reference.depth + 1
|
|
@@ -102466,10 +102781,10 @@ class Arazzo1DereferenceVisitor {
|
|
|
102466
102781
|
const {
|
|
102467
102782
|
continueOnError
|
|
102468
102783
|
} = this.options.dereference;
|
|
102469
|
-
const isEntryDocument =
|
|
102784
|
+
const isEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
|
|
102470
102785
|
const uri = this.reference.uri;
|
|
102471
102786
|
const type = referencingElement.element;
|
|
102472
|
-
const codeFrame = (0,
|
|
102787
|
+
const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(referencingElement);
|
|
102473
102788
|
|
|
102474
102789
|
// find element location by identity in the document tree.
|
|
102475
102790
|
// guarded: this.reference.value may not be a ParseResultElement or may lack a result.
|
|
@@ -102478,7 +102793,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102478
102793
|
let location;
|
|
102479
102794
|
const root = this.reference.value.result;
|
|
102480
102795
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement)(root)) {
|
|
102481
|
-
(0,
|
|
102796
|
+
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverse)(root, {
|
|
102482
102797
|
enter(p) {
|
|
102483
102798
|
if (p.node === referencingElement) {
|
|
102484
102799
|
location = p.formatPath();
|
|
@@ -102499,10 +102814,10 @@ class Arazzo1DereferenceVisitor {
|
|
|
102499
102814
|
|
|
102500
102815
|
// enrich existing error from nested visitor or create new one
|
|
102501
102816
|
let unresolvedError;
|
|
102502
|
-
if (error instanceof
|
|
102817
|
+
if (error instanceof _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"]) {
|
|
102503
102818
|
// prefix relative locations for entries belonging to the referenced document
|
|
102504
102819
|
const refBaseURI = this.toBaseURI(refFieldValue);
|
|
102505
|
-
const fragment =
|
|
102820
|
+
const fragment = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference(refFieldValue);
|
|
102506
102821
|
if (fragment) {
|
|
102507
102822
|
if (refBaseURI === error.uri && error.location) {
|
|
102508
102823
|
error.location = fragment + error.location;
|
|
@@ -102515,7 +102830,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102515
102830
|
error.trace = [hop, ...error.trace];
|
|
102516
102831
|
unresolvedError = error;
|
|
102517
102832
|
} else {
|
|
102518
|
-
unresolvedError = new
|
|
102833
|
+
unresolvedError = new _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_21__["default"](message, {
|
|
102519
102834
|
cause: error,
|
|
102520
102835
|
type,
|
|
102521
102836
|
uri,
|
|
@@ -102543,33 +102858,33 @@ class Arazzo1DereferenceVisitor {
|
|
|
102543
102858
|
path.skip();
|
|
102544
102859
|
return;
|
|
102545
102860
|
}
|
|
102546
|
-
const runtimeExpression = (0,
|
|
102861
|
+
const runtimeExpression = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.reference);
|
|
102547
102862
|
|
|
102548
102863
|
// parse the runtime expression
|
|
102549
102864
|
const {
|
|
102550
102865
|
result,
|
|
102551
102866
|
tree
|
|
102552
|
-
} = (0,
|
|
102867
|
+
} = (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_15__.parse)(runtimeExpression);
|
|
102553
102868
|
if (!result.success) {
|
|
102554
|
-
throw new
|
|
102869
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Invalid Reusable Object reference format: "${runtimeExpression}"`, {
|
|
102555
102870
|
runtimeExpression
|
|
102556
102871
|
});
|
|
102557
102872
|
}
|
|
102558
102873
|
|
|
102559
102874
|
// ReusableElement can only reference components
|
|
102560
102875
|
if (tree.type !== 'ComponentsExpression') {
|
|
102561
|
-
throw new
|
|
102876
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Reusable Object reference "${runtimeExpression}" must be a components expression`, {
|
|
102562
102877
|
runtimeExpression
|
|
102563
102878
|
});
|
|
102564
102879
|
}
|
|
102565
102880
|
|
|
102566
102881
|
// evaluate runtime expression as JSON Pointer to get the referenced element
|
|
102567
|
-
const jsonPointer = (0,
|
|
102882
|
+
const jsonPointer = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.compile)(['components', tree.componentType, tree.componentName]);
|
|
102568
102883
|
let referencedElement;
|
|
102569
102884
|
try {
|
|
102570
|
-
referencedElement = (0,
|
|
102885
|
+
referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(this.reference.value.result, jsonPointer);
|
|
102571
102886
|
} catch {
|
|
102572
|
-
throw new
|
|
102887
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"](`Reusable Object reference "${runtimeExpression}" cannot be resolved`, {
|
|
102573
102888
|
runtimeExpression
|
|
102574
102889
|
});
|
|
102575
102890
|
}
|
|
@@ -102577,18 +102892,18 @@ class Arazzo1DereferenceVisitor {
|
|
|
102577
102892
|
/**
|
|
102578
102893
|
* Create a shallow clone of the referenced element to avoid modifying the original.
|
|
102579
102894
|
*/
|
|
102580
|
-
const mergedElement = (0,
|
|
102895
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(referencedElement);
|
|
102581
102896
|
// annotate with info about original referencing element
|
|
102582
102897
|
mergedElement.meta.set('ref-fields', {
|
|
102583
102898
|
reference: runtimeExpression,
|
|
102584
|
-
value: (0,
|
|
102899
|
+
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.value)
|
|
102585
102900
|
});
|
|
102586
102901
|
// annotate with info about origin
|
|
102587
102902
|
mergedElement.meta.set('ref-origin', this.reference.uri);
|
|
102588
102903
|
mergedElement.meta.set('ref-type', referencingElement.element);
|
|
102589
102904
|
|
|
102590
102905
|
// override value field if present for Parameter Objects
|
|
102591
|
-
if ((0,
|
|
102906
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_14__.isParameterElement)(mergedElement) && referencingElement.hasKey('value')) {
|
|
102592
102907
|
mergedElement.remove('value');
|
|
102593
102908
|
mergedElement.set('value', referencingElement.get('value'));
|
|
102594
102909
|
}
|
|
@@ -102615,13 +102930,17 @@ class Arazzo1DereferenceVisitor {
|
|
|
102615
102930
|
const indirectionsSize = this.indirections.length;
|
|
102616
102931
|
try {
|
|
102617
102932
|
// compute baseURI using rules around $self, $id and $ref keywords
|
|
102618
|
-
let reference = await this.toReference(
|
|
102933
|
+
let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize(this.reference.uri));
|
|
102619
102934
|
let {
|
|
102620
102935
|
uri: retrievalURI
|
|
102621
102936
|
} = reference;
|
|
102622
|
-
|
|
102623
|
-
|
|
102624
|
-
const
|
|
102937
|
+
// base URI in effect at the traversal root: the document base refined by
|
|
102938
|
+
// the $ids of the schemas enclosing the root when the root is a fragment
|
|
102939
|
+
const rootBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$ids)(this.baseURI, this.ancestorSchema$ids);
|
|
102940
|
+
const schemaBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchemaBaseURI)(rootBaseURI, path);
|
|
102941
|
+
const $refBaseURI = (0,_openapi_3_1_util_mjs__WEBPACK_IMPORTED_MODULE_19__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
102942
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash($refBaseURI);
|
|
102943
|
+
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
102625
102944
|
uri: $refBaseURIStrippedHash
|
|
102626
102945
|
});
|
|
102627
102946
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
|
|
@@ -102631,14 +102950,33 @@ class Arazzo1DereferenceVisitor {
|
|
|
102631
102950
|
|
|
102632
102951
|
// determining reference, proper evaluation and selection mechanism
|
|
102633
102952
|
let referencedElement;
|
|
102953
|
+
// $ids of the schemas enclosing the referenced element within its document
|
|
102954
|
+
let ancestorSchema$ids;
|
|
102634
102955
|
try {
|
|
102635
102956
|
if (isUnknownURI || isURL) {
|
|
102636
102957
|
// we're dealing with canonical URI or URL with possible fragment
|
|
102637
102958
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
102638
102959
|
const selector = $refBaseURI;
|
|
102639
|
-
const
|
|
102640
|
-
|
|
102641
|
-
|
|
102960
|
+
const documentElement = reference.value.result;
|
|
102961
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(documentElement);
|
|
102962
|
+
// a document that is itself a fragment detached from its source carries
|
|
102963
|
+
// the $ids enclosing it only as `ancestorSchema$ids`: its $ids are then
|
|
102964
|
+
// indexed against the base that chain leaves in effect, and the chain
|
|
102965
|
+
// prefixes the one of the located schema. A nested visitor rooted at a
|
|
102966
|
+
// fragment of a whole document indexes that document against its own base.
|
|
102967
|
+
const rootNode = path.getAncestorNodes().at(-1) ?? path.node;
|
|
102968
|
+
const isDocumentRoot = ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isParseResultElement)(rootNode) ? rootNode.result : rootNode) === documentElement;
|
|
102969
|
+
({
|
|
102970
|
+
element: referencedElement,
|
|
102971
|
+
ancestorSchema$ids
|
|
102972
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(selector, referenceAsSchema, {
|
|
102973
|
+
baseURI: isDocumentRoot ? rootBaseURI : this.baseURI,
|
|
102974
|
+
index: this.schema$idIndex
|
|
102975
|
+
}));
|
|
102976
|
+
if (isDocumentRoot) {
|
|
102977
|
+
ancestorSchema$ids = [...this.ancestorSchema$ids, ...ancestorSchema$ids];
|
|
102978
|
+
}
|
|
102979
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102642
102980
|
|
|
102643
102981
|
// ignore resolving internal Schema Objects
|
|
102644
102982
|
if (!this.options.resolve.internal && isInternalReference) {
|
|
@@ -102666,19 +103004,22 @@ class Arazzo1DereferenceVisitor {
|
|
|
102666
103004
|
// skip traversing this schema element but traverse all its child elements
|
|
102667
103005
|
return;
|
|
102668
103006
|
}
|
|
102669
|
-
reference = await this.toReference(
|
|
102670
|
-
const selector =
|
|
102671
|
-
const referenceAsSchema = (0,
|
|
102672
|
-
|
|
102673
|
-
|
|
103007
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103008
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
103009
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103010
|
+
({
|
|
103011
|
+
element: referencedElement,
|
|
103012
|
+
ancestorSchema$ids
|
|
103013
|
+
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(referenceAsSchema, selector));
|
|
103014
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102674
103015
|
}
|
|
102675
103016
|
} catch (error) {
|
|
102676
103017
|
/**
|
|
102677
103018
|
* JSONSchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
102678
103019
|
* the URL and assume the returned response is a JSON Schema.
|
|
102679
103020
|
*/
|
|
102680
|
-
if (isURL && error instanceof
|
|
102681
|
-
if ((0,_selectors_$
|
|
103021
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_29__["default"]) {
|
|
103022
|
+
if ((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.isAnchor)((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.uriToAnchor)($refBaseURI))) {
|
|
102682
103023
|
// we're dealing with JSON Schema $anchor here
|
|
102683
103024
|
isInternalReference = this.baseURI === retrievalURI;
|
|
102684
103025
|
isExternalReference = !isInternalReference;
|
|
@@ -102693,11 +103034,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102693
103034
|
// skip traversing this schema element but traverse all its child elements
|
|
102694
103035
|
return;
|
|
102695
103036
|
}
|
|
102696
|
-
reference = await this.toReference(
|
|
102697
|
-
const selector = (0,_selectors_$
|
|
102698
|
-
const referenceAsSchema = (0,
|
|
102699
|
-
|
|
102700
|
-
|
|
103037
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103038
|
+
const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.uriToAnchor)($refBaseURI);
|
|
103039
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103040
|
+
({
|
|
103041
|
+
element: referencedElement,
|
|
103042
|
+
ancestorSchema$ids
|
|
103043
|
+
} = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_16__.locate)(selector, referenceAsSchema));
|
|
103044
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102701
103045
|
} else {
|
|
102702
103046
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
102703
103047
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
@@ -102714,11 +103058,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102714
103058
|
// skip traversing this schema element but traverse all its child elements
|
|
102715
103059
|
return;
|
|
102716
103060
|
}
|
|
102717
|
-
reference = await this.toReference(
|
|
102718
|
-
const selector =
|
|
102719
|
-
const referenceAsSchema = (0,
|
|
102720
|
-
|
|
102721
|
-
|
|
103061
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.unsanitize($refBaseURI));
|
|
103062
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
103063
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(reference.value.result);
|
|
103064
|
+
({
|
|
103065
|
+
element: referencedElement,
|
|
103066
|
+
ancestorSchema$ids
|
|
103067
|
+
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(referenceAsSchema, selector));
|
|
103068
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_20__.maybeRefractToJSONSchemaElement)(referencedElement);
|
|
102722
103069
|
}
|
|
102723
103070
|
} else {
|
|
102724
103071
|
throw error;
|
|
@@ -102728,14 +103075,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102728
103075
|
|
|
102729
103076
|
// detect direct or indirect reference
|
|
102730
103077
|
if (referencingElement === referencedElement) {
|
|
102731
|
-
throw new
|
|
102732
|
-
$ref: (0,
|
|
103078
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('Recursive JSON Schema reference detected', {
|
|
103079
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102733
103080
|
});
|
|
102734
103081
|
}
|
|
102735
103082
|
|
|
102736
103083
|
// detect maximum depth of dereferencing
|
|
102737
103084
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
102738
|
-
throw new
|
|
103085
|
+
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
103086
|
maxDepth: this.options.dereference.maxDepth,
|
|
102740
103087
|
uri: this.reference.uri
|
|
102741
103088
|
});
|
|
@@ -102746,14 +103093,14 @@ class Arazzo1DereferenceVisitor {
|
|
|
102746
103093
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
102747
103094
|
reference.refSet.circular = true;
|
|
102748
103095
|
if (this.options.dereference.circular === 'error') {
|
|
102749
|
-
throw new
|
|
102750
|
-
$ref: (0,
|
|
103096
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('Circular reference detected', {
|
|
103097
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102751
103098
|
});
|
|
102752
103099
|
} else if (this.options.dereference.circular === 'replace') {
|
|
102753
|
-
const refElement = new
|
|
103100
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"]($refBaseURI, {
|
|
102754
103101
|
type: referencingElement.element,
|
|
102755
103102
|
uri: reference.uri,
|
|
102756
|
-
$ref: (0,
|
|
103103
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102757
103104
|
});
|
|
102758
103105
|
const replacer = this.options.dereference.strategyOpts['arazzo-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
102759
103106
|
const replacement = replacer(refElement);
|
|
@@ -102772,9 +103119,13 @@ class Arazzo1DereferenceVisitor {
|
|
|
102772
103119
|
* 3. Fragment is a JSON Schema with $ref field. We need to follow it to get the eventual value
|
|
102773
103120
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
102774
103121
|
*/
|
|
102775
|
-
const isNonEntryDocument =
|
|
103122
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_24__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
102776
103123
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
102777
|
-
|
|
103124
|
+
// content transplanted into the referencing site is traversed under that
|
|
103125
|
+
// site's $id chain; a fragment enclosed by a different chain has its own
|
|
103126
|
+
// $refs resolved in place first, by a nested visitor seeded with that chain
|
|
103127
|
+
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()));
|
|
103128
|
+
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
103129
|
if (shouldDetectCircular) {
|
|
102779
103130
|
this.visited.add(referencedElement);
|
|
102780
103131
|
}
|
|
@@ -102785,10 +103136,12 @@ class Arazzo1DereferenceVisitor {
|
|
|
102785
103136
|
reference,
|
|
102786
103137
|
indirections: [...this.indirections],
|
|
102787
103138
|
options: this.options,
|
|
103139
|
+
schema$idIndex: this.schema$idIndex,
|
|
102788
103140
|
visited: this.visited,
|
|
102789
|
-
ancestors: ancestorsLineage
|
|
103141
|
+
ancestors: ancestorsLineage,
|
|
103142
|
+
ancestorSchema$ids
|
|
102790
103143
|
});
|
|
102791
|
-
referencedElement = await (0,
|
|
103144
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(referencedElement, visitor, {
|
|
102792
103145
|
mutable: true,
|
|
102793
103146
|
skipVisited: 'skip'
|
|
102794
103147
|
});
|
|
@@ -102798,11 +103151,11 @@ class Arazzo1DereferenceVisitor {
|
|
|
102798
103151
|
}
|
|
102799
103152
|
|
|
102800
103153
|
// Boolean JSON Schemas
|
|
102801
|
-
if ((0,
|
|
102802
|
-
const booleanJsonSchemaElement = (0,
|
|
103154
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_13__.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
103155
|
+
const booleanJsonSchemaElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(referencedElement);
|
|
102803
103156
|
// annotate referenced element with info about original referencing element
|
|
102804
103157
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
102805
|
-
$ref: (0,
|
|
103158
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102806
103159
|
});
|
|
102807
103160
|
// annotate referenced element with info about origin
|
|
102808
103161
|
booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
|
|
@@ -102815,17 +103168,17 @@ class Arazzo1DereferenceVisitor {
|
|
|
102815
103168
|
/**
|
|
102816
103169
|
* Creating a new version of JSON Schema by merging fields from referenced Schema with referencing one.
|
|
102817
103170
|
*/
|
|
102818
|
-
if ((0,
|
|
102819
|
-
const mergedElement = (0,
|
|
103171
|
+
if ((0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_12__.isJSONSchemaElement)(referencedElement)) {
|
|
103172
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(referencedElement);
|
|
102820
103173
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
102821
103174
|
referencingElement.forEach((value, keyElement, item) => {
|
|
102822
|
-
mergedElement.remove((0,
|
|
103175
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement));
|
|
102823
103176
|
mergedElement.content.push(item);
|
|
102824
103177
|
});
|
|
102825
103178
|
mergedElement.remove('$ref');
|
|
102826
103179
|
// annotate referenced element with info about original referencing element
|
|
102827
103180
|
mergedElement.meta.set('ref-fields', {
|
|
102828
|
-
$ref: (0,
|
|
103181
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref)
|
|
102829
103182
|
});
|
|
102830
103183
|
// annotate fragment with info about origin
|
|
102831
103184
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -102837,7 +103190,7 @@ class Arazzo1DereferenceVisitor {
|
|
|
102837
103190
|
*/
|
|
102838
103191
|
path.replaceWith(referencedElement);
|
|
102839
103192
|
} catch (error) {
|
|
102840
|
-
const $ref = (0,
|
|
103193
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(referencingElement.$ref);
|
|
102841
103194
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
102842
103195
|
} finally {
|
|
102843
103196
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105107,6 +105460,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105107
105460
|
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(82302);
|
|
105108
105461
|
/* harmony import */ var _ReferenceSet_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(88526);
|
|
105109
105462
|
/* harmony import */ var _visitor_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(56519);
|
|
105463
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29587);
|
|
105464
|
+
|
|
105110
105465
|
|
|
105111
105466
|
|
|
105112
105467
|
|
|
@@ -105168,7 +105523,8 @@ class OpenAPI3_1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IM
|
|
|
105168
105523
|
const shouldDetectCircular = ['error', 'replace'].includes(options.dereference.circular);
|
|
105169
105524
|
const visitor = new _visitor_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
|
|
105170
105525
|
reference: reference,
|
|
105171
|
-
options
|
|
105526
|
+
options,
|
|
105527
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_10__.detachedRootSchema$ids)(refSet.rootRef.value.result)
|
|
105172
105528
|
});
|
|
105173
105529
|
const dereferencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_2__.traverseAsync)(refSet.rootRef.value, visitor, {
|
|
105174
105530
|
mutable: true,
|
|
@@ -105214,9 +105570,9 @@ class OpenAPI3_1DereferenceStrategy extends _DereferenceStrategy_mjs__WEBPACK_IM
|
|
|
105214
105570
|
"use strict";
|
|
105215
105571
|
__webpack_require__.r(__webpack_exports__);
|
|
105216
105572
|
/* 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$
|
|
105573
|
+
/* harmony export */ EvaluationJsonSchema$anchorError: () => (/* reexport safe */ _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
105574
|
+
/* harmony export */ InvalidJsonSchema$anchorError: () => (/* reexport safe */ _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
105575
|
+
/* harmony export */ JsonSchema$anchorError: () => (/* reexport safe */ _errors_JsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_9__["default"])
|
|
105220
105576
|
/* harmony export */ });
|
|
105221
105577
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33031);
|
|
105222
105578
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64988);
|
|
@@ -105224,9 +105580,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105224
105580
|
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80796);
|
|
105225
105581
|
/* harmony import */ var _speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7557);
|
|
105226
105582
|
/* 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
|
|
105583
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29587);
|
|
105584
|
+
/* harmony import */ var _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(27267);
|
|
105585
|
+
/* harmony import */ var _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82450);
|
|
105586
|
+
/* harmony import */ var _errors_JsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55689);
|
|
105587
|
+
|
|
105230
105588
|
|
|
105231
105589
|
|
|
105232
105590
|
|
|
@@ -105260,35 +105618,82 @@ const uriToAnchor = uri => {
|
|
|
105260
105618
|
*/
|
|
105261
105619
|
const parse = anchor => {
|
|
105262
105620
|
if (!isAnchor(anchor)) {
|
|
105263
|
-
throw new _errors_InvalidJsonSchema$
|
|
105621
|
+
throw new _errors_InvalidJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"](anchor);
|
|
105264
105622
|
}
|
|
105265
105623
|
return anchor;
|
|
105266
105624
|
};
|
|
105267
105625
|
|
|
105268
105626
|
/**
|
|
105269
|
-
*
|
|
105627
|
+
* Locates the schema identified by JSON Schema $anchor within ApiDOM fragment,
|
|
105628
|
+
* along with the `$id`s of the schemas enclosing it, the search root included.
|
|
105270
105629
|
* @public
|
|
105271
105630
|
*/
|
|
105272
|
-
const
|
|
105631
|
+
const locate = (anchor, element) => {
|
|
105273
105632
|
const token = parse(anchor);
|
|
105274
105633
|
const resultPath = (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_3__.find)(element,
|
|
105275
105634
|
// @ts-ignore
|
|
105276
105635
|
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
105636
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(resultPath)) {
|
|
105278
|
-
throw new _errors_EvaluationJsonSchema$
|
|
105637
|
+
throw new _errors_EvaluationJsonSchema$anchorError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"](`Evaluation failed on token: "${token}"`);
|
|
105279
105638
|
}
|
|
105280
|
-
return
|
|
105639
|
+
return {
|
|
105640
|
+
element: resultPath.node,
|
|
105641
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_6__.schema$idsOf)(resultPath.getAncestorNodes().reverse())
|
|
105642
|
+
};
|
|
105281
105643
|
};
|
|
105282
105644
|
|
|
105645
|
+
/**
|
|
105646
|
+
* Evaluates JSON Schema $anchor against ApiDOM fragment.
|
|
105647
|
+
* @public
|
|
105648
|
+
*/
|
|
105649
|
+
const evaluate = (anchor, element) => locate(anchor, element).element;
|
|
105650
|
+
|
|
105283
105651
|
|
|
105284
105652
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105285
105653
|
/* harmony export */ "evaluate", 0, /* binding */ evaluate,
|
|
105286
105654
|
/* harmony export */ "isAnchor", 0, /* binding */ isAnchor,
|
|
105655
|
+
/* harmony export */ "locate", 0, /* binding */ locate,
|
|
105287
105656
|
/* harmony export */ "parse", 0, /* binding */ parse,
|
|
105288
105657
|
/* harmony export */ "uriToAnchor", 0, /* binding */ uriToAnchor
|
|
105289
105658
|
/* harmony export */ ]);
|
|
105290
105659
|
|
|
105291
105660
|
|
|
105661
|
+
/***/ },
|
|
105662
|
+
|
|
105663
|
+
/***/ 40388
|
|
105664
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
105665
|
+
|
|
105666
|
+
"use strict";
|
|
105667
|
+
__webpack_require__.r(__webpack_exports__);
|
|
105668
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12020);
|
|
105669
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29587);
|
|
105670
|
+
|
|
105671
|
+
|
|
105672
|
+
/**
|
|
105673
|
+
* Locates the element addressed by JSON Pointer within ApiDOM fragment, along
|
|
105674
|
+
* with the `$id`s of the schemas enclosing it: the elements the pointer walks
|
|
105675
|
+
* through on its way to the target, the search root included.
|
|
105676
|
+
*/
|
|
105677
|
+
const locate = (element, jsonPointer) => {
|
|
105678
|
+
const trace = {
|
|
105679
|
+
steps: []
|
|
105680
|
+
};
|
|
105681
|
+
const result = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_0__.evaluate)(element, jsonPointer, {
|
|
105682
|
+
trace
|
|
105683
|
+
});
|
|
105684
|
+
|
|
105685
|
+
// each step's input is the node the token was applied to, so the inputs are
|
|
105686
|
+
// exactly the walked nodes minus the target
|
|
105687
|
+
return {
|
|
105688
|
+
element: result,
|
|
105689
|
+
ancestorSchema$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_1__.schema$idsOf)(trace.steps.map(step => step.input))
|
|
105690
|
+
};
|
|
105691
|
+
};
|
|
105692
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105693
|
+
/* harmony export */ "locate", 0, /* binding */ locate
|
|
105694
|
+
/* harmony export */ ]);
|
|
105695
|
+
|
|
105696
|
+
|
|
105292
105697
|
/***/ },
|
|
105293
105698
|
|
|
105294
105699
|
/***/ 92500
|
|
@@ -105297,19 +105702,18 @@ const evaluate = (anchor, element) => {
|
|
|
105297
105702
|
"use strict";
|
|
105298
105703
|
__webpack_require__.r(__webpack_exports__);
|
|
105299
105704
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
105300
|
-
/* harmony export */ EvaluationJsonSchemaUriError: () => (/* reexport safe */
|
|
105301
|
-
/* harmony export */ JsonSchemaUriError: () => (/* reexport safe */
|
|
105705
|
+
/* harmony export */ EvaluationJsonSchemaUriError: () => (/* reexport safe */ _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
|
|
105706
|
+
/* harmony export */ JsonSchemaUriError: () => (/* reexport safe */ _errors_JsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])
|
|
105302
105707
|
/* harmony export */ });
|
|
105303
105708
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33031);
|
|
105304
105709
|
/* 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);
|
|
105710
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61198);
|
|
105711
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18917);
|
|
105712
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22820);
|
|
105713
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29587);
|
|
105714
|
+
/* harmony import */ var _$anchor_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10533);
|
|
105715
|
+
/* harmony import */ var _json_pointer_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40388);
|
|
105716
|
+
/* harmony import */ var _errors_JsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3438);
|
|
105313
105717
|
|
|
105314
105718
|
|
|
105315
105719
|
|
|
@@ -105319,41 +105723,66 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105319
105723
|
|
|
105320
105724
|
|
|
105321
105725
|
/**
|
|
105322
|
-
*
|
|
105726
|
+
* Index of `$id`-bearing schemas per indexed element (a document root, or the
|
|
105727
|
+
* fragment a visitor traverses). Each entry pairs a schema with the `$id`s of its
|
|
105728
|
+
* enclosing schema resources (outermost first, including its own). The index is
|
|
105729
|
+
* populated once per element and never refreshed, so callers scope it
|
|
105730
|
+
* to a single dereference/bundle run instead of sharing it globally. Within a run the
|
|
105731
|
+
* `$id` graph of an indexed document is stable: the bundle strategies mutate deep
|
|
105732
|
+
* clones and place components only after the entry traversal ends, and the
|
|
105733
|
+
* dereference strategies only replace `$ref`-bearing schemas.
|
|
105323
105734
|
* @public
|
|
105324
105735
|
*/
|
|
105325
|
-
|
|
105326
|
-
|
|
105327
|
-
|
|
105328
|
-
|
|
105329
|
-
|
|
105330
|
-
|
|
105736
|
+
/**
|
|
105737
|
+
* @public
|
|
105738
|
+
*/
|
|
105739
|
+
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 => ({
|
|
105740
|
+
schema: path.node,
|
|
105741
|
+
$ids: (0,_util_mjs__WEBPACK_IMPORTED_MODULE_5__.collectSchema$ids)(path)
|
|
105742
|
+
}));
|
|
105331
105743
|
|
|
105332
|
-
|
|
105333
|
-
|
|
105334
|
-
|
|
105335
|
-
|
|
105744
|
+
/**
|
|
105745
|
+
* Locates the schema addressed by JSON Schema $ref containing unknown URI within
|
|
105746
|
+
* ApiDOM fragment, along with the `$id`s of the schemas enclosing it.
|
|
105747
|
+
* @public
|
|
105748
|
+
*/
|
|
105749
|
+
const locate = (uri, element, options = {}) => {
|
|
105750
|
+
const uriStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_3__.stripHash(uri);
|
|
105751
|
+
const {
|
|
105752
|
+
baseURI = uriStrippedHash,
|
|
105753
|
+
index = new WeakMap()
|
|
105754
|
+
} = options;
|
|
105755
|
+
if (!index.has(element)) {
|
|
105756
|
+
index.set(element, indexSchema$ids(element));
|
|
105336
105757
|
}
|
|
105337
105758
|
|
|
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}"`);
|
|
105759
|
+
// search for the schema whose canonical URI matches
|
|
105760
|
+
const entry = index.get(element).find(({
|
|
105761
|
+
$ids
|
|
105762
|
+
}) => (0,_util_mjs__WEBPACK_IMPORTED_MODULE_5__.resolveSchema$ids)(baseURI, $ids) === uriStrippedHash);
|
|
105763
|
+
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(entry)) {
|
|
105764
|
+
throw new _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_4__["default"](`Evaluation failed on URI: "${uri}"`);
|
|
105345
105765
|
}
|
|
105346
|
-
|
|
105347
|
-
|
|
105348
|
-
|
|
105349
|
-
|
|
105350
|
-
return
|
|
105766
|
+
|
|
105767
|
+
// the fragment is resolved within the matched schema, whose own $id is the
|
|
105768
|
+
// last of its chain; the fragment walk contributes it again when descending
|
|
105769
|
+
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));
|
|
105770
|
+
return {
|
|
105771
|
+
element: fragmentLocation.element,
|
|
105772
|
+
ancestorSchema$ids: [...entry.$ids.slice(0, -1), ...fragmentLocation.ancestorSchema$ids]
|
|
105773
|
+
};
|
|
105351
105774
|
};
|
|
105352
|
-
|
|
105775
|
+
|
|
105776
|
+
/**
|
|
105777
|
+
* Evaluates JSON Schema $ref containing unknown URI against ApiDOM fragment.
|
|
105778
|
+
* @public
|
|
105779
|
+
*/
|
|
105780
|
+
const evaluate = (uri, element, options = {}) => locate(uri, element, options).element;
|
|
105353
105781
|
|
|
105354
105782
|
|
|
105355
105783
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105356
|
-
/* harmony export */ "evaluate", 0, /* binding */ evaluate
|
|
105784
|
+
/* harmony export */ "evaluate", 0, /* binding */ evaluate,
|
|
105785
|
+
/* harmony export */ "locate", 0, /* binding */ locate
|
|
105357
105786
|
/* harmony export */ ]);
|
|
105358
105787
|
|
|
105359
105788
|
|
|
@@ -105365,41 +105794,97 @@ evaluate.cache = new WeakMap();
|
|
|
105365
105794
|
"use strict";
|
|
105366
105795
|
__webpack_require__.r(__webpack_exports__);
|
|
105367
105796
|
/* 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
|
|
105797
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85102);
|
|
105798
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25162);
|
|
105799
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44673);
|
|
105800
|
+
/* harmony import */ var _speclynx_apidom_ns_json_schema_2020_12__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7557);
|
|
105801
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24329);
|
|
105802
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(18917);
|
|
105803
|
+
|
|
105804
|
+
|
|
105372
105805
|
|
|
105373
105806
|
|
|
105374
105807
|
|
|
105375
105808
|
|
|
105376
105809
|
|
|
105377
105810
|
/**
|
|
105811
|
+
* A schema located within a document, together with the `$id`s of the JSON Schema
|
|
105812
|
+
* elements enclosing it (outermost first; the located schema's own `$id` excluded).
|
|
105378
105813
|
* @public
|
|
105379
105814
|
*/
|
|
105380
|
-
|
|
105381
|
-
|
|
105815
|
+
/**
|
|
105816
|
+
* Whether the element is a JSON Schema element declaring a `$id`.
|
|
105817
|
+
*/
|
|
105818
|
+
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);
|
|
105819
|
+
|
|
105820
|
+
/**
|
|
105821
|
+
* `$id`s declared by the JSON Schema elements among `nodes`, in order.
|
|
105822
|
+
*/
|
|
105823
|
+
const schema$idsOf = nodes => nodes.filter(isJSONSchemaElementWith$id).map(node => (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(node.$id));
|
|
105824
|
+
|
|
105825
|
+
/**
|
|
105826
|
+
* `$id`s of the JSON Schema elements on `path` (outermost first, the node itself
|
|
105827
|
+
* included). The `$id`s are read from the elements themselves rather than from
|
|
105828
|
+
* refraction-time metadata, so a `$id` assigned after refraction (e.g. by the
|
|
105829
|
+
* bundler) is honored.
|
|
105830
|
+
*/
|
|
105831
|
+
const collectSchema$ids = path => schema$idsOf([...path.getAncestorNodes().reverse(), path.node]);
|
|
105832
|
+
|
|
105833
|
+
/**
|
|
105834
|
+
* `$id`s of the schemas enclosing a traversal root that is a fragment detached
|
|
105835
|
+
* from its document, read from the `ancestorsSchemaIdentifiers` meta the JSON
|
|
105836
|
+
* Schema refractors record. The meta also carries the root's own `$id`, which
|
|
105837
|
+
* the ancestor walk contributes itself, so it is dropped. A detached fragment
|
|
105838
|
+
* has no live ancestors, so the meta is the only carrier of its lexical
|
|
105839
|
+
* context; this is the one reader of it the refractors must keep serving.
|
|
105840
|
+
*/
|
|
105841
|
+
const detachedRootSchema$ids = root => {
|
|
105842
|
+
const meta = root?.meta.get('ancestorsSchemaIdentifiers');
|
|
105843
|
+
const $ids = Array.isArray(meta) ? meta.filter(ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"]) : [];
|
|
105844
|
+
const own$id = isJSONSchemaElementWith$id(root) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(root.$id) : undefined;
|
|
105845
|
+
return $ids.length > 0 && $ids.at(-1) === own$id ? $ids.slice(0, -1) : $ids;
|
|
105846
|
+
};
|
|
105847
|
+
|
|
105848
|
+
/**
|
|
105849
|
+
* Resolves a chain of `$id`s (outermost first) against `baseURI`, each `$id`
|
|
105850
|
+
* refining the base the next one resolves against.
|
|
105851
|
+
*/
|
|
105852
|
+
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);
|
|
105853
|
+
|
|
105854
|
+
/**
|
|
105855
|
+
* Resolves the base URI of the schema at `path`: `baseURI` (the base URI in
|
|
105856
|
+
* effect at the traversal root) refined by each `$id` on the schema's ancestor
|
|
105857
|
+
* chain in turn, the schema's own `$id` included.
|
|
105858
|
+
*/
|
|
105859
|
+
const resolveSchemaBaseURI = (baseURI, path) => resolveSchema$ids(baseURI, collectSchema$ids(path));
|
|
105860
|
+
|
|
105861
|
+
/**
|
|
105862
|
+
* Resolves the `$ref` of the schema against its base URI (see
|
|
105863
|
+
* `resolveSchemaBaseURI`), or returns `undefined` when the schema has no string `$ref`.
|
|
105864
|
+
*
|
|
105865
|
+
* @public
|
|
105866
|
+
*/
|
|
105867
|
+
const resolveSchema$refField = (schemaBaseURI, schemaElement) => {
|
|
105868
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(schemaElement.$ref)) {
|
|
105382
105869
|
return undefined;
|
|
105383
105870
|
}
|
|
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)]);
|
|
105871
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaElement.$ref);
|
|
105872
|
+
const hash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_6__.getHash($ref);
|
|
105873
|
+
const $refBaseURI = resolveSchema$ids(schemaBaseURI, [$ref]);
|
|
105389
105874
|
return `${$refBaseURI}${hash === '#' ? '' : hash}`;
|
|
105390
105875
|
};
|
|
105391
105876
|
|
|
105392
105877
|
/**
|
|
105878
|
+
* Resolves the `$id` of the schema against `baseURI`, the base URI in effect
|
|
105879
|
+
* where the schema sits, or returns `undefined` when the schema declares no string `$id`.
|
|
105880
|
+
*
|
|
105393
105881
|
* @public
|
|
105394
105882
|
*/
|
|
105395
|
-
const resolveSchema$idField = (
|
|
105396
|
-
if (
|
|
105883
|
+
const resolveSchema$idField = (baseURI, schemaElement) => {
|
|
105884
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(schemaElement.$id)) {
|
|
105397
105885
|
return undefined;
|
|
105398
105886
|
}
|
|
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);
|
|
105887
|
+
return resolveSchema$ids(baseURI, [(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_3__["default"])(schemaElement.$id)]);
|
|
105403
105888
|
};
|
|
105404
105889
|
|
|
105405
105890
|
/**
|
|
@@ -105409,7 +105894,7 @@ const refractToSchemaElement = element => {
|
|
|
105409
105894
|
if (refractToSchemaElement.cache.has(element)) {
|
|
105410
105895
|
return refractToSchemaElement.cache.get(element);
|
|
105411
105896
|
}
|
|
105412
|
-
const refracted = (0,
|
|
105897
|
+
const refracted = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_5__.refractSchema)(element);
|
|
105413
105898
|
refractToSchemaElement.cache.set(element, refracted);
|
|
105414
105899
|
return refracted;
|
|
105415
105900
|
};
|
|
@@ -105423,16 +105908,22 @@ const maybeRefractToSchemaElement = element => {
|
|
|
105423
105908
|
* Conditional version of refractToSchemaElement, that acts as an identity
|
|
105424
105909
|
* function for all non-primitive Element instances.
|
|
105425
105910
|
*/
|
|
105426
|
-
if ((0,
|
|
105911
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isPrimitiveElement)(element)) {
|
|
105427
105912
|
return refractToSchemaElement(element);
|
|
105428
105913
|
}
|
|
105429
105914
|
return element;
|
|
105430
105915
|
};
|
|
105431
105916
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
105917
|
+
/* harmony export */ "collectSchema$ids", 0, /* binding */ collectSchema$ids,
|
|
105918
|
+
/* harmony export */ "detachedRootSchema$ids", 0, /* binding */ detachedRootSchema$ids,
|
|
105919
|
+
/* harmony export */ "isJSONSchemaElementWith$id", 0, /* binding */ isJSONSchemaElementWith$id,
|
|
105432
105920
|
/* harmony export */ "maybeRefractToSchemaElement", 0, /* binding */ maybeRefractToSchemaElement,
|
|
105433
105921
|
/* harmony export */ "refractToSchemaElement", 0, /* binding */ refractToSchemaElement,
|
|
105434
105922
|
/* harmony export */ "resolveSchema$idField", 0, /* binding */ resolveSchema$idField,
|
|
105435
|
-
/* harmony export */ "resolveSchema$
|
|
105923
|
+
/* harmony export */ "resolveSchema$ids", 0, /* binding */ resolveSchema$ids,
|
|
105924
|
+
/* harmony export */ "resolveSchema$refField", 0, /* binding */ resolveSchema$refField,
|
|
105925
|
+
/* harmony export */ "resolveSchemaBaseURI", 0, /* binding */ resolveSchemaBaseURI,
|
|
105926
|
+
/* harmony export */ "schema$idsOf", 0, /* binding */ schema$idsOf
|
|
105436
105927
|
/* harmony export */ ]);
|
|
105437
105928
|
|
|
105438
105929
|
|
|
@@ -105447,31 +105938,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105447
105938
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
|
|
105448
105939
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33031);
|
|
105449
105940
|
/* 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
|
|
105941
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(96911);
|
|
105942
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(12111);
|
|
105943
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(78894);
|
|
105944
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(37205);
|
|
105945
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(44673);
|
|
105946
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(16280);
|
|
105947
|
+
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(44641);
|
|
105948
|
+
/* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(80796);
|
|
105949
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(12020);
|
|
105950
|
+
/* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(61198);
|
|
105951
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(96681);
|
|
105952
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(21314);
|
|
105953
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(24329);
|
|
105954
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(76332);
|
|
105955
|
+
/* harmony import */ var _selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(10533);
|
|
105956
|
+
/* harmony import */ var _selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(92500);
|
|
105957
|
+
/* harmony import */ var _selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(40388);
|
|
105958
|
+
/* harmony import */ var _errors_MaximumDereferenceDepthError_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(86072);
|
|
105959
|
+
/* harmony import */ var _errors_MaximumResolveDepthError_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(10476);
|
|
105960
|
+
/* harmony import */ var _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(34968);
|
|
105961
|
+
/* harmony import */ var _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(22820);
|
|
105962
|
+
/* harmony import */ var _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(18917);
|
|
105963
|
+
/* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(85533);
|
|
105964
|
+
/* harmony import */ var _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(82302);
|
|
105965
|
+
/* harmony import */ var _File_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(29217);
|
|
105966
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(29587);
|
|
105967
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(14520);
|
|
105968
|
+
|
|
105475
105969
|
|
|
105476
105970
|
|
|
105477
105971
|
|
|
@@ -105503,8 +105997,23 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105503
105997
|
reference;
|
|
105504
105998
|
options;
|
|
105505
105999
|
refractCache;
|
|
106000
|
+
|
|
106001
|
+
/**
|
|
106002
|
+
* Index of `$id`-bearing schemas per document, shared across nested visitors
|
|
106003
|
+
* of a single dereference run so it never outlives mutations of the documents.
|
|
106004
|
+
*/
|
|
106005
|
+
schema$idIndex;
|
|
105506
106006
|
visited;
|
|
105507
106007
|
|
|
106008
|
+
/**
|
|
106009
|
+
* `$id`s of the JSON Schema elements enclosing the traversal root within its
|
|
106010
|
+
* document (outermost first). Empty when the root is the document itself; a
|
|
106011
|
+
* nested visitor traversing a fragment is seeded with the `$id`s of the
|
|
106012
|
+
* schemas the fragment sits under, so the `$ref`s and `$id`s within resolve
|
|
106013
|
+
* against the same base as they would from the document root.
|
|
106014
|
+
*/
|
|
106015
|
+
ancestorSchema$ids;
|
|
106016
|
+
|
|
105508
106017
|
/**
|
|
105509
106018
|
* Tracks element ancestors across dive-deep traversal boundaries.
|
|
105510
106019
|
* Used for cycle detection: if a referenced element is found in
|
|
@@ -105516,29 +106025,33 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105516
106025
|
options,
|
|
105517
106026
|
indirections = [],
|
|
105518
106027
|
refractCache = new WeakMap(),
|
|
105519
|
-
|
|
105520
|
-
|
|
106028
|
+
schema$idIndex = new WeakMap(),
|
|
106029
|
+
ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(),
|
|
106030
|
+
visited = new WeakSet(),
|
|
106031
|
+
ancestorSchema$ids = []
|
|
105521
106032
|
}) {
|
|
105522
106033
|
this.indirections = indirections;
|
|
105523
106034
|
this.reference = reference;
|
|
105524
106035
|
this.options = options;
|
|
105525
106036
|
this.refractCache = refractCache;
|
|
105526
|
-
this.
|
|
106037
|
+
this.schema$idIndex = schema$idIndex;
|
|
106038
|
+
this.ancestors = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(...ancestors);
|
|
105527
106039
|
this.visited = visited;
|
|
106040
|
+
this.ancestorSchema$ids = ancestorSchema$ids;
|
|
105528
106041
|
}
|
|
105529
106042
|
toAncestorLineage(path) {
|
|
105530
106043
|
const ancestorNodes = path.getAncestorNodes();
|
|
105531
106044
|
const directAncestors = new Set(ancestorNodes.filter(_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement));
|
|
105532
|
-
const ancestorsLineage = new
|
|
106045
|
+
const ancestorsLineage = new _util_mjs__WEBPACK_IMPORTED_MODULE_30__.AncestorLineage(...this.ancestors, directAncestors);
|
|
105533
106046
|
return [ancestorsLineage, directAncestors];
|
|
105534
106047
|
}
|
|
105535
106048
|
toBaseURI(uri) {
|
|
105536
|
-
return
|
|
106049
|
+
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
106050
|
}
|
|
105538
106051
|
async toReference(uri) {
|
|
105539
106052
|
// detect maximum depth of resolution
|
|
105540
106053
|
if (this.reference.depth >= this.options.resolve.maxDepth) {
|
|
105541
|
-
throw new
|
|
106054
|
+
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
106055
|
maxDepth: this.options.resolve.maxDepth,
|
|
105543
106056
|
uri: this.reference.uri
|
|
105544
106057
|
});
|
|
@@ -105552,7 +106065,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105552
106065
|
if (refSet.has(baseURI)) {
|
|
105553
106066
|
return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(baseURI, 'uri'));
|
|
105554
106067
|
}
|
|
105555
|
-
const parseResult = await (0,
|
|
106068
|
+
const parseResult = await (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_26__["default"])(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(baseURI), {
|
|
105556
106069
|
...this.options,
|
|
105557
106070
|
parse: {
|
|
105558
106071
|
...this.options.parse,
|
|
@@ -105575,15 +106088,15 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105575
106088
|
// context always sees raw, unresolved elements and processes them with its own
|
|
105576
106089
|
// ancestors/indirections. The trade-off is that elements referenced by multiple
|
|
105577
106090
|
// documents would be resolved once per context instead of being reused.
|
|
105578
|
-
const mutableReference = new
|
|
106091
|
+
const mutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
105579
106092
|
uri: baseURI,
|
|
105580
|
-
value: this.options.dereference.immutable ? (0,
|
|
106093
|
+
value: this.options.dereference.immutable ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneDeep)(parseResult) : parseResult,
|
|
105581
106094
|
depth: this.reference.depth + 1
|
|
105582
106095
|
});
|
|
105583
106096
|
refSet.add(mutableReference);
|
|
105584
106097
|
if (this.options.dereference.immutable) {
|
|
105585
106098
|
// register new immutable reference with original parseResult
|
|
105586
|
-
const immutableReference = new
|
|
106099
|
+
const immutableReference = new _Reference_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]({
|
|
105587
106100
|
uri: `immutable://${baseURI}`,
|
|
105588
106101
|
value: parseResult,
|
|
105589
106102
|
depth: this.reference.depth + 1
|
|
@@ -105607,10 +106120,10 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105607
106120
|
const {
|
|
105608
106121
|
continueOnError
|
|
105609
106122
|
} = this.options.dereference;
|
|
105610
|
-
const isEntryDocument =
|
|
106123
|
+
const isEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
|
|
105611
106124
|
const uri = this.reference.uri;
|
|
105612
106125
|
const type = referencingElement.element;
|
|
105613
|
-
const codeFrame = (0,
|
|
106126
|
+
const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_9__["default"])(referencingElement);
|
|
105614
106127
|
|
|
105615
106128
|
// find element location by identity in the document tree.
|
|
105616
106129
|
// guarded: this.reference.value may not be a ParseResultElement or may lack a result.
|
|
@@ -105619,7 +106132,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105619
106132
|
let location;
|
|
105620
106133
|
const root = this.reference.value.result;
|
|
105621
106134
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isElement)(root)) {
|
|
105622
|
-
(0,
|
|
106135
|
+
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverse)(root, {
|
|
105623
106136
|
enter: p => {
|
|
105624
106137
|
if (p.node === referencingElement || this.refractCache.get(p.node) === referencingElement) {
|
|
105625
106138
|
location = p.formatPath();
|
|
@@ -105640,10 +106153,10 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105640
106153
|
|
|
105641
106154
|
// enrich existing error from nested visitor or create new one
|
|
105642
106155
|
let unresolvedError;
|
|
105643
|
-
if (error instanceof
|
|
106156
|
+
if (error instanceof _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__["default"]) {
|
|
105644
106157
|
// prefix relative locations for entries belonging to the referenced document
|
|
105645
106158
|
const refBaseURI = this.toBaseURI(refFieldValue);
|
|
105646
|
-
const fragment =
|
|
106159
|
+
const fragment = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference(refFieldValue);
|
|
105647
106160
|
if (fragment) {
|
|
105648
106161
|
if (refBaseURI === error.uri && error.location) {
|
|
105649
106162
|
error.location = fragment + error.location;
|
|
@@ -105656,7 +106169,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105656
106169
|
error.trace = [hop, ...error.trace];
|
|
105657
106170
|
unresolvedError = error;
|
|
105658
106171
|
} else {
|
|
105659
|
-
unresolvedError = new
|
|
106172
|
+
unresolvedError = new _errors_UnresolvableReferenceError_mjs__WEBPACK_IMPORTED_MODULE_23__["default"](message, {
|
|
105660
106173
|
cause: error,
|
|
105661
106174
|
type,
|
|
105662
106175
|
uri,
|
|
@@ -105678,8 +106191,8 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105678
106191
|
path.skip();
|
|
105679
106192
|
return;
|
|
105680
106193
|
}
|
|
105681
|
-
const retrievalURI = this.toBaseURI((0,
|
|
105682
|
-
const isInternalReference =
|
|
106194
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
106195
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
105683
106196
|
const isExternalReference = !isInternalReference;
|
|
105684
106197
|
|
|
105685
106198
|
// ignore resolving internal Reference Objects
|
|
@@ -105694,31 +106207,31 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105694
106207
|
path.skip();
|
|
105695
106208
|
return;
|
|
105696
106209
|
}
|
|
105697
|
-
const $refBaseURI =
|
|
106210
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105698
106211
|
const indirectionsSize = this.indirections.length;
|
|
105699
106212
|
try {
|
|
105700
|
-
const reference = await this.toReference((0,
|
|
106213
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105701
106214
|
this.indirections.push(referencingElement);
|
|
105702
|
-
const jsonPointer =
|
|
106215
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
105703
106216
|
|
|
105704
106217
|
// possibly non-semantic fragment
|
|
105705
|
-
let referencedElement = (0,
|
|
106218
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
105706
106219
|
|
|
105707
106220
|
// applying semantics to a fragment
|
|
105708
106221
|
const referencedElementType = referencingElement.meta.get('referenced-element');
|
|
105709
|
-
if (referencedElement.element !== referencedElementType && !(0,
|
|
106222
|
+
if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isReferenceElement)(referencedElement)) {
|
|
105710
106223
|
if (this.refractCache.has(referencedElement)) {
|
|
105711
106224
|
referencedElement = this.refractCache.get(referencedElement);
|
|
105712
|
-
} else if ((0,
|
|
106225
|
+
} else if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__.isReferenceLikeElement)(referencedElement)) {
|
|
105713
106226
|
// handling generic indirect references
|
|
105714
106227
|
const sourceElement = referencedElement;
|
|
105715
|
-
referencedElement = (0,
|
|
106228
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractReference)(referencedElement);
|
|
105716
106229
|
referencedElement.meta.set('referenced-element', referencedElementType);
|
|
105717
106230
|
this.refractCache.set(sourceElement, referencedElement);
|
|
105718
106231
|
} else {
|
|
105719
106232
|
// handling direct references
|
|
105720
106233
|
const sourceElement = referencedElement;
|
|
105721
|
-
referencedElement = (0,
|
|
106234
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__["default"])(referencedElement, {
|
|
105722
106235
|
element: referencedElementType
|
|
105723
106236
|
});
|
|
105724
106237
|
this.refractCache.set(sourceElement, referencedElement);
|
|
@@ -105727,14 +106240,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105727
106240
|
|
|
105728
106241
|
// detect direct or indirect reference
|
|
105729
106242
|
if (referencingElement === referencedElement) {
|
|
105730
|
-
throw new
|
|
105731
|
-
$ref: (0,
|
|
106243
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Reference Object detected', {
|
|
106244
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105732
106245
|
});
|
|
105733
106246
|
}
|
|
105734
106247
|
|
|
105735
106248
|
// detect maximum depth of dereferencing
|
|
105736
106249
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
105737
|
-
throw new
|
|
106250
|
+
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
106251
|
maxDepth: this.options.dereference.maxDepth,
|
|
105739
106252
|
uri: this.reference.uri
|
|
105740
106253
|
});
|
|
@@ -105745,14 +106258,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105745
106258
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
105746
106259
|
reference.refSet.circular = true;
|
|
105747
106260
|
if (this.options.dereference.circular === 'error') {
|
|
105748
|
-
throw new
|
|
105749
|
-
$ref: (0,
|
|
106261
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106262
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105750
106263
|
});
|
|
105751
106264
|
} else if (this.options.dereference.circular === 'replace') {
|
|
105752
|
-
const refElement = new
|
|
106265
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
105753
106266
|
type: referencingElement.element,
|
|
105754
106267
|
uri: reference.uri,
|
|
105755
|
-
$ref: (0,
|
|
106268
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105756
106269
|
});
|
|
105757
106270
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
105758
106271
|
const replacement = replacer(refElement);
|
|
@@ -105771,9 +106284,9 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105771
106284
|
* 3. Fragment is a Reference Object. We need to follow it to get the eventual value
|
|
105772
106285
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
105773
106286
|
*/
|
|
105774
|
-
const isNonEntryDocument =
|
|
106287
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
105775
106288
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
105776
|
-
if ((isExternalReference || isNonEntryDocument || (0,
|
|
106289
|
+
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
106290
|
if (shouldDetectCircular) {
|
|
105778
106291
|
this.visited.add(referencedElement);
|
|
105779
106292
|
}
|
|
@@ -105783,10 +106296,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105783
106296
|
indirections: [...this.indirections],
|
|
105784
106297
|
options: this.options,
|
|
105785
106298
|
refractCache: this.refractCache,
|
|
106299
|
+
schema$idIndex: this.schema$idIndex,
|
|
105786
106300
|
visited: this.visited,
|
|
105787
106301
|
ancestors: ancestorsLineage
|
|
105788
106302
|
});
|
|
105789
|
-
referencedElement = await (0,
|
|
106303
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
105790
106304
|
mutable: true,
|
|
105791
106305
|
skipVisited: 'skip'
|
|
105792
106306
|
});
|
|
@@ -105796,14 +106310,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105796
106310
|
/**
|
|
105797
106311
|
* Creating a new version of referenced element to avoid modifying the original one.
|
|
105798
106312
|
*/
|
|
105799
|
-
const mergedElement = (0,
|
|
106313
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
105800
106314
|
// annotate fragment with info about original Reference element
|
|
105801
106315
|
mergedElement.meta.set('ref-fields', {
|
|
105802
|
-
$ref: (0,
|
|
106316
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref),
|
|
105803
106317
|
// @ts-ignore
|
|
105804
|
-
description: (0,
|
|
106318
|
+
description: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.description),
|
|
105805
106319
|
// @ts-ignore
|
|
105806
|
-
summary: (0,
|
|
106320
|
+
summary: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.summary)
|
|
105807
106321
|
});
|
|
105808
106322
|
// annotate fragment with info about origin and type
|
|
105809
106323
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -105811,7 +106325,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105811
106325
|
|
|
105812
106326
|
// override description and summary (outer has higher priority then inner)
|
|
105813
106327
|
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,
|
|
106328
|
+
const fields = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__.fixedFields)(referencedElement, {
|
|
105815
106329
|
indexed: true
|
|
105816
106330
|
});
|
|
105817
106331
|
if (referencingElement.hasKey('description') && Object.hasOwn(fields, 'description')) {
|
|
@@ -105829,7 +106343,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105829
106343
|
*/
|
|
105830
106344
|
path.replaceWith(mergedElement);
|
|
105831
106345
|
} catch (error) {
|
|
105832
|
-
const $ref = (0,
|
|
106346
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
105833
106347
|
this.handleError(`Error while dereferencing Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
105834
106348
|
} finally {
|
|
105835
106349
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105848,8 +106362,8 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105848
106362
|
path.skip();
|
|
105849
106363
|
return;
|
|
105850
106364
|
}
|
|
105851
|
-
const retrievalURI = this.toBaseURI((0,
|
|
105852
|
-
const isInternalReference =
|
|
106365
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
106366
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
105853
106367
|
const isExternalReference = !isInternalReference;
|
|
105854
106368
|
|
|
105855
106369
|
// ignore resolving internal Path Item Objects
|
|
@@ -105862,37 +106376,37 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105862
106376
|
// skip traversing this Path Item element but traverse all it's child elements
|
|
105863
106377
|
return;
|
|
105864
106378
|
}
|
|
105865
|
-
const $refBaseURI =
|
|
106379
|
+
const $refBaseURI = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.resolve(retrievalURI, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105866
106380
|
const indirectionsSize = this.indirections.length;
|
|
105867
106381
|
try {
|
|
105868
|
-
const reference = await this.toReference((0,
|
|
106382
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref));
|
|
105869
106383
|
this.indirections.push(referencingElement);
|
|
105870
|
-
const jsonPointer =
|
|
106384
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
105871
106385
|
|
|
105872
106386
|
// possibly non-semantic referenced element
|
|
105873
|
-
let referencedElement = (0,
|
|
106387
|
+
let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
105874
106388
|
|
|
105875
106389
|
// applying semantics to a referenced element
|
|
105876
|
-
if (!(0,
|
|
106390
|
+
if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement)) {
|
|
105877
106391
|
if (this.refractCache.has(referencedElement)) {
|
|
105878
106392
|
referencedElement = this.refractCache.get(referencedElement);
|
|
105879
106393
|
} else {
|
|
105880
106394
|
const sourceElement = referencedElement;
|
|
105881
|
-
referencedElement = (0,
|
|
106395
|
+
referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractPathItem)(referencedElement);
|
|
105882
106396
|
this.refractCache.set(sourceElement, referencedElement);
|
|
105883
106397
|
}
|
|
105884
106398
|
}
|
|
105885
106399
|
|
|
105886
106400
|
// detect direct or indirect reference
|
|
105887
106401
|
if (referencingElement === referencedElement) {
|
|
105888
|
-
throw new
|
|
105889
|
-
$ref: (0,
|
|
106402
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Path Item Object reference detected', {
|
|
106403
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105890
106404
|
});
|
|
105891
106405
|
}
|
|
105892
106406
|
|
|
105893
106407
|
// detect maximum depth of dereferencing
|
|
105894
106408
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
105895
|
-
throw new
|
|
106409
|
+
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
106410
|
maxDepth: this.options.dereference.maxDepth,
|
|
105897
106411
|
uri: this.reference.uri
|
|
105898
106412
|
});
|
|
@@ -105903,14 +106417,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105903
106417
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
105904
106418
|
reference.refSet.circular = true;
|
|
105905
106419
|
if (this.options.dereference.circular === 'error') {
|
|
105906
|
-
throw new
|
|
105907
|
-
$ref: (0,
|
|
106420
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106421
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105908
106422
|
});
|
|
105909
106423
|
} else if (this.options.dereference.circular === 'replace') {
|
|
105910
|
-
const refElement = new
|
|
106424
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
105911
106425
|
type: referencingElement.element,
|
|
105912
106426
|
uri: reference.uri,
|
|
105913
|
-
$ref: (0,
|
|
106427
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105914
106428
|
});
|
|
105915
106429
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
105916
106430
|
const replacement = replacer(refElement);
|
|
@@ -105929,9 +106443,9 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105929
106443
|
* 3. Fragment is a Path Item Object with $ref field. We need to follow it to get the eventual value
|
|
105930
106444
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
105931
106445
|
*/
|
|
105932
|
-
const isNonEntryDocument =
|
|
106446
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
105933
106447
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
105934
|
-
if ((isExternalReference || isNonEntryDocument || (0,
|
|
106448
|
+
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
106449
|
if (shouldDetectCircular) {
|
|
105936
106450
|
this.visited.add(referencedElement);
|
|
105937
106451
|
}
|
|
@@ -105941,10 +106455,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105941
106455
|
indirections: [...this.indirections],
|
|
105942
106456
|
options: this.options,
|
|
105943
106457
|
refractCache: this.refractCache,
|
|
106458
|
+
schema$idIndex: this.schema$idIndex,
|
|
105944
106459
|
visited: this.visited,
|
|
105945
106460
|
ancestors: ancestorsLineage
|
|
105946
106461
|
});
|
|
105947
|
-
referencedElement = await (0,
|
|
106462
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
105948
106463
|
mutable: true,
|
|
105949
106464
|
skipVisited: 'skip'
|
|
105950
106465
|
});
|
|
@@ -105954,18 +106469,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105954
106469
|
/**
|
|
105955
106470
|
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
105956
106471
|
*/
|
|
105957
|
-
if ((0,
|
|
105958
|
-
const mergedElement = (0,
|
|
106472
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isPathItemElement)(referencedElement)) {
|
|
106473
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
105959
106474
|
// existing keywords from referencing PathItemElement overrides ones from referenced element
|
|
105960
106475
|
referencingElement.forEach((value, keyElement, item) => {
|
|
105961
|
-
mergedElement.remove((0,
|
|
106476
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(keyElement));
|
|
105962
106477
|
mergedElement.content.push(item);
|
|
105963
106478
|
});
|
|
105964
106479
|
mergedElement.remove('$ref');
|
|
105965
106480
|
|
|
105966
106481
|
// annotate referenced element with info about original referencing element
|
|
105967
106482
|
mergedElement.meta.set('ref-fields', {
|
|
105968
|
-
$ref: (0,
|
|
106483
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
105969
106484
|
});
|
|
105970
106485
|
// annotate referenced element with info about origin and type
|
|
105971
106486
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -105978,7 +106493,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105978
106493
|
*/
|
|
105979
106494
|
path.replaceWith(referencedElement);
|
|
105980
106495
|
} catch (error) {
|
|
105981
|
-
const $ref = (0,
|
|
106496
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
105982
106497
|
this.handleError(`Error while dereferencing Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
105983
106498
|
} finally {
|
|
105984
106499
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -105994,18 +106509,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
105994
106509
|
|
|
105995
106510
|
// operationRef and operationId fields are mutually exclusive
|
|
105996
106511
|
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,
|
|
106512
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
|
|
106513
|
+
operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef),
|
|
106514
|
+
operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId)
|
|
106000
106515
|
});
|
|
106001
106516
|
}
|
|
106002
106517
|
try {
|
|
106003
106518
|
let operationElement;
|
|
106004
106519
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(linkElement.operationRef)) {
|
|
106005
106520
|
// possibly non-semantic referenced element
|
|
106006
|
-
const jsonPointer =
|
|
106007
|
-
const retrievalURI = this.toBaseURI((0,
|
|
106008
|
-
const isInternalReference =
|
|
106521
|
+
const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106522
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106523
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106009
106524
|
const isExternalReference = !isInternalReference;
|
|
106010
106525
|
|
|
106011
106526
|
// ignore resolving internal Operation Object reference
|
|
@@ -106018,24 +106533,24 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106018
106533
|
// skip traversing this Link element but traverse all it's child elements
|
|
106019
106534
|
return;
|
|
106020
106535
|
}
|
|
106021
|
-
const reference = await this.toReference((0,
|
|
106022
|
-
operationElement = (0,
|
|
106536
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationRef));
|
|
106537
|
+
operationElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.evaluate)(reference.value.result, jsonPointer);
|
|
106023
106538
|
// applying semantics to a referenced element
|
|
106024
|
-
if (!(0,
|
|
106539
|
+
if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isOperationElement)(operationElement)) {
|
|
106025
106540
|
if (this.refractCache.has(operationElement)) {
|
|
106026
106541
|
operationElement = this.refractCache.get(operationElement);
|
|
106027
106542
|
} else {
|
|
106028
106543
|
const sourceElement = operationElement;
|
|
106029
|
-
operationElement = (0,
|
|
106544
|
+
operationElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.refractOperation)(operationElement);
|
|
106030
106545
|
this.refractCache.set(sourceElement, operationElement);
|
|
106031
106546
|
}
|
|
106032
106547
|
}
|
|
106033
106548
|
// create shallow clone to be able to annotate with metadata
|
|
106034
|
-
operationElement = (0,
|
|
106549
|
+
operationElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(operationElement);
|
|
106035
106550
|
// annotate operation element with info about origin and type
|
|
106036
106551
|
operationElement.meta.set('ref-origin', reference.uri);
|
|
106037
106552
|
operationElement.meta.set('ref-type', linkElement.element);
|
|
106038
|
-
const linkElementCopy = (0,
|
|
106553
|
+
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(linkElement);
|
|
106039
106554
|
linkElementCopy.operationRef?.meta.set('operation', operationElement);
|
|
106040
106555
|
|
|
106041
106556
|
/**
|
|
@@ -106045,17 +106560,17 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106045
106560
|
return;
|
|
106046
106561
|
}
|
|
106047
106562
|
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,
|
|
106563
|
+
const operationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(linkElement.operationId);
|
|
106564
|
+
const reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(this.reference.uri));
|
|
106565
|
+
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
106566
|
operationElement = operationPath?.node;
|
|
106052
106567
|
// OperationElement not found by its operationId
|
|
106053
106568
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(operationElement)) {
|
|
106054
|
-
throw new
|
|
106569
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"](`OperationElement(operationId=${operationId}) not found`, {
|
|
106055
106570
|
operationId
|
|
106056
106571
|
});
|
|
106057
106572
|
}
|
|
106058
|
-
const linkElementCopy = (0,
|
|
106573
|
+
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(linkElement);
|
|
106059
106574
|
linkElementCopy.operationId?.meta.set('operation', operationElement);
|
|
106060
106575
|
|
|
106061
106576
|
/**
|
|
@@ -106065,7 +106580,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106065
106580
|
}
|
|
106066
106581
|
} catch (error) {
|
|
106067
106582
|
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,
|
|
106583
|
+
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
106584
|
this.handleError(`Error while dereferencing Link Object. Cannot resolve ${refFieldName} "${refFieldValue}": ${error.message}`, error, linkElement, refFieldName, refFieldValue, path);
|
|
106070
106585
|
}
|
|
106071
106586
|
}
|
|
@@ -106079,13 +106594,13 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106079
106594
|
|
|
106080
106595
|
// value and externalValue fields are mutually exclusive
|
|
106081
106596
|
if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(exampleElement.externalValue)) {
|
|
106082
|
-
throw new
|
|
106083
|
-
value: (0,
|
|
106084
|
-
externalValue: (0,
|
|
106597
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
|
|
106598
|
+
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.value),
|
|
106599
|
+
externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue)
|
|
106085
106600
|
});
|
|
106086
106601
|
}
|
|
106087
|
-
const retrievalURI = this.toBaseURI((0,
|
|
106088
|
-
const isInternalReference =
|
|
106602
|
+
const retrievalURI = this.toBaseURI((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue));
|
|
106603
|
+
const isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106089
106604
|
const isExternalReference = !isInternalReference;
|
|
106090
106605
|
|
|
106091
106606
|
// ignore resolving internal Example Objects
|
|
@@ -106099,14 +106614,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106099
106614
|
return;
|
|
106100
106615
|
}
|
|
106101
106616
|
try {
|
|
106102
|
-
const reference = await this.toReference((0,
|
|
106617
|
+
const reference = await this.toReference((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue));
|
|
106103
106618
|
|
|
106104
106619
|
// shallow clone of the referenced element
|
|
106105
|
-
const valueElement = (0,
|
|
106620
|
+
const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(reference.value.result);
|
|
106106
106621
|
// annotate element with info about origin and type
|
|
106107
106622
|
valueElement.meta.set('ref-origin', reference.uri);
|
|
106108
106623
|
valueElement.meta.set('ref-type', exampleElement.element);
|
|
106109
|
-
const exampleElementCopy = (0,
|
|
106624
|
+
const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(exampleElement);
|
|
106110
106625
|
exampleElementCopy.value = valueElement;
|
|
106111
106626
|
|
|
106112
106627
|
/**
|
|
@@ -106114,7 +106629,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106114
106629
|
*/
|
|
106115
106630
|
path.replaceWith(exampleElementCopy);
|
|
106116
106631
|
} catch (error) {
|
|
106117
|
-
const externalValue = (0,
|
|
106632
|
+
const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(exampleElement.externalValue);
|
|
106118
106633
|
this.handleError(`Error while dereferencing Example Object. Cannot resolve externalValue "${externalValue}": ${error.message}`, error, exampleElement, 'externalValue', externalValue, path);
|
|
106119
106634
|
}
|
|
106120
106635
|
}
|
|
@@ -106134,30 +106649,69 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106134
106649
|
const indirectionsSize = this.indirections.length;
|
|
106135
106650
|
try {
|
|
106136
106651
|
// compute baseURI using rules around $id and $ref keywords
|
|
106137
|
-
let reference = await this.toReference(
|
|
106652
|
+
let reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize(this.reference.uri));
|
|
106138
106653
|
let {
|
|
106139
106654
|
uri: retrievalURI
|
|
106140
106655
|
} = reference;
|
|
106141
|
-
|
|
106142
|
-
|
|
106143
|
-
const
|
|
106656
|
+
// base URI in effect at the traversal root: the document base refined by
|
|
106657
|
+
// the $ids of the schemas enclosing the root when the root is a fragment
|
|
106658
|
+
const rootBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$ids)(retrievalURI, this.ancestorSchema$ids);
|
|
106659
|
+
const schemaBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchemaBaseURI)(rootBaseURI, path);
|
|
106660
|
+
const $refBaseURI = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.resolveSchema$refField)(schemaBaseURI, referencingElement);
|
|
106661
|
+
const $refBaseURIStrippedHash = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash($refBaseURI);
|
|
106662
|
+
const file = new _File_mjs__WEBPACK_IMPORTED_MODULE_28__["default"]({
|
|
106144
106663
|
uri: $refBaseURIStrippedHash
|
|
106145
106664
|
});
|
|
106146
106665
|
const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
|
|
106147
106666
|
const isURL = !isUnknownURI;
|
|
106148
|
-
let isInternalReference =
|
|
106667
|
+
let isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === $refBaseURI;
|
|
106149
106668
|
let isExternalReference = !isInternalReference;
|
|
106150
106669
|
|
|
106151
106670
|
// determining reference, proper evaluation and selection mechanism
|
|
106152
106671
|
let referencedElement;
|
|
106672
|
+
// $ids of the schemas enclosing the referenced element within its document
|
|
106673
|
+
let ancestorSchema$ids;
|
|
106153
106674
|
try {
|
|
106154
106675
|
if (isUnknownURI || isURL) {
|
|
106155
106676
|
// we're dealing with canonical URI or URL with possible fragment
|
|
106156
106677
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106157
106678
|
const selector = $refBaseURI;
|
|
106158
|
-
|
|
106159
|
-
|
|
106160
|
-
|
|
106679
|
+
// the fragment being traversed is searched before the whole document: a
|
|
106680
|
+
// fragment referenced from another document (a Response, Parameter, Path
|
|
106681
|
+
// Item, ...) is refracted with its own semantics, so the Schema Objects it
|
|
106682
|
+
// contains are indexed, whereas the referenced document as a whole is
|
|
106683
|
+
// parsed generically and refracted as a bare JSON Schema, which leaves
|
|
106684
|
+
// those Schema Objects (under `content`, `schema`, ...) unrecognized and
|
|
106685
|
+
// their `$id`s out of the index
|
|
106686
|
+
const documentElement = reference.value.result;
|
|
106687
|
+
const rootNode = path.getAncestorNodes().at(-1) ?? path.node;
|
|
106688
|
+
const fragmentElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.isParseResultElement)(rootNode) ? rootNode.result : rootNode;
|
|
106689
|
+
try {
|
|
106690
|
+
// the fragment's $ids resolve against the base its enclosing chain
|
|
106691
|
+
// leaves in effect, which then also prefixes the located schema's chain
|
|
106692
|
+
({
|
|
106693
|
+
element: referencedElement,
|
|
106694
|
+
ancestorSchema$ids
|
|
106695
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__.locate)(selector, (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(fragmentElement), {
|
|
106696
|
+
baseURI: rootBaseURI,
|
|
106697
|
+
index: this.schema$idIndex
|
|
106698
|
+
}));
|
|
106699
|
+
ancestorSchema$ids = [...this.ancestorSchema$ids, ...ancestorSchema$ids];
|
|
106700
|
+
} catch (error) {
|
|
106701
|
+
if (!(error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__["default"]) || fragmentElement === documentElement) {
|
|
106702
|
+
throw error;
|
|
106703
|
+
}
|
|
106704
|
+
// the document index is rooted at the document, so the located chain
|
|
106705
|
+
// is already document-relative and takes no prefix
|
|
106706
|
+
({
|
|
106707
|
+
element: referencedElement,
|
|
106708
|
+
ancestorSchema$ids
|
|
106709
|
+
} = (0,_selectors_uri_mjs__WEBPACK_IMPORTED_MODULE_19__.locate)(selector, (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(documentElement), {
|
|
106710
|
+
baseURI: reference.uri,
|
|
106711
|
+
index: this.schema$idIndex
|
|
106712
|
+
}));
|
|
106713
|
+
}
|
|
106714
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106161
106715
|
|
|
106162
106716
|
// ignore resolving internal Schema Objects
|
|
106163
106717
|
if (!this.options.resolve.internal && isInternalReference) {
|
|
@@ -106172,7 +106726,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106172
106726
|
} else {
|
|
106173
106727
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
106174
106728
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106175
|
-
isInternalReference =
|
|
106729
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106176
106730
|
isExternalReference = !isInternalReference;
|
|
106177
106731
|
|
|
106178
106732
|
// ignore resolving internal Schema Objects
|
|
@@ -106185,21 +106739,24 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106185
106739
|
// skip traversing this schema element but traverse all it's child elements
|
|
106186
106740
|
return;
|
|
106187
106741
|
}
|
|
106188
|
-
reference = await this.toReference(
|
|
106189
|
-
const selector =
|
|
106190
|
-
const referenceAsSchema = (0,
|
|
106191
|
-
|
|
106192
|
-
|
|
106742
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106743
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
106744
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106745
|
+
({
|
|
106746
|
+
element: referencedElement,
|
|
106747
|
+
ancestorSchema$ids
|
|
106748
|
+
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__.locate)(referenceAsSchema, selector));
|
|
106749
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106193
106750
|
}
|
|
106194
106751
|
} catch (error) {
|
|
106195
106752
|
/**
|
|
106196
106753
|
* SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
106197
106754
|
* the URL and assume the returned response is a JSON Schema.
|
|
106198
106755
|
*/
|
|
106199
|
-
if (isURL && error instanceof
|
|
106200
|
-
if ((0,_selectors_$
|
|
106756
|
+
if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_mjs__WEBPACK_IMPORTED_MODULE_24__["default"]) {
|
|
106757
|
+
if ((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.isAnchor)((0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.uriToAnchor)($refBaseURI))) {
|
|
106201
106758
|
// we're dealing with JSON Schema $anchor here
|
|
106202
|
-
isInternalReference =
|
|
106759
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106203
106760
|
isExternalReference = !isInternalReference;
|
|
106204
106761
|
|
|
106205
106762
|
// ignore resolving internal Schema Objects
|
|
@@ -106212,15 +106769,18 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106212
106769
|
// skip traversing this schema element but traverse all it's child elements
|
|
106213
106770
|
return;
|
|
106214
106771
|
}
|
|
106215
|
-
reference = await this.toReference(
|
|
106216
|
-
const selector = (0,_selectors_$
|
|
106217
|
-
const referenceAsSchema = (0,
|
|
106218
|
-
|
|
106219
|
-
|
|
106772
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106773
|
+
const selector = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.uriToAnchor)($refBaseURI);
|
|
106774
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106775
|
+
({
|
|
106776
|
+
element: referencedElement,
|
|
106777
|
+
ancestorSchema$ids
|
|
106778
|
+
} = (0,_selectors_$anchor_mjs__WEBPACK_IMPORTED_MODULE_18__.locate)(selector, referenceAsSchema));
|
|
106779
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106220
106780
|
} else {
|
|
106221
106781
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
106222
106782
|
retrievalURI = this.toBaseURI($refBaseURI);
|
|
106223
|
-
isInternalReference =
|
|
106783
|
+
isInternalReference = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(this.reference.uri) === retrievalURI;
|
|
106224
106784
|
isExternalReference = !isInternalReference;
|
|
106225
106785
|
|
|
106226
106786
|
// ignore resolving internal Schema Objects
|
|
@@ -106233,11 +106793,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106233
106793
|
// skip traversing this schema element but traverse all it's child elements
|
|
106234
106794
|
return;
|
|
106235
106795
|
}
|
|
106236
|
-
reference = await this.toReference(
|
|
106237
|
-
const selector =
|
|
106238
|
-
const referenceAsSchema = (0,
|
|
106239
|
-
|
|
106240
|
-
|
|
106796
|
+
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.unsanitize($refBaseURI));
|
|
106797
|
+
const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_13__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
106798
|
+
const referenceAsSchema = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(reference.value.result);
|
|
106799
|
+
({
|
|
106800
|
+
element: referencedElement,
|
|
106801
|
+
ancestorSchema$ids
|
|
106802
|
+
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_20__.locate)(referenceAsSchema, selector));
|
|
106803
|
+
referencedElement = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_29__.maybeRefractToSchemaElement)(referencedElement);
|
|
106241
106804
|
}
|
|
106242
106805
|
} else {
|
|
106243
106806
|
throw error;
|
|
@@ -106247,14 +106810,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106247
106810
|
|
|
106248
106811
|
// detect direct or indirect reference
|
|
106249
106812
|
if (referencingElement === referencedElement) {
|
|
106250
|
-
throw new
|
|
106251
|
-
$ref: (0,
|
|
106813
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Recursive Schema Object reference detected', {
|
|
106814
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106252
106815
|
});
|
|
106253
106816
|
}
|
|
106254
106817
|
|
|
106255
106818
|
// detect maximum depth of dereferencing
|
|
106256
106819
|
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
106257
|
-
throw new
|
|
106820
|
+
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
106821
|
maxDepth: this.options.dereference.maxDepth,
|
|
106259
106822
|
uri: this.reference.uri
|
|
106260
106823
|
});
|
|
@@ -106265,14 +106828,14 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106265
106828
|
if (ancestorsLineage.includes(referencedElement)) {
|
|
106266
106829
|
reference.refSet.circular = true;
|
|
106267
106830
|
if (this.options.dereference.circular === 'error') {
|
|
106268
|
-
throw new
|
|
106269
|
-
$ref: (0,
|
|
106831
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_10__["default"]('Circular reference detected', {
|
|
106832
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106270
106833
|
});
|
|
106271
106834
|
} else if (this.options.dereference.circular === 'replace') {
|
|
106272
|
-
const refElement = new
|
|
106835
|
+
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]($refBaseURI, {
|
|
106273
106836
|
type: referencingElement.element,
|
|
106274
106837
|
uri: reference.uri,
|
|
106275
|
-
$ref: (0,
|
|
106838
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106276
106839
|
});
|
|
106277
106840
|
const replacer = this.options.dereference.strategyOpts['openapi-3-1']?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
106278
106841
|
const replacement = replacer(refElement);
|
|
@@ -106291,9 +106854,13 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106291
106854
|
* 3. Fragment is a Schema Object with $ref field. We need to follow it to get the eventual value
|
|
106292
106855
|
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
106293
106856
|
*/
|
|
106294
|
-
const isNonEntryDocument =
|
|
106857
|
+
const isNonEntryDocument = _util_url_mjs__WEBPACK_IMPORTED_MODULE_25__.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
106295
106858
|
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
106296
|
-
|
|
106859
|
+
// content transplanted into the referencing site is traversed under that
|
|
106860
|
+
// site's $id chain; a fragment enclosed by a different chain has its own
|
|
106861
|
+
// $refs resolved in place first, by a nested visitor seeded with that chain
|
|
106862
|
+
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()));
|
|
106863
|
+
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
106864
|
if (shouldDetectCircular) {
|
|
106298
106865
|
this.visited.add(referencedElement);
|
|
106299
106866
|
}
|
|
@@ -106303,10 +106870,12 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106303
106870
|
indirections: [...this.indirections],
|
|
106304
106871
|
options: this.options,
|
|
106305
106872
|
refractCache: this.refractCache,
|
|
106873
|
+
schema$idIndex: this.schema$idIndex,
|
|
106306
106874
|
visited: this.visited,
|
|
106307
|
-
ancestors: ancestorsLineage
|
|
106875
|
+
ancestors: ancestorsLineage,
|
|
106876
|
+
ancestorSchema$ids
|
|
106308
106877
|
});
|
|
106309
|
-
referencedElement = await (0,
|
|
106878
|
+
referencedElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_11__.traverseAsync)(referencedElement, visitor, {
|
|
106310
106879
|
mutable: true,
|
|
106311
106880
|
skipVisited: 'skip'
|
|
106312
106881
|
});
|
|
@@ -106314,11 +106883,11 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106314
106883
|
}
|
|
106315
106884
|
|
|
106316
106885
|
// Boolean JSON Schemas
|
|
106317
|
-
if ((0,
|
|
106318
|
-
const booleanJsonSchemaElement = (0,
|
|
106886
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.isBooleanJSONSchemaElement)(referencedElement)) {
|
|
106887
|
+
const booleanJsonSchemaElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneDeep)(referencedElement);
|
|
106319
106888
|
// annotate referenced element with info about original referencing element
|
|
106320
106889
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
106321
|
-
$ref: (0,
|
|
106890
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106322
106891
|
});
|
|
106323
106892
|
// annotate referenced element with info about origin and type
|
|
106324
106893
|
booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
|
|
@@ -106331,17 +106900,17 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106331
106900
|
/**
|
|
106332
106901
|
* Creating a new version of Schema Object by merging fields from referenced Schema Object with referencing one.
|
|
106333
106902
|
*/
|
|
106334
|
-
if ((0,
|
|
106335
|
-
const mergedElement = (0,
|
|
106903
|
+
if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__.isSchemaElement)(referencedElement)) {
|
|
106904
|
+
const mergedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__.cloneShallow)(referencedElement);
|
|
106336
106905
|
// existing keywords from referencing schema overrides ones from referenced schema
|
|
106337
106906
|
referencingElement.forEach((value, keyElement, item) => {
|
|
106338
|
-
mergedElement.remove((0,
|
|
106907
|
+
mergedElement.remove((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(keyElement));
|
|
106339
106908
|
mergedElement.content.push(item);
|
|
106340
106909
|
});
|
|
106341
106910
|
mergedElement.remove('$ref');
|
|
106342
106911
|
// annotate referenced element with info about original referencing element
|
|
106343
106912
|
mergedElement.meta.set('ref-fields', {
|
|
106344
|
-
$ref: (0,
|
|
106913
|
+
$ref: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref)
|
|
106345
106914
|
});
|
|
106346
106915
|
// annotate fragment with info about origin and type
|
|
106347
106916
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
@@ -106353,7 +106922,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
106353
106922
|
*/
|
|
106354
106923
|
path.replaceWith(referencedElement);
|
|
106355
106924
|
} catch (error) {
|
|
106356
|
-
const $ref = (0,
|
|
106925
|
+
const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement.$ref);
|
|
106357
106926
|
this.handleError(`Error while dereferencing Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
|
|
106358
106927
|
} finally {
|
|
106359
106928
|
if (this.indirections.length > indirectionsSize) this.indirections.pop();
|
|
@@ -110351,6 +110920,38 @@ const resolve = (from, to) => {
|
|
|
110351
110920
|
return resolvedUrl.toString();
|
|
110352
110921
|
};
|
|
110353
110922
|
|
|
110923
|
+
/**
|
|
110924
|
+
* Computes the URI reference that resolves to `to` against `from` — the inverse
|
|
110925
|
+
* of `resolve`: `resolve(from, relative(from, to)) === to`. The reference is
|
|
110926
|
+
* relative to the directory of `from` (its last path segment is the document,
|
|
110927
|
+
* not a directory). When the two URIs differ in scheme or authority, or either
|
|
110928
|
+
* has no hierarchical path (e.g. a URN), no relative form exists and `to` is
|
|
110929
|
+
* returned unchanged.
|
|
110930
|
+
* @public
|
|
110931
|
+
*/
|
|
110932
|
+
const relative = (from, to) => {
|
|
110933
|
+
const fromURL = new URL(from, 'resolve://');
|
|
110934
|
+
const toURL = new URL(to, 'resolve://');
|
|
110935
|
+
|
|
110936
|
+
// the authority is host plus userinfo; a relative reference keeps both from `from`
|
|
110937
|
+
if (fromURL.protocol !== toURL.protocol || fromURL.host !== toURL.host || fromURL.username !== toURL.username || fromURL.password !== toURL.password || !fromURL.pathname.startsWith('/') || !toURL.pathname.startsWith('/')) {
|
|
110938
|
+
return to;
|
|
110939
|
+
}
|
|
110940
|
+
const fromSegments = fromURL.pathname.split('/').slice(0, -1);
|
|
110941
|
+
const toSegments = toURL.pathname.split('/');
|
|
110942
|
+
let common = 0;
|
|
110943
|
+
while (common < fromSegments.length && common < toSegments.length - 1 && fromSegments[common] === toSegments[common]) {
|
|
110944
|
+
common += 1;
|
|
110945
|
+
}
|
|
110946
|
+
const segments = [...fromSegments.slice(common).map(() => '..'), ...toSegments.slice(common)];
|
|
110947
|
+
// a leading segment with a colon would be parsed as a scheme, and an empty
|
|
110948
|
+
// reference (`to` is the directory of `from`) would resolve back to `from`
|
|
110949
|
+
if (segments[0].includes(':') || segments.join('/') === '') {
|
|
110950
|
+
segments.unshift('.');
|
|
110951
|
+
}
|
|
110952
|
+
return segments.join('/') + toURL.search + toURL.hash;
|
|
110953
|
+
};
|
|
110954
|
+
|
|
110354
110955
|
/**
|
|
110355
110956
|
* Sanitizes/Encodes URI to it's url encoded form.
|
|
110356
110957
|
*
|
|
@@ -110396,6 +110997,7 @@ const unsanitize = uri => {
|
|
|
110396
110997
|
/* harmony export */ "isFileSystemPath", 0, /* binding */ isFileSystemPath,
|
|
110397
110998
|
/* harmony export */ "isHttpUrl", 0, /* binding */ isHttpUrl,
|
|
110398
110999
|
/* harmony export */ "isURI", 0, /* binding */ isURI,
|
|
111000
|
+
/* harmony export */ "relative", 0, /* binding */ relative,
|
|
110399
111001
|
/* harmony export */ "resolve", 0, /* binding */ resolve,
|
|
110400
111002
|
/* harmony export */ "sanitize", 0, /* binding */ sanitize,
|
|
110401
111003
|
/* harmony export */ "stripHash", 0, /* binding */ stripHash,
|