@speclynx/apidom-reference 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -596,11 +596,11 @@ class OpenAPI2BundleVisitor {
596
596
  }
597
597
 
598
598
  /**
599
- * Normalizes a self-file reference (e.g. `./root.json#/definitions/Pet`)
599
+ * Normalizes a self-reference (e.g. `./root.json#/definitions/Pet`)
600
600
  * to a bare fragment (`#/definitions/Pet`) so the bundled document stays
601
601
  * transferable. Bare fragments are returned unchanged.
602
602
  */
603
- normalizeSelfFileRef(ref) {
603
+ normalizeSelfReference(ref) {
604
604
  return ref.startsWith('#') ? ref : _util_url_ts__WEBPACK_IMPORTED_MODULE_22__.getHash(ref);
605
605
  }
606
606
 
@@ -681,16 +681,8 @@ class OpenAPI2BundleVisitor {
681
681
  */
682
682
  basenameOf(jsonPointer, baseURI) {
683
683
  const tokens = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.parse)(jsonPointer).tree;
684
- let candidate = tokens.length > 0 ? tokens[tokens.length - 1] : '';
685
- if (candidate === '') {
686
- const lastSlash = baseURI.lastIndexOf('/');
687
- const lastDot = baseURI.lastIndexOf('.');
688
- const fileName = baseURI.slice(lastSlash + 1);
689
- // strip the extension only when the last dot belongs to the file name
690
- candidate = lastDot > lastSlash ? baseURI.slice(lastSlash + 1, lastDot) : fileName;
691
- }
692
- if (candidate === '') candidate = 'Schema';
693
- return candidate;
684
+ const lastToken = tokens.length > 0 ? tokens[tokens.length - 1] : '';
685
+ return lastToken || _util_url_ts__WEBPACK_IMPORTED_MODULE_22__.getBasename(baseURI) || 'Schema';
694
686
  }
695
687
 
696
688
  /**
@@ -745,9 +737,9 @@ class OpenAPI2BundleVisitor {
745
737
  const isInternalReference = this.entryURI === retrievalURI;
746
738
  const isExternalReference = !isInternalReference;
747
739
  if (isInternalReference) {
748
- // normalize self-file references to a bare fragment so the bundled
740
+ // normalize self-references to a bare fragment so the bundled
749
741
  // document stays transferable; bare fragments are left untouched
750
- referencingElement.set('$ref', this.normalizeSelfFileRef($ref));
742
+ referencingElement.set('$ref', this.normalizeSelfReference($ref));
751
743
  path.skip();
752
744
  return;
753
745
  }
@@ -904,9 +896,9 @@ class OpenAPI2BundleVisitor {
904
896
  const isInternalReference = this.entryURI === retrievalURI;
905
897
  const isExternalReference = !isInternalReference;
906
898
  if (isInternalReference) {
907
- // normalize self-file references to a bare fragment so the bundled
899
+ // normalize self-references to a bare fragment so the bundled
908
900
  // document stays transferable; bare fragments are left untouched
909
- pathItemElement.set('$ref', this.normalizeSelfFileRef($ref));
901
+ pathItemElement.set('$ref', this.normalizeSelfReference($ref));
910
902
  return;
911
903
  }
912
904
 
@@ -1313,11 +1305,11 @@ class OpenAPI3_0BundleVisitor {
1313
1305
  }
1314
1306
 
1315
1307
  /**
1316
- * Normalizes a self-file reference (e.g. `./root.json#/components/schemas/Pet`)
1308
+ * Normalizes a self-reference (e.g. `./root.json#/components/schemas/Pet`)
1317
1309
  * to a bare fragment (`#/components/schemas/Pet`) so the bundled document stays
1318
1310
  * transferable. Bare fragments are returned unchanged.
1319
1311
  */
1320
- normalizeSelfFileRef(ref) {
1312
+ normalizeSelfReference(ref) {
1321
1313
  return ref.startsWith('#') ? ref : _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.getHash(ref);
1322
1314
  }
1323
1315
 
@@ -1403,16 +1395,8 @@ class OpenAPI3_0BundleVisitor {
1403
1395
  */
1404
1396
  basenameOf(jsonPointer, baseURI) {
1405
1397
  const tokens = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.parse)(jsonPointer).tree;
1406
- let candidate = tokens.length > 0 ? tokens[tokens.length - 1] : '';
1407
- if (candidate === '') {
1408
- const lastSlash = baseURI.lastIndexOf('/');
1409
- const lastDot = baseURI.lastIndexOf('.');
1410
- const fileName = baseURI.slice(lastSlash + 1);
1411
- // strip the extension only when the last dot belongs to the file name
1412
- candidate = lastDot > lastSlash ? baseURI.slice(lastSlash + 1, lastDot) : fileName;
1413
- }
1414
- if (candidate === '') candidate = 'Schema';
1415
- return candidate;
1398
+ const lastToken = tokens.length > 0 ? tokens[tokens.length - 1] : '';
1399
+ return lastToken || _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.getBasename(baseURI) || 'Schema';
1416
1400
  }
1417
1401
 
1418
1402
  /**
@@ -1462,9 +1446,9 @@ class OpenAPI3_0BundleVisitor {
1462
1446
  const isInternalReference = this.entryURI === retrievalURI;
1463
1447
  const isExternalReference = !isInternalReference;
1464
1448
  if (isInternalReference) {
1465
- // normalize self-file references to a bare fragment so the bundled
1449
+ // normalize self-references to a bare fragment so the bundled
1466
1450
  // document stays transferable; bare fragments are left untouched
1467
- referencingElement.set('$ref', this.normalizeSelfFileRef($ref));
1451
+ referencingElement.set('$ref', this.normalizeSelfReference($ref));
1468
1452
  path.skip();
1469
1453
  return;
1470
1454
  }
@@ -1503,7 +1487,814 @@ class OpenAPI3_0BundleVisitor {
1503
1487
  try {
1504
1488
  // detect maximum depth of bundling
1505
1489
  if (this.reference.depth >= this.options.bundle.maxDepth) {
1506
- throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
1490
+ throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
1491
+ maxDepth: this.options.bundle.maxDepth,
1492
+ uri: this.reference.uri
1493
+ });
1494
+ }
1495
+ const reference = await this.toReference($ref);
1496
+
1497
+ // possibly non-semantic fragment
1498
+ let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
1499
+
1500
+ // apply semantics to the fragment so nested references become Reference Objects
1501
+ if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_14__.isReferenceElement)(referencedElement)) {
1502
+ const cached = this.getRefracted(referencedElement, referencedElementType);
1503
+ if (cached !== undefined) {
1504
+ referencedElement = cached;
1505
+ } else if ((0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_15__.isReferenceLikeElement)(referencedElement)) {
1506
+ const sourceElement = referencedElement;
1507
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.refractReference)(referencedElement);
1508
+ referencedElement.meta.set('referenced-element', referencedElementType);
1509
+ this.setRefracted(sourceElement, referencedElementType, referencedElement);
1510
+ } else {
1511
+ const sourceElement = referencedElement;
1512
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__["default"])(referencedElement, {
1513
+ element: referencedElementType
1514
+ });
1515
+ this.setRefracted(sourceElement, referencedElementType, referencedElement);
1516
+ }
1517
+ }
1518
+ const preferredName = this.baseName(referencedElement, field, jsonPointer, retrievalURI);
1519
+ const componentName = this.uniqueName(preferredName, field);
1520
+ const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.escape)(componentName)}`;
1521
+
1522
+ // a rename means two distinct targets resolved to the same name; each
1523
+ // keeps its own component (and origin), so report the rename per severity.
1524
+ // strategy specific options take precedence over the top-level bundle options
1525
+ const onComponentNameCollision = this.options.bundle.strategyOpts['openapi-3-0']?.onComponentNameCollision ?? this.options.bundle.onComponentNameCollision;
1526
+ if (componentName !== preferredName && onComponentNameCollision !== 'off') {
1527
+ const message = `Component "${preferredName}" in components/${field} is referenced with the same name but different content. Renamed to "${componentName}".`;
1528
+ if (onComponentNameCollision === 'error') {
1529
+ throw new _errors_BundleError_ts__WEBPACK_IMPORTED_MODULE_25__["default"](message);
1530
+ }
1531
+ const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](message);
1532
+ annotation.classes.push('warning');
1533
+ annotation.code = 'bundle-component-name-collision';
1534
+ // append (never prepend) so the result element stays ahead of annotations
1535
+ this.entryParseResult.content.push(annotation);
1536
+ }
1537
+
1538
+ // reserve the assignment and component name before recursing so cyclic
1539
+ // references terminate
1540
+ this.assignments.set(canonicalKey, internalPointer);
1541
+ if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
1542
+ this.reservedNames.get(field).add(componentName);
1543
+
1544
+ // own a copy of the fragment and bundle its own external references
1545
+ const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
1546
+ const visitor = new OpenAPI3_0BundleVisitor({
1547
+ reference,
1548
+ options: this.options,
1549
+ assignments: this.assignments,
1550
+ reservedNames: this.reservedNames,
1551
+ refractCache: this.refractCache,
1552
+ inlineStack: this.inlineStack
1553
+ });
1554
+ const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(hoistedElement, visitor, {
1555
+ mutable: true
1556
+ });
1557
+
1558
+ // annotate the hoisted fragment with info about its origin
1559
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(bundledElement)) {
1560
+ bundledElement.meta.set('ref-origin', reference.uri);
1561
+ }
1562
+
1563
+ // place the bundled fragment into the entry document's components
1564
+ this.ensureComponentsField(field).set(componentName, bundledElement);
1565
+
1566
+ // rewrite the referencing element to point at the hoisted fragment
1567
+ referencingElement.set('$ref', internalPointer);
1568
+ path.skip();
1569
+ } catch (error) {
1570
+ this.handleError(`Error while bundling Reference Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
1571
+ path.skip();
1572
+ }
1573
+ }
1574
+
1575
+ /**
1576
+ * Path Item Object is not a Components Object field in OpenAPI 3.0
1577
+ * (unlike 3.1 which has `components.pathItems`). An external Path Item
1578
+ * reference therefore cannot be hoisted; it is inlined in place instead,
1579
+ * after bundling its own external references.
1580
+ */
1581
+ async PathItemElement(path) {
1582
+ const pathItemElement = path.node;
1583
+
1584
+ // ignore Path Item Objects without a $ref field
1585
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(pathItemElement.$ref)) {
1586
+ return;
1587
+ }
1588
+ const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(pathItemElement.$ref);
1589
+ const retrievalURI = this.toBaseURI($ref);
1590
+ const isInternalReference = this.entryURI === retrievalURI;
1591
+ const isExternalReference = !isInternalReference;
1592
+ if (isInternalReference) {
1593
+ // normalize self-references to a bare fragment so the bundled
1594
+ // document stays transferable; bare fragments are left untouched
1595
+ pathItemElement.set('$ref', this.normalizeSelfReference($ref));
1596
+ return;
1597
+ }
1598
+
1599
+ // honor the resolve.external switch
1600
+ if (!this.options.resolve.external && isExternalReference) {
1601
+ return;
1602
+ }
1603
+ const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.resolve(retrievalURI, $ref);
1604
+ const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
1605
+ const canonicalKey = `${retrievalURI}#${jsonPointer}`;
1606
+
1607
+ // a circular external Path Item reference cannot be inlined without
1608
+ // recursing forever; leave the $ref in place to break the cycle
1609
+ if (this.inlineStack.has(canonicalKey)) {
1610
+ return;
1611
+ }
1612
+ try {
1613
+ // detect maximum depth of bundling
1614
+ if (this.reference.depth >= this.options.bundle.maxDepth) {
1615
+ throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
1616
+ maxDepth: this.options.bundle.maxDepth,
1617
+ uri: this.reference.uri
1618
+ });
1619
+ }
1620
+ const reference = await this.toReference($ref);
1621
+ let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
1622
+
1623
+ // apply Path Item semantics to the referenced fragment
1624
+ if (!(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_14__.isPathItemElement)(referencedElement)) {
1625
+ const cached = this.getRefracted(referencedElement, 'pathItem');
1626
+ if (cached !== undefined) {
1627
+ referencedElement = cached;
1628
+ } else {
1629
+ const sourceElement = referencedElement;
1630
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.refractPathItem)(referencedElement);
1631
+ this.setRefracted(sourceElement, 'pathItem', referencedElement);
1632
+ }
1633
+ }
1634
+
1635
+ // own a copy and bundle the external references it contains
1636
+ const inlinedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
1637
+ this.inlineStack.add(canonicalKey);
1638
+ const visitor = new OpenAPI3_0BundleVisitor({
1639
+ reference,
1640
+ options: this.options,
1641
+ assignments: this.assignments,
1642
+ reservedNames: this.reservedNames,
1643
+ refractCache: this.refractCache,
1644
+ inlineStack: this.inlineStack
1645
+ });
1646
+ let bundledElement;
1647
+ try {
1648
+ bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(inlinedElement, visitor, {
1649
+ mutable: true
1650
+ });
1651
+ } finally {
1652
+ this.inlineStack.delete(canonicalKey);
1653
+ }
1654
+
1655
+ // merge sibling fields from the referencing Path Item over the referenced
1656
+ // one. The referencing `$ref` is being resolved away and is skipped; the
1657
+ // referenced element keeps its own `$ref` if one survived (i.e. it was
1658
+ // left in place to break a circular external Path Item chain).
1659
+ pathItemElement.forEach((_value, keyElement, item) => {
1660
+ const key = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement);
1661
+ if (key === '$ref') return;
1662
+ bundledElement.remove(key);
1663
+ bundledElement.content.push(item);
1664
+ });
1665
+ bundledElement.meta.set('ref-origin', reference.uri);
1666
+ path.replaceWith(bundledElement);
1667
+ } catch (error) {
1668
+ this.handleError(`Error while bundling Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, pathItemElement, '$ref', $ref, path);
1669
+ }
1670
+ }
1671
+
1672
+ /**
1673
+ * Example Object `externalValue` points at arbitrary external content that
1674
+ * has no place in the Components Object. The referenced value is inlined into
1675
+ * the Example's `value` field.
1676
+ */
1677
+ async ExampleElement(path) {
1678
+ const exampleElement = path.node;
1679
+
1680
+ // ignore Example Objects without an externalValue field
1681
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(exampleElement.externalValue)) {
1682
+ return;
1683
+ }
1684
+
1685
+ // value and externalValue fields are mutually exclusive
1686
+ if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(exampleElement.externalValue)) {
1687
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
1688
+ value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.value),
1689
+ externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.externalValue)
1690
+ });
1691
+ }
1692
+ const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.externalValue);
1693
+ const retrievalURI = this.toBaseURI(externalValue);
1694
+ const isInternalReference = this.entryURI === retrievalURI;
1695
+ const isExternalReference = !isInternalReference;
1696
+
1697
+ // honor the resolve.external switch
1698
+ if (!this.options.resolve.external && isExternalReference) {
1699
+ return;
1700
+ }
1701
+ try {
1702
+ const reference = await this.toReference(externalValue);
1703
+ const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(reference.value.result);
1704
+ valueElement.meta.set('ref-origin', reference.uri);
1705
+ const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(exampleElement);
1706
+ exampleElementCopy.value = valueElement;
1707
+ exampleElementCopy.remove('externalValue');
1708
+ path.replaceWith(exampleElementCopy);
1709
+ } catch (error) {
1710
+ this.handleError(`Error while bundling Example Object. Cannot resolve externalValue "${externalValue}": ${error.message}`, error, exampleElement, 'externalValue', externalValue, path);
1711
+ }
1712
+ }
1713
+
1714
+ /**
1715
+ * Link Object `operationRef` points at an Operation Object, which has no
1716
+ * Components Object field in OpenAPI 3.0 and therefore cannot be hoisted or
1717
+ * inlined. To keep the link resolvable from the bundled document, an external
1718
+ * `operationRef` is rewritten to its absolute URI. Internal `operationRef`
1719
+ * values and `operationId` links are left untouched.
1720
+ */
1721
+ async LinkElement(path) {
1722
+ const linkElement = path.node;
1723
+
1724
+ // operationRef and operationId fields are mutually exclusive
1725
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationRef) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationId)) {
1726
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
1727
+ operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationRef),
1728
+ operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationId)
1729
+ });
1730
+ }
1731
+
1732
+ // only external operationRef links need adjusting
1733
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationRef)) {
1734
+ return;
1735
+ }
1736
+ const operationRef = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationRef);
1737
+ const retrievalURI = this.toBaseURI(operationRef);
1738
+ const isInternalReference = this.entryURI === retrievalURI;
1739
+ if (isInternalReference) {
1740
+ // normalize a self-reference operationRef to a bare fragment so the bundled
1741
+ // document stays transferable; bare fragments are left untouched
1742
+ linkElement.set('operationRef', this.normalizeSelfReference(operationRef));
1743
+ return;
1744
+ }
1745
+
1746
+ // honor the resolve.external switch
1747
+ if (!this.options.resolve.external) {
1748
+ return;
1749
+ }
1750
+
1751
+ // rewrite to an absolute URI so the link keeps resolving once the document
1752
+ // is treated as self-contained
1753
+ const absoluteURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.resolve(this.reference.uri, operationRef);
1754
+ if (absoluteURI !== operationRef) {
1755
+ linkElement.set('operationRef', absoluteURI);
1756
+ }
1757
+ }
1758
+ }
1759
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenAPI3_0BundleVisitor);
1760
+
1761
+ /***/ },
1762
+
1763
+ /***/ 16432
1764
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1765
+
1766
+ "use strict";
1767
+ __webpack_require__.r(__webpack_exports__);
1768
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1769
+ /* harmony export */ OpenAPI3_1BundleVisitor: () => (/* reexport safe */ _visitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"]),
1770
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1771
+ /* harmony export */ });
1772
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12111);
1773
+ /* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80796);
1774
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7822);
1775
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(76332);
1776
+ /* harmony import */ var _Reference_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98979);
1777
+ /* harmony import */ var _ReferenceSet_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24131);
1778
+ /* harmony import */ var _BundleStrategy_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75508);
1779
+ /* harmony import */ var _visitor_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31066);
1780
+
1781
+
1782
+
1783
+
1784
+
1785
+
1786
+
1787
+
1788
+ /**
1789
+ * @public
1790
+ */
1791
+
1792
+ /**
1793
+ * @public
1794
+ */
1795
+ class OpenAPI3_1BundleStrategy extends _BundleStrategy_ts__WEBPACK_IMPORTED_MODULE_6__["default"] {
1796
+ constructor(options) {
1797
+ super({
1798
+ ...(options ?? {}),
1799
+ name: 'openapi-3-1'
1800
+ });
1801
+ }
1802
+ canBundle(file) {
1803
+ // assert by media type
1804
+ if (file.mediaType !== 'text/plain') {
1805
+ return _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_2__["default"].includes(file.mediaType);
1806
+ }
1807
+
1808
+ // assert by inspecting ApiDOM
1809
+ return (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_3__.isOpenApi3_1Element)(file.parseResult?.result);
1810
+ }
1811
+ async bundle(file, options) {
1812
+ const immutableRefSet = options.bundle.refSet ?? new _ReferenceSet_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
1813
+ const mutableRefSet = new _ReferenceSet_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
1814
+ let refSet = immutableRefSet;
1815
+ let reference;
1816
+
1817
+ // determine the initial reference
1818
+ if (!immutableRefSet.has(file.uri)) {
1819
+ reference = new _Reference_ts__WEBPACK_IMPORTED_MODULE_4__["default"]({
1820
+ uri: file.uri,
1821
+ value: file.parseResult
1822
+ });
1823
+ immutableRefSet.add(reference);
1824
+ } else {
1825
+ // pre-computed refSet was provided as configuration option
1826
+ reference = immutableRefSet.find(ref => ref.uri === file.uri);
1827
+ }
1828
+
1829
+ /**
1830
+ * Clone refSet due the bundling process being mutable.
1831
+ * We don't want to mutate the original refSet and the references.
1832
+ */
1833
+ if (options.bundle.immutable) {
1834
+ immutableRefSet.refs.map(ref => new _Reference_ts__WEBPACK_IMPORTED_MODULE_4__["default"]({
1835
+ ...ref,
1836
+ value: (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(ref.value)
1837
+ })).forEach(ref => mutableRefSet.add(ref));
1838
+ reference = mutableRefSet.find(ref => ref.uri === file.uri);
1839
+ refSet = mutableRefSet;
1840
+ }
1841
+ const visitor = new _visitor_ts__WEBPACK_IMPORTED_MODULE_7__["default"]({
1842
+ reference: reference,
1843
+ options
1844
+ });
1845
+ await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_1__.traverseAsync)(refSet.rootRef.value, visitor, {
1846
+ mutable: true
1847
+ });
1848
+ const parseResult = reference.value;
1849
+
1850
+ /**
1851
+ * Release all memory if this refSet was not provided as a configuration option.
1852
+ * If provided as configuration option, then provider is responsible for cleanup.
1853
+ */
1854
+ if (options.bundle.refSet === null) {
1855
+ immutableRefSet.clean();
1856
+ }
1857
+ mutableRefSet.clean();
1858
+ return parseResult;
1859
+ }
1860
+ }
1861
+
1862
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenAPI3_1BundleStrategy);
1863
+
1864
+ /***/ },
1865
+
1866
+ /***/ 31066
1867
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1868
+
1869
+ "use strict";
1870
+ __webpack_require__.r(__webpack_exports__);
1871
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1872
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1873
+ /* harmony export */ });
1874
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87009);
1875
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6352);
1876
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25162);
1877
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12111);
1878
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97071);
1879
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84660);
1880
+ /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(37205);
1881
+ /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(44673);
1882
+ /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(16280);
1883
+ /* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(44641);
1884
+ /* harmony import */ var _speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(80796);
1885
+ /* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(12020);
1886
+ /* harmony import */ var _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(61198);
1887
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(21314);
1888
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(24329);
1889
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(29881);
1890
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(76332);
1891
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(23806);
1892
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(52645);
1893
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(23031);
1894
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(63842);
1895
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(87455);
1896
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(16363);
1897
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(55122);
1898
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(71117);
1899
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(72257);
1900
+ /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(69511);
1901
+ /* harmony import */ var _errors_BundleError_ts__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(81002);
1902
+ /* harmony import */ var _errors_UnresolvableReferenceError_ts__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(8853);
1903
+ /* harmony import */ var _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(16843);
1904
+ /* harmony import */ var _errors_MaximumResolveDepthError_ts__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(51325);
1905
+ /* harmony import */ var _errors_EvaluationJsonSchemaUriError_ts__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(44477);
1906
+ /* harmony import */ var _util_url_ts__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(30658);
1907
+ /* harmony import */ var _parse_index_ts__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(35014);
1908
+ /* harmony import */ var _Reference_ts__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(98979);
1909
+ /* harmony import */ var _File_ts__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(10682);
1910
+ /* harmony import */ var _dereference_strategies_openapi_3_1_selectors_$anchor_ts__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(32054);
1911
+ /* harmony import */ var _dereference_strategies_openapi_3_1_selectors_uri_ts__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(56481);
1912
+ /* harmony import */ var _dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(60888);
1913
+ /* harmony import */ var _util_ts__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(25939);
1914
+
1915
+
1916
+
1917
+
1918
+
1919
+
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+
1932
+
1933
+
1934
+ /**
1935
+ * Maps the `referenced-element` meta value (set during refraction) to the
1936
+ * Components Object field where the referenced element should be hoisted.
1937
+ * Field names are sourced from the Components Object fixed fields so they
1938
+ * cannot drift from the namespace definition.
1939
+ */
1940
+ const cf = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__.fixedFields)(_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.ComponentsElement, {
1941
+ indexed: true
1942
+ });
1943
+ const componentFieldByReferencedElement = {
1944
+ schema: cf.schemas.name,
1945
+ response: cf.responses.name,
1946
+ parameter: cf.parameters.name,
1947
+ example: cf.examples.name,
1948
+ requestBody: cf.requestBodies.name,
1949
+ header: cf.headers.name,
1950
+ securityScheme: cf.securitySchemes.name,
1951
+ link: cf.links.name,
1952
+ callback: cf.callbacks.name,
1953
+ pathItem: cf.pathItems.name
1954
+ };
1955
+
1956
+ /**
1957
+ * Maps a Components Object field to the named-content element the namespace
1958
+ * uses for it, so a bundle-created field matches a parsed/refracted one
1959
+ * (e.g. carries the `components-schemas` class) rather than being a generic
1960
+ * object.
1961
+ */
1962
+ const componentFieldElementByField = {
1963
+ [cf.schemas.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_25__["default"],
1964
+ [cf.responses.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_24__["default"],
1965
+ [cf.parameters.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_21__["default"],
1966
+ [cf.examples.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_17__["default"],
1967
+ [cf.requestBodies.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_23__["default"],
1968
+ [cf.headers.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_19__["default"],
1969
+ [cf.securitySchemes.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_26__["default"],
1970
+ [cf.links.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_20__["default"],
1971
+ [cf.callbacks.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_15__["default"],
1972
+ [cf.pathItems.name]: _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_22__["default"]
1973
+ };
1974
+
1975
+ /**
1976
+ * @public
1977
+ */
1978
+
1979
+ /**
1980
+ * @public
1981
+ */
1982
+ class OpenAPI3_1BundleVisitor {
1983
+ reference;
1984
+ options;
1985
+
1986
+ /**
1987
+ * The base URI (without hash) of the entry document. A reference is
1988
+ * considered internal when it resolves to this URI and external otherwise.
1989
+ * Derived from the shared refSet's root reference.
1990
+ */
1991
+ get entryURI() {
1992
+ return _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(this.reference.refSet?.rootRef?.uri ?? '');
1993
+ }
1994
+
1995
+ /**
1996
+ * The entry parse result. Derived from the shared refSet's root reference.
1997
+ */
1998
+ get entryParseResult() {
1999
+ return this.reference.refSet.rootRef.value;
2000
+ }
2001
+
2002
+ /**
2003
+ * The entry document element. Hoisted external fragments are placed into its
2004
+ * `components` object. The `canBundle` guard guarantees it is an
2005
+ * OpenApi3_1Element.
2006
+ */
2007
+ get entryResult() {
2008
+ return this.entryParseResult.result;
2009
+ }
2010
+
2011
+ /**
2012
+ * Shared across the entry document and every external document visitor.
2013
+ * Guarantees each external fragment is hoisted exactly once and gives us a
2014
+ * stable internal pointer to rewrite every referencing element to.
2015
+ */
2016
+ assignments;
2017
+
2018
+ /**
2019
+ * Component names already reserved per Components Object field. Reserved
2020
+ * before recursion so collision suffixing (`Pet`, `Pet-2`, ...) accounts for
2021
+ * components that are still being bundled.
2022
+ */
2023
+ reservedNames;
2024
+
2025
+ /**
2026
+ * Caches refracted fragments keyed by source element and target element type.
2027
+ * The type is part of the key because the same source can be refracted into
2028
+ * different semantic elements depending on the referencing context (e.g. a
2029
+ * generic object referenced once as a Parameter and once as a Response).
2030
+ */
2031
+ refractCache;
2032
+ constructor({
2033
+ reference,
2034
+ options,
2035
+ assignments = new Map(),
2036
+ reservedNames = new Map(),
2037
+ refractCache = new WeakMap()
2038
+ }) {
2039
+ this.reference = reference;
2040
+ this.options = options;
2041
+ this.assignments = assignments;
2042
+ this.reservedNames = reservedNames;
2043
+ this.refractCache = refractCache;
2044
+ }
2045
+ getRefracted(source, type) {
2046
+ return this.refractCache.get(source)?.get(type);
2047
+ }
2048
+ setRefracted(source, type, refracted) {
2049
+ let byType = this.refractCache.get(source);
2050
+ if (byType === undefined) {
2051
+ byType = new Map();
2052
+ this.refractCache.set(source, byType);
2053
+ }
2054
+ byType.set(type, refracted);
2055
+ }
2056
+ toBaseURI(uri) {
2057
+ return _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.resolve(this.reference.uri, _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.sanitize(_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(uri)));
2058
+ }
2059
+ async toReference(uri) {
2060
+ // detect maximum depth of resolution
2061
+ if (this.reference.depth >= this.options.resolve.maxDepth) {
2062
+ throw new _errors_MaximumResolveDepthError_ts__WEBPACK_IMPORTED_MODULE_30__["default"](`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`, {
2063
+ maxDepth: this.options.resolve.maxDepth,
2064
+ uri: this.reference.uri
2065
+ });
2066
+ }
2067
+ const baseURI = this.toBaseURI(uri);
2068
+ const {
2069
+ refSet
2070
+ } = this.reference;
2071
+
2072
+ // we've already processed this Reference in past
2073
+ if (refSet.has(baseURI)) {
2074
+ return refSet.find((0,ramda__WEBPACK_IMPORTED_MODULE_1__["default"])(baseURI, 'uri'));
2075
+ }
2076
+ const parseResult = await (0,_parse_index_ts__WEBPACK_IMPORTED_MODULE_33__["default"])(_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.unsanitize(baseURI), {
2077
+ ...this.options,
2078
+ parse: {
2079
+ ...this.options.parse,
2080
+ mediaType: 'text/plain'
2081
+ }
2082
+ });
2083
+ const reference = new _Reference_ts__WEBPACK_IMPORTED_MODULE_34__["default"]({
2084
+ uri: baseURI,
2085
+ value: parseResult,
2086
+ depth: this.reference.depth + 1
2087
+ });
2088
+ refSet.add(reference);
2089
+ return reference;
2090
+ }
2091
+
2092
+ /**
2093
+ * Normalizes a self-reference (e.g. `./root.json#/components/schemas/Pet`)
2094
+ * to a bare fragment (`#/components/schemas/Pet`) so the bundled document stays
2095
+ * transferable. Bare fragments are returned unchanged.
2096
+ */
2097
+ normalizeSelfReference(ref) {
2098
+ return ref.startsWith('#') ? ref : _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.getHash(ref);
2099
+ }
2100
+
2101
+ /**
2102
+ * Handles an error according to the `bundle.continueOnError` option.
2103
+ *
2104
+ * For new errors: wraps in UnresolvableReferenceError with structured
2105
+ * context. For errors already wrapped by a nested visitor: prepends the
2106
+ * current hop to the trace.
2107
+ *
2108
+ * Inner/intermediate visitors always throw to let the trace accumulate. Only
2109
+ * the entry document visitor respects continueOnError (callback/swallow/throw).
2110
+ */
2111
+ handleError(message, error, referencingElement, refFieldName, refFieldValue, visitorPath) {
2112
+ // a collision reported as `error` is a deliberate hard stop with no
2113
+ // resolution-failure analog, so pass it through unchanged. A maxDepth
2114
+ // breach (MaximumBundleDepthError, which also extends BundleError) is a
2115
+ // resolution failure and flows through below — wrapped and subject to
2116
+ // continueOnError, like dereferencing.
2117
+ if (error instanceof _errors_BundleError_ts__WEBPACK_IMPORTED_MODULE_27__["default"] && !(error instanceof _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_29__["default"])) {
2118
+ throw error;
2119
+ }
2120
+ const {
2121
+ continueOnError
2122
+ } = this.options.bundle;
2123
+ const isEntryDocument = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(this.reference.refSet?.rootRef?.uri ?? '') === this.reference.uri;
2124
+ const uri = this.reference.uri;
2125
+ const type = referencingElement.element;
2126
+ const codeFrame = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(referencingElement);
2127
+ const location = visitorPath.formatPath();
2128
+ const hop = {
2129
+ uri,
2130
+ type,
2131
+ refFieldName,
2132
+ refFieldValue,
2133
+ location,
2134
+ codeFrame
2135
+ };
2136
+ let unresolvedError;
2137
+ if (error instanceof _errors_UnresolvableReferenceError_ts__WEBPACK_IMPORTED_MODULE_28__["default"]) {
2138
+ // @ts-ignore
2139
+ error.trace = [hop, ...error.trace];
2140
+ unresolvedError = error;
2141
+ } else {
2142
+ unresolvedError = new _errors_UnresolvableReferenceError_ts__WEBPACK_IMPORTED_MODULE_28__["default"](message, {
2143
+ cause: error,
2144
+ type,
2145
+ uri,
2146
+ location,
2147
+ codeFrame,
2148
+ refFieldName,
2149
+ refFieldValue,
2150
+ trace: []
2151
+ });
2152
+ }
2153
+ if (!isEntryDocument || continueOnError === false) throw unresolvedError;
2154
+ if (typeof continueOnError === 'function') continueOnError(unresolvedError);
2155
+ }
2156
+
2157
+ /**
2158
+ * Lazily creates the Components Object (and the requested field within it)
2159
+ * on the entry document, returning the field where a fragment is hoisted.
2160
+ */
2161
+ ensureComponentsField(field) {
2162
+ const entryResult = this.entryResult;
2163
+ let components = entryResult.components;
2164
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(components)) {
2165
+ components = new _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_18__.ComponentsElement();
2166
+ entryResult.components = components;
2167
+ }
2168
+ let fieldElement = components.get(field);
2169
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(fieldElement)) {
2170
+ const FieldElement = componentFieldElementByField[field] ?? _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"];
2171
+ fieldElement = new FieldElement();
2172
+ components.set(field, fieldElement);
2173
+ }
2174
+ return fieldElement;
2175
+ }
2176
+
2177
+ /**
2178
+ * Derives a component name from the referenced JSON Pointer's last token,
2179
+ * falling back to the referenced file's basename.
2180
+ */
2181
+ basenameOf(jsonPointer, baseURI) {
2182
+ const tokens = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.parse)(jsonPointer).tree;
2183
+ const lastToken = tokens.length > 0 ? tokens[tokens.length - 1] : '';
2184
+ return lastToken || _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.getBasename(baseURI) || 'Schema';
2185
+ }
2186
+
2187
+ /**
2188
+ * Computes the base component name (before collision suffixing) according to
2189
+ * the configured naming strategy.
2190
+ */
2191
+ baseName(element, field, jsonPointer, baseURI) {
2192
+ // strategy specific options take precedence over the top-level bundle options
2193
+ const componentNamesStrategy = this.options.bundle.strategyOpts['openapi-3-1']?.componentNamesStrategy ?? this.options.bundle.componentNamesStrategy;
2194
+ if (typeof componentNamesStrategy === 'function') {
2195
+ const resolved = componentNamesStrategy({
2196
+ element,
2197
+ field,
2198
+ jsonPointer,
2199
+ baseURI
2200
+ });
2201
+ if (typeof resolved === 'string' && resolved !== '') {
2202
+ return resolved;
2203
+ }
2204
+ return this.basenameOf(jsonPointer, baseURI);
2205
+ }
2206
+ if (componentNamesStrategy === 'title') {
2207
+ const title = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(element) ? (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(element.get('title')) : undefined;
2208
+ if (typeof title === 'string' && title.trim() !== '') {
2209
+ const name = (0,_util_ts__WEBPACK_IMPORTED_MODULE_39__.sanitizeComponentName)((0,_util_ts__WEBPACK_IMPORTED_MODULE_39__.toPascalCase)(title));
2210
+ if (name !== '') return name;
2211
+ }
2212
+ // fall back to basename when no usable title is present
2213
+ }
2214
+ return this.basenameOf(jsonPointer, baseURI);
2215
+ }
2216
+
2217
+ /**
2218
+ * Computes a collision-free component name within the target field. A name is
2219
+ * taken if it's already placed in components or reserved by a component that
2220
+ * is still being bundled (reserved before recursion).
2221
+ */
2222
+ uniqueName(candidate, field) {
2223
+ const fieldElement = this.ensureComponentsField(field);
2224
+ const reserved = this.reservedNames.get(field) ?? new Set();
2225
+ return (0,_util_ts__WEBPACK_IMPORTED_MODULE_39__.uniqueName)(candidate, name => fieldElement.hasKey(name) || reserved.has(name));
2226
+ }
2227
+
2228
+ /**
2229
+ * Reports a collision-forced rename according to the configured severity.
2230
+ * A rename means two distinct targets resolved to the same name; each keeps
2231
+ * its own component (and origin), so report the rename per severity.
2232
+ */
2233
+ reportNameCollision(preferredName, componentName, field) {
2234
+ // strategy specific options take precedence over the top-level bundle options
2235
+ const onComponentNameCollision = this.options.bundle.strategyOpts['openapi-3-1']?.onComponentNameCollision ?? this.options.bundle.onComponentNameCollision;
2236
+ if (componentName === preferredName || onComponentNameCollision === 'off') {
2237
+ return;
2238
+ }
2239
+ const message = `Component "${preferredName}" in components/${field} is referenced with the same name but different content. Renamed to "${componentName}".`;
2240
+ if (onComponentNameCollision === 'error') {
2241
+ throw new _errors_BundleError_ts__WEBPACK_IMPORTED_MODULE_27__["default"](message);
2242
+ }
2243
+ const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"](message);
2244
+ annotation.classes.push('warning');
2245
+ annotation.code = 'bundle-component-name-collision';
2246
+ // append (never prepend) so the result element stays ahead of annotations
2247
+ this.entryParseResult.content.push(annotation);
2248
+ }
2249
+ async ReferenceElement(path) {
2250
+ const referencingElement = path.node;
2251
+ const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(referencingElement.$ref);
2252
+ const retrievalURI = this.toBaseURI($ref);
2253
+ const isInternalReference = this.entryURI === retrievalURI;
2254
+ const isExternalReference = !isInternalReference;
2255
+ if (isInternalReference) {
2256
+ // normalize self-references to a bare fragment so the bundled
2257
+ // document stays transferable; bare fragments are left untouched
2258
+ referencingElement.set('$ref', this.normalizeSelfReference($ref));
2259
+ path.skip();
2260
+ return;
2261
+ }
2262
+
2263
+ // honor the resolve.external switch
2264
+ if (!this.options.resolve.external && isExternalReference) {
2265
+ path.skip();
2266
+ return;
2267
+ }
2268
+ const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.resolve(retrievalURI, $ref);
2269
+ const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.URIFragmentIdentifier.fromURIReference($refBaseURI);
2270
+
2271
+ // the target bucket depends on the referencing context, so it's part of the
2272
+ // identity: the same external target referenced as e.g. both a parameter and
2273
+ // a response must be hoisted into both components fields. The refractor sets
2274
+ // `referenced-element` for every Reference Object position; the `schemas`
2275
+ // fallback is a defensive default for the (unexpected) untagged case.
2276
+ const referencedElementType = referencingElement.meta.get('referenced-element');
2277
+ const field = componentFieldByReferencedElement[referencedElementType] ?? componentFieldByReferencedElement.schema;
2278
+ const canonicalKey = `${field}\t${retrievalURI}#${jsonPointer}`;
2279
+
2280
+ // already hoisted (or being hoisted) — just rewrite the pointer.
2281
+ //
2282
+ // this is also how circular references terminate: the assignment is
2283
+ // reserved BEFORE recursing into the fragment (see below), so a reference
2284
+ // that cycles back (directly or indirectly) finds its pointer already
2285
+ // reserved here and is rewritten without recursing. Cycles are deliberately
2286
+ // preserved as internal `$ref`s pointing at each other — that is valid,
2287
+ // serializable output; resolving the cycle (if desired) is dereferencing's
2288
+ // job, not bundling's.
2289
+ if (this.assignments.has(canonicalKey)) {
2290
+ referencingElement.set('$ref', this.assignments.get(canonicalKey));
2291
+ path.skip();
2292
+ return;
2293
+ }
2294
+ try {
2295
+ // detect maximum depth of bundling
2296
+ if (this.reference.depth >= this.options.bundle.maxDepth) {
2297
+ throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_29__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
1507
2298
  maxDepth: this.options.bundle.maxDepth,
1508
2299
  uri: this.reference.uri
1509
2300
  });
@@ -1511,21 +2302,21 @@ class OpenAPI3_0BundleVisitor {
1511
2302
  const reference = await this.toReference($ref);
1512
2303
 
1513
2304
  // possibly non-semantic fragment
1514
- let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
2305
+ let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.evaluate)(reference.value.result, jsonPointer);
1515
2306
 
1516
2307
  // apply semantics to the fragment so nested references become Reference Objects
1517
- if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_14__.isReferenceElement)(referencedElement)) {
2308
+ if (referencedElement.element !== referencedElementType && !(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.isReferenceElement)(referencedElement)) {
1518
2309
  const cached = this.getRefracted(referencedElement, referencedElementType);
1519
2310
  if (cached !== undefined) {
1520
2311
  referencedElement = cached;
1521
- } else if ((0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_15__.isReferenceLikeElement)(referencedElement)) {
2312
+ } else if ((0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_13__.isReferenceLikeElement)(referencedElement)) {
1522
2313
  const sourceElement = referencedElement;
1523
- referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.refractReference)(referencedElement);
2314
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.refractReference)(referencedElement);
1524
2315
  referencedElement.meta.set('referenced-element', referencedElementType);
1525
2316
  this.setRefracted(sourceElement, referencedElementType, referencedElement);
1526
2317
  } else {
1527
2318
  const sourceElement = referencedElement;
1528
- referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__["default"])(referencedElement, {
2319
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__["default"])(referencedElement, {
1529
2320
  element: referencedElementType
1530
2321
  });
1531
2322
  this.setRefracted(sourceElement, referencedElementType, referencedElement);
@@ -1533,23 +2324,8 @@ class OpenAPI3_0BundleVisitor {
1533
2324
  }
1534
2325
  const preferredName = this.baseName(referencedElement, field, jsonPointer, retrievalURI);
1535
2326
  const componentName = this.uniqueName(preferredName, field);
1536
- const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.escape)(componentName)}`;
1537
-
1538
- // a rename means two distinct targets resolved to the same name; each
1539
- // keeps its own component (and origin), so report the rename per severity.
1540
- // strategy specific options take precedence over the top-level bundle options
1541
- const onComponentNameCollision = this.options.bundle.strategyOpts['openapi-3-0']?.onComponentNameCollision ?? this.options.bundle.onComponentNameCollision;
1542
- if (componentName !== preferredName && onComponentNameCollision !== 'off') {
1543
- const message = `Component "${preferredName}" in components/${field} is referenced with the same name but different content. Renamed to "${componentName}".`;
1544
- if (onComponentNameCollision === 'error') {
1545
- throw new _errors_BundleError_ts__WEBPACK_IMPORTED_MODULE_25__["default"](message);
1546
- }
1547
- const annotation = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](message);
1548
- annotation.classes.push('warning');
1549
- annotation.code = 'bundle-component-name-collision';
1550
- // append (never prepend) so the result element stays ahead of annotations
1551
- this.entryParseResult.content.push(annotation);
1552
- }
2327
+ const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.escape)(componentName)}`;
2328
+ this.reportNameCollision(preferredName, componentName, field);
1553
2329
 
1554
2330
  // reserve the assignment and component name before recursing so cyclic
1555
2331
  // references terminate
@@ -1558,21 +2334,20 @@ class OpenAPI3_0BundleVisitor {
1558
2334
  this.reservedNames.get(field).add(componentName);
1559
2335
 
1560
2336
  // own a copy of the fragment and bundle its own external references
1561
- const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
1562
- const visitor = new OpenAPI3_0BundleVisitor({
2337
+ const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(referencedElement);
2338
+ const visitor = new OpenAPI3_1BundleVisitor({
1563
2339
  reference,
1564
2340
  options: this.options,
1565
2341
  assignments: this.assignments,
1566
2342
  reservedNames: this.reservedNames,
1567
- refractCache: this.refractCache,
1568
- inlineStack: this.inlineStack
2343
+ refractCache: this.refractCache
1569
2344
  });
1570
- const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(hoistedElement, visitor, {
2345
+ const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__.traverseAsync)(hoistedElement, visitor, {
1571
2346
  mutable: true
1572
2347
  });
1573
2348
 
1574
2349
  // annotate the hoisted fragment with info about its origin
1575
- if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(bundledElement)) {
2350
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isElement)(bundledElement)) {
1576
2351
  bundledElement.meta.set('ref-origin', reference.uri);
1577
2352
  }
1578
2353
 
@@ -1589,99 +2364,265 @@ class OpenAPI3_0BundleVisitor {
1589
2364
  }
1590
2365
 
1591
2366
  /**
1592
- * Path Item Object is not a Components Object field in OpenAPI 3.0
1593
- * (unlike 3.1 which has `components.pathItems`). An external Path Item
1594
- * reference therefore cannot be hoisted; it is inlined in place instead,
1595
- * after bundling its own external references.
2367
+ * Unlike OpenAPI 3.0 (which has no `components.pathItems` field and therefore
2368
+ * inlines external Path Items in place), OpenAPI 3.1 hoists an external Path
2369
+ * Item Object into `components.pathItems` and rewrites the referencing `$ref`
2370
+ * to an internal pointer — mirroring how Reference Objects are bundled.
2371
+ * Sibling fields next to the `$ref` (e.g. `summary`, `description`) are kept
2372
+ * on the referencing element.
1596
2373
  */
1597
2374
  async PathItemElement(path) {
1598
2375
  const pathItemElement = path.node;
1599
2376
 
1600
2377
  // ignore Path Item Objects without a $ref field
1601
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(pathItemElement.$ref)) {
2378
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(pathItemElement.$ref)) {
1602
2379
  return;
1603
2380
  }
1604
- const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(pathItemElement.$ref);
2381
+ const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(pathItemElement.$ref);
1605
2382
  const retrievalURI = this.toBaseURI($ref);
1606
2383
  const isInternalReference = this.entryURI === retrievalURI;
1607
2384
  const isExternalReference = !isInternalReference;
1608
2385
  if (isInternalReference) {
1609
- // normalize self-file references to a bare fragment so the bundled
2386
+ // normalize self-references to a bare fragment so the bundled
1610
2387
  // document stays transferable; bare fragments are left untouched
1611
- pathItemElement.set('$ref', this.normalizeSelfFileRef($ref));
2388
+ pathItemElement.set('$ref', this.normalizeSelfReference($ref));
2389
+ path.skip();
1612
2390
  return;
1613
2391
  }
1614
2392
 
1615
2393
  // honor the resolve.external switch
1616
2394
  if (!this.options.resolve.external && isExternalReference) {
2395
+ path.skip();
1617
2396
  return;
1618
2397
  }
1619
- const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.resolve(retrievalURI, $ref);
1620
- const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.URIFragmentIdentifier.fromURIReference($refBaseURI);
1621
- const canonicalKey = `${retrievalURI}#${jsonPointer}`;
2398
+ const $refBaseURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.resolve(retrievalURI, $ref);
2399
+ const jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.URIFragmentIdentifier.fromURIReference($refBaseURI);
2400
+ const field = cf.pathItems.name;
2401
+ const canonicalKey = `${field}\t${retrievalURI}#${jsonPointer}`;
1622
2402
 
1623
- // a circular external Path Item reference cannot be inlined without
1624
- // recursing forever; leave the $ref in place to break the cycle
1625
- if (this.inlineStack.has(canonicalKey)) {
2403
+ // already hoisted (or being hoisted) — just rewrite the pointer. The
2404
+ // assignment is reserved BEFORE recursing, so a circular Path Item chain
2405
+ // terminates here with an internal pointer instead of recursing forever.
2406
+ if (this.assignments.has(canonicalKey)) {
2407
+ pathItemElement.set('$ref', this.assignments.get(canonicalKey));
2408
+ path.skip();
1626
2409
  return;
1627
2410
  }
1628
2411
  try {
1629
2412
  // detect maximum depth of bundling
1630
2413
  if (this.reference.depth >= this.options.bundle.maxDepth) {
1631
- throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_27__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
2414
+ throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_29__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
1632
2415
  maxDepth: this.options.bundle.maxDepth,
1633
2416
  uri: this.reference.uri
1634
2417
  });
1635
2418
  }
1636
2419
  const reference = await this.toReference($ref);
1637
- let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.evaluate)(reference.value.result, jsonPointer);
2420
+ let referencedElement = (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.evaluate)(reference.value.result, jsonPointer);
1638
2421
 
1639
2422
  // apply Path Item semantics to the referenced fragment
1640
- if (!(0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_14__.isPathItemElement)(referencedElement)) {
2423
+ if (!(0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_16__.isPathItemElement)(referencedElement)) {
1641
2424
  const cached = this.getRefracted(referencedElement, 'pathItem');
1642
2425
  if (cached !== undefined) {
1643
2426
  referencedElement = cached;
1644
2427
  } else {
1645
2428
  const sourceElement = referencedElement;
1646
- referencedElement = (0,_speclynx_apidom_ns_openapi_3_0__WEBPACK_IMPORTED_MODULE_13__.refractPathItem)(referencedElement);
2429
+ referencedElement = (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_14__.refractPathItem)(referencedElement);
1647
2430
  this.setRefracted(sourceElement, 'pathItem', referencedElement);
1648
2431
  }
1649
2432
  }
2433
+ const preferredName = this.baseName(referencedElement, field, jsonPointer, retrievalURI);
2434
+ const componentName = this.uniqueName(preferredName, field);
2435
+ const internalPointer = `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.escape)(componentName)}`;
2436
+ this.reportNameCollision(preferredName, componentName, field);
1650
2437
 
1651
- // own a copy and bundle the external references it contains
1652
- const inlinedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(referencedElement);
1653
- this.inlineStack.add(canonicalKey);
1654
- const visitor = new OpenAPI3_0BundleVisitor({
2438
+ // reserve the assignment and component name before recursing so cyclic
2439
+ // references terminate
2440
+ this.assignments.set(canonicalKey, internalPointer);
2441
+ if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
2442
+ this.reservedNames.get(field).add(componentName);
2443
+
2444
+ // own a copy of the fragment and bundle its own external references
2445
+ const hoistedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(referencedElement);
2446
+ const visitor = new OpenAPI3_1BundleVisitor({
1655
2447
  reference,
1656
2448
  options: this.options,
1657
2449
  assignments: this.assignments,
1658
2450
  reservedNames: this.reservedNames,
1659
- refractCache: this.refractCache,
1660
- inlineStack: this.inlineStack
2451
+ refractCache: this.refractCache
1661
2452
  });
1662
- let bundledElement;
1663
- try {
1664
- bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_9__.traverseAsync)(inlinedElement, visitor, {
1665
- mutable: true
2453
+ const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__.traverseAsync)(hoistedElement, visitor, {
2454
+ mutable: true
2455
+ });
2456
+
2457
+ // a `$ref` surviving on the hoisted Path Item means it pointed at another
2458
+ // Path Item (a chain or cycle); it has already been rewritten to an
2459
+ // internal `#/components/pathItems/...` pointer by the child traversal
2460
+ bundledElement.meta.set('ref-origin', reference.uri);
2461
+
2462
+ // place the bundled Path Item into the entry document's components
2463
+ this.ensureComponentsField(field).set(componentName, bundledElement);
2464
+
2465
+ // rewrite the referencing Path Item to point at the hoisted one, keeping
2466
+ // any sibling fields (e.g. summary, description) next to the $ref
2467
+ pathItemElement.set('$ref', internalPointer);
2468
+ path.skip();
2469
+ } catch (error) {
2470
+ this.handleError(`Error while bundling Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, pathItemElement, '$ref', $ref, path);
2471
+ path.skip();
2472
+ }
2473
+ }
2474
+
2475
+ /**
2476
+ * Schema Objects in OpenAPI 3.1 are a JSON Schema 2020-12 dialect, so they are
2477
+ * bundled per the JSON Schema Compound Document rules: the external schema
2478
+ * RESOURCE is embedded verbatim into `components.schemas` (carrying its `$id`),
2479
+ * and the referencing `$ref` is left UNCHANGED — it keeps resolving against the
2480
+ * embedded resource's `$id`. This mirrors the canonical hyperjump
2481
+ * `json-schema-bundle` behavior (the whole resource is embedded once, keyed by
2482
+ * its `$id`; references are not rewritten).
2483
+ */
2484
+ async SchemaElement(path) {
2485
+ const referencingElement = path.node;
2486
+
2487
+ // skip current referencing schema as $ref keyword was not defined
2488
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(referencingElement.$ref)) {
2489
+ return;
2490
+ }
2491
+ const $ref = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(referencingElement.$ref);
2492
+ try {
2493
+ // compute baseURI using rules around $id and $ref keywords. The current
2494
+ // document's URI is the retrieval URI — derive it directly (not via
2495
+ // toReference) so an internal $ref needs no resolution and never trips the
2496
+ // resolve.maxDepth guard, matching how ReferenceElement returns early.
2497
+ const retrievalURI = this.reference.uri;
2498
+ const $refBaseURI = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.resolveSchema$refField)(retrievalURI, referencingElement);
2499
+ const $refBaseURIStrippedHash = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash($refBaseURI);
2500
+ const file = new _File_ts__WEBPACK_IMPORTED_MODULE_35__["default"]({
2501
+ uri: $refBaseURIStrippedHash
2502
+ });
2503
+ const isUnknownURI = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(r => r.canRead(file), this.options.resolve.resolvers);
2504
+ const isURL = !isUnknownURI;
2505
+ const isInternalReference = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(this.reference.uri) === $refBaseURIStrippedHash;
2506
+ const isExternalReference = !isInternalReference;
2507
+
2508
+ // internal Schema Object $refs resolve against the in-document $id graph;
2509
+ // leaving them untouched keeps that resolution valid. Unlike Reference
2510
+ // Objects, a JSON Schema $ref is NOT normalized to a bare fragment.
2511
+ if (isInternalReference) {
2512
+ return;
2513
+ }
2514
+
2515
+ // honor the resolve.external switch
2516
+ if (!this.options.resolve.external && isExternalReference) {
2517
+ return;
2518
+ }
2519
+
2520
+ // detect maximum depth of bundling before fetching the external resource,
2521
+ // matching ReferenceElement/PathItemElement (which check before toReference)
2522
+ if (this.reference.depth >= this.options.bundle.maxDepth) {
2523
+ throw new _errors_MaximumBundleDepthError_ts__WEBPACK_IMPORTED_MODULE_29__["default"](`Maximum bundle depth of "${this.options.bundle.maxDepth}" has been exceeded in file "${this.reference.uri}"`, {
2524
+ maxDepth: this.options.bundle.maxDepth,
2525
+ uri: this.reference.uri
1666
2526
  });
1667
- } finally {
1668
- this.inlineStack.delete(canonicalKey);
1669
2527
  }
1670
2528
 
1671
- // merge sibling fields from the referencing Path Item over the referenced
1672
- // one. The referencing `$ref` is being resolved away and is skipped; the
1673
- // referenced element keeps its own `$ref` if one survived (i.e. it was
1674
- // left in place to break a circular external Path Item chain).
1675
- pathItemElement.forEach((_value, keyElement, item) => {
1676
- const key = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(keyElement);
1677
- if (key === '$ref') return;
1678
- bundledElement.remove(key);
1679
- bundledElement.content.push(item);
2529
+ // locate the external schema resource the $ref targets, reusing the
2530
+ // dereference strategy's classification. First try to resolve the target
2531
+ // as a canonical URI / URL against the current document's $id graph; if
2532
+ // that fails, fall back to fetching the external document and resolving
2533
+ // the fragment there as a $anchor or JSON Pointer.
2534
+ let schemaReference = this.reference;
2535
+ try {
2536
+ const referenceAsSchema = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
2537
+ (0,_dereference_strategies_openapi_3_1_selectors_uri_ts__WEBPACK_IMPORTED_MODULE_37__.evaluate)($refBaseURI, referenceAsSchema);
2538
+ } catch (error) {
2539
+ if (isURL && error instanceof _errors_EvaluationJsonSchemaUriError_ts__WEBPACK_IMPORTED_MODULE_31__["default"]) {
2540
+ if ((0,_dereference_strategies_openapi_3_1_selectors_$anchor_ts__WEBPACK_IMPORTED_MODULE_36__.isAnchor)((0,_dereference_strategies_openapi_3_1_selectors_$anchor_ts__WEBPACK_IMPORTED_MODULE_36__.uriToAnchor)($refBaseURI))) {
2541
+ schemaReference = await this.toReference(_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.unsanitize($refBaseURI));
2542
+ const selector = (0,_dereference_strategies_openapi_3_1_selectors_$anchor_ts__WEBPACK_IMPORTED_MODULE_36__.uriToAnchor)($refBaseURI);
2543
+ const referenceAsSchema = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
2544
+ (0,_dereference_strategies_openapi_3_1_selectors_$anchor_ts__WEBPACK_IMPORTED_MODULE_36__.evaluate)(selector, referenceAsSchema);
2545
+ } else {
2546
+ schemaReference = await this.toReference(_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.unsanitize($refBaseURI));
2547
+ const selector = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.URIFragmentIdentifier.fromURIReference($refBaseURI);
2548
+ const referenceAsSchema = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
2549
+ (0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_11__.evaluate)(referenceAsSchema, selector);
2550
+ }
2551
+ } else {
2552
+ throw error;
2553
+ }
2554
+ }
2555
+
2556
+ // a $ref that resolves (by $id/$anchor/pointer) within the current document
2557
+ // is internal even when its URI form (e.g. a URN or absolute $id) is not a
2558
+ // bare fragment. Leave it untouched — it resolves against the in-document
2559
+ // $id graph, and embedding the current document into itself would be wrong.
2560
+ if (_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri) === _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(this.reference.uri)) {
2561
+ return;
2562
+ }
2563
+
2564
+ // the resource to embed is the WHOLE external document (its root schema),
2565
+ // identified by its $id. A $ref into a fragment of the document embeds the
2566
+ // entire document resource once; the fragment keeps resolving against the
2567
+ // embedded $id.
2568
+ const resourceRoot = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.maybeRefractToSchemaElement)(schemaReference.value.result);
2569
+ const resourceBaseURI = (0,_dereference_strategies_openapi_3_1_util_ts__WEBPACK_IMPORTED_MODULE_38__.resolveSchema$idField)(_util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri), resourceRoot) ?? _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.stripHash(schemaReference.uri);
2570
+ const field = cf.schemas.name;
2571
+ const canonicalKey = `${field}\t${resourceBaseURI}`;
2572
+
2573
+ // resource already embedded (or being embedded) — leave the referencing
2574
+ // $ref untouched and stop. This also terminates circular external schema
2575
+ // references, since the assignment is reserved BEFORE recursion.
2576
+ if (this.assignments.has(canonicalKey)) {
2577
+ path.skip();
2578
+ return;
2579
+ }
2580
+
2581
+ // own a copy of the resource and ensure it carries a $id so the unchanged
2582
+ // $ref still resolves against it once embedded
2583
+ const embeddedElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(resourceRoot);
2584
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(embeddedElement.$id)) {
2585
+ embeddedElement.set('$id', resourceBaseURI);
2586
+ }
2587
+
2588
+ // the embedded thing is the WHOLE resource (keyed by its $id), so its name
2589
+ // is derived from the resource URI, not the $ref fragment — passing a root
2590
+ // pointer makes baseName fall back to the resource basename
2591
+ const preferredName = this.baseName(embeddedElement, field, '', resourceBaseURI);
2592
+ const componentName = this.uniqueName(preferredName, field);
2593
+ this.reportNameCollision(preferredName, componentName, field);
2594
+
2595
+ // reserve the assignment and component name before recursing so circular
2596
+ // external schema references terminate
2597
+ this.assignments.set(canonicalKey, `#/components/${field}/${(0,_speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_12__.escape)(componentName)}`);
2598
+ if (!this.reservedNames.has(field)) this.reservedNames.set(field, new Set());
2599
+ this.reservedNames.get(field).add(componentName);
2600
+
2601
+ // bundle external references contained within the embedded resource;
2602
+ // nested external resources land flat in the same components.schemas
2603
+ const visitor = new OpenAPI3_1BundleVisitor({
2604
+ reference: schemaReference,
2605
+ options: this.options,
2606
+ assignments: this.assignments,
2607
+ reservedNames: this.reservedNames,
2608
+ refractCache: this.refractCache
1680
2609
  });
1681
- bundledElement.meta.set('ref-origin', reference.uri);
1682
- path.replaceWith(bundledElement);
2610
+ const bundledElement = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_10__.traverseAsync)(embeddedElement, visitor, {
2611
+ mutable: true
2612
+ });
2613
+
2614
+ // annotate the embedded resource with info about its origin
2615
+ bundledElement.meta.set('ref-origin', schemaReference.uri);
2616
+
2617
+ // place the embedded resource into the entry document's components
2618
+ this.ensureComponentsField(field).set(componentName, bundledElement);
2619
+
2620
+ // the referencing $ref is left UNCHANGED — it resolves against the
2621
+ // embedded resource's $id
2622
+ path.skip();
1683
2623
  } catch (error) {
1684
- this.handleError(`Error while bundling Path Item Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, pathItemElement, '$ref', $ref, path);
2624
+ this.handleError(`Error while bundling Schema Object. Cannot resolve $ref "${$ref}": ${error.message}`, error, referencingElement, '$ref', $ref, path);
2625
+ path.skip();
1685
2626
  }
1686
2627
  }
1687
2628
 
@@ -1694,18 +2635,18 @@ class OpenAPI3_0BundleVisitor {
1694
2635
  const exampleElement = path.node;
1695
2636
 
1696
2637
  // ignore Example Objects without an externalValue field
1697
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(exampleElement.externalValue)) {
2638
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(exampleElement.externalValue)) {
1698
2639
  return;
1699
2640
  }
1700
2641
 
1701
2642
  // value and externalValue fields are mutually exclusive
1702
- if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(exampleElement.externalValue)) {
1703
- throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
1704
- value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.value),
1705
- externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.externalValue)
2643
+ if (exampleElement.hasKey('value') && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(exampleElement.externalValue)) {
2644
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_9__["default"]('ExampleElement value and externalValue fields are mutually exclusive', {
2645
+ value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(exampleElement.value),
2646
+ externalValue: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(exampleElement.externalValue)
1706
2647
  });
1707
2648
  }
1708
- const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(exampleElement.externalValue);
2649
+ const externalValue = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(exampleElement.externalValue);
1709
2650
  const retrievalURI = this.toBaseURI(externalValue);
1710
2651
  const isInternalReference = this.entryURI === retrievalURI;
1711
2652
  const isExternalReference = !isInternalReference;
@@ -1716,9 +2657,9 @@ class OpenAPI3_0BundleVisitor {
1716
2657
  }
1717
2658
  try {
1718
2659
  const reference = await this.toReference(externalValue);
1719
- const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(reference.value.result);
2660
+ const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneShallow)(reference.value.result);
1720
2661
  valueElement.meta.set('ref-origin', reference.uri);
1721
- const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(exampleElement);
2662
+ const exampleElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.cloneShallow)(exampleElement);
1722
2663
  exampleElementCopy.value = valueElement;
1723
2664
  exampleElementCopy.remove('externalValue');
1724
2665
  path.replaceWith(exampleElementCopy);
@@ -1729,7 +2670,7 @@ class OpenAPI3_0BundleVisitor {
1729
2670
 
1730
2671
  /**
1731
2672
  * Link Object `operationRef` points at an Operation Object, which has no
1732
- * Components Object field in OpenAPI 3.0 and therefore cannot be hoisted or
2673
+ * Components Object field in OpenAPI 3.1 and therefore cannot be hoisted or
1733
2674
  * inlined. To keep the link resolvable from the bundled document, an external
1734
2675
  * `operationRef` is rewritten to its absolute URI. Internal `operationRef`
1735
2676
  * values and `operationId` links are left untouched.
@@ -1738,24 +2679,24 @@ class OpenAPI3_0BundleVisitor {
1738
2679
  const linkElement = path.node;
1739
2680
 
1740
2681
  // operationRef and operationId fields are mutually exclusive
1741
- if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationRef) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationId)) {
1742
- throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
1743
- operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationRef),
1744
- operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationId)
2682
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationRef) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationId)) {
2683
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_9__["default"]('LinkElement operationRef and operationId fields are mutually exclusive', {
2684
+ operationRef: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(linkElement.operationRef),
2685
+ operationId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(linkElement.operationId)
1745
2686
  });
1746
2687
  }
1747
2688
 
1748
2689
  // only external operationRef links need adjusting
1749
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(linkElement.operationRef)) {
2690
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(linkElement.operationRef)) {
1750
2691
  return;
1751
2692
  }
1752
- const operationRef = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(linkElement.operationRef);
2693
+ const operationRef = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_7__["default"])(linkElement.operationRef);
1753
2694
  const retrievalURI = this.toBaseURI(operationRef);
1754
2695
  const isInternalReference = this.entryURI === retrievalURI;
1755
2696
  if (isInternalReference) {
1756
- // normalize self-file operationRef to a bare fragment so the bundled
2697
+ // normalize a self-reference operationRef to a bare fragment so the bundled
1757
2698
  // document stays transferable; bare fragments are left untouched
1758
- linkElement.set('operationRef', this.normalizeSelfFileRef(operationRef));
2699
+ linkElement.set('operationRef', this.normalizeSelfReference(operationRef));
1759
2700
  return;
1760
2701
  }
1761
2702
 
@@ -1766,58 +2707,13 @@ class OpenAPI3_0BundleVisitor {
1766
2707
 
1767
2708
  // rewrite to an absolute URI so the link keeps resolving once the document
1768
2709
  // is treated as self-contained
1769
- const absoluteURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_29__.resolve(this.reference.uri, operationRef);
2710
+ const absoluteURI = _util_url_ts__WEBPACK_IMPORTED_MODULE_32__.resolve(this.reference.uri, operationRef);
1770
2711
  if (absoluteURI !== operationRef) {
1771
2712
  linkElement.set('operationRef', absoluteURI);
1772
2713
  }
1773
2714
  }
1774
2715
  }
1775
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenAPI3_0BundleVisitor);
1776
-
1777
- /***/ },
1778
-
1779
- /***/ 16432
1780
- (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1781
-
1782
- "use strict";
1783
- __webpack_require__.r(__webpack_exports__);
1784
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1785
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1786
- /* harmony export */ });
1787
- /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7822);
1788
- /* harmony import */ var _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76332);
1789
- /* harmony import */ var _BundleStrategy_ts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(75508);
1790
-
1791
-
1792
-
1793
- /**
1794
- * @public
1795
- */
1796
-
1797
- /**
1798
- * @public
1799
- */
1800
- class OpenAPI3_1BundleStrategy extends _BundleStrategy_ts__WEBPACK_IMPORTED_MODULE_2__["default"] {
1801
- constructor(options) {
1802
- super({
1803
- ...(options ?? {}),
1804
- name: 'openapi-3-1'
1805
- });
1806
- }
1807
- canBundle(file) {
1808
- // assert by media type
1809
- if (file.mediaType !== 'text/plain') {
1810
- return _speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_0__["default"].includes(file.mediaType);
1811
- }
1812
-
1813
- // assert by inspecting ApiDOM
1814
- return (0,_speclynx_apidom_ns_openapi_3_1__WEBPACK_IMPORTED_MODULE_1__.isOpenApi3_1Element)(file.parseResult?.result);
1815
- }
1816
- async bundle(file) {
1817
- return file.parseResult;
1818
- }
1819
- }
1820
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenAPI3_1BundleStrategy);
2716
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OpenAPI3_1BundleVisitor);
1821
2717
 
1822
2718
  /***/ },
1823
2719
 
@@ -10705,6 +11601,7 @@ __webpack_require__.r(__webpack_exports__);
10705
11601
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10706
11602
  /* harmony export */ cwd: () => (/* binding */ cwd),
10707
11603
  /* harmony export */ fromFileSystemPath: () => (/* binding */ fromFileSystemPath),
11604
+ /* harmony export */ getBasename: () => (/* binding */ getBasename),
10708
11605
  /* harmony export */ getExtension: () => (/* binding */ getExtension),
10709
11606
  /* harmony export */ getHash: () => (/* binding */ getHash),
10710
11607
  /* harmony export */ getProtocol: () => (/* binding */ getProtocol),
@@ -10764,19 +11661,40 @@ const getProtocol = url => {
10764
11661
  */
10765
11662
  const hasProtocol = (0,ramda__WEBPACK_IMPORTED_MODULE_3__["default"])(getProtocol, ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"]);
10766
11663
 
11664
+ /**
11665
+ * Returns the final path segment of the given URI (the part after the last
11666
+ * `/`). Inputs are URIs, whose path separator is `/` — filesystem paths are
11667
+ * forward-slashed by `sanitize` before reaching here.
11668
+ */
11669
+ const getFilename = uri => uri.slice(uri.lastIndexOf('/') + 1);
11670
+
10767
11671
  /**
10768
11672
  * Returns the lower-cased file extension of the given URL,
10769
11673
  * or an empty string if it has no extension.
10770
11674
  * @public
10771
11675
  */
10772
11676
  const getExtension = url => {
10773
- const lastDotPosition = url.lastIndexOf('.');
11677
+ const fileName = getFilename(url);
11678
+ const lastDotPosition = fileName.lastIndexOf('.');
10774
11679
  if (lastDotPosition >= 0) {
10775
- return url.substring(lastDotPosition).toLowerCase();
11680
+ return fileName.substring(lastDotPosition).toLowerCase();
10776
11681
  }
10777
11682
  return '';
10778
11683
  };
10779
11684
 
11685
+ /**
11686
+ * Returns the final path segment of the given URI with its file extension
11687
+ * removed (e.g. `./schemas/Pet.json` -> `Pet`). Returns the whole segment when
11688
+ * there is no extension, and the whole URI when there is no path segment
11689
+ * (e.g. a URN).
11690
+ * @public
11691
+ */
11692
+ const getBasename = uri => {
11693
+ const fileName = getFilename(uri);
11694
+ const extension = getExtension(uri);
11695
+ return extension === '' ? fileName : fileName.slice(0, -extension.length);
11696
+ };
11697
+
10780
11698
  /**
10781
11699
  * Determines whether the given path is a filesystem path.
10782
11700
  * This includes "file://" URLs.
@@ -87543,6 +88461,254 @@ const refractJsonSchemaDialect = (value, options = {}) => refract(value, {
87543
88461
  });
87544
88462
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (refract);
87545
88463
 
88464
+ /***/ },
88465
+
88466
+ /***/ 52645
88467
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
88468
+
88469
+ "use strict";
88470
+ __webpack_require__.r(__webpack_exports__);
88471
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
88472
+ /* harmony export */ CallbackElement: () => (/* reexport safe */ _elements_Callback_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
88473
+ /* harmony export */ ComponentsElement: () => (/* reexport safe */ _elements_Components_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
88474
+ /* harmony export */ ContactElement: () => (/* reexport safe */ _elements_Contact_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
88475
+ /* harmony export */ DiscriminatorElement: () => (/* reexport safe */ _elements_Discriminator_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]),
88476
+ /* harmony export */ EncodingElement: () => (/* reexport safe */ _elements_Encoding_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
88477
+ /* harmony export */ ExampleElement: () => (/* reexport safe */ _elements_Example_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
88478
+ /* harmony export */ ExternalDocumentationElement: () => (/* reexport safe */ _elements_ExternalDocumentation_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
88479
+ /* harmony export */ HeaderElement: () => (/* reexport safe */ _elements_Header_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
88480
+ /* harmony export */ InfoElement: () => (/* reexport safe */ _elements_Info_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]),
88481
+ /* harmony export */ JsonSchemaDialectElement: () => (/* reexport safe */ _elements_JsonSchemaDialect_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]),
88482
+ /* harmony export */ LicenseElement: () => (/* reexport safe */ _elements_License_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]),
88483
+ /* harmony export */ LinkElement: () => (/* reexport safe */ _elements_Link_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]),
88484
+ /* harmony export */ MediaTypeElement: () => (/* reexport safe */ _elements_MediaType_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]),
88485
+ /* harmony export */ OAuthFlowElement: () => (/* reexport safe */ _elements_OAuthFlow_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
88486
+ /* harmony export */ OAuthFlowsElement: () => (/* reexport safe */ _elements_OAuthFlows_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
88487
+ /* harmony export */ OpenApi3_1Element: () => (/* reexport safe */ _elements_OpenApi3_1_mjs__WEBPACK_IMPORTED_MODULE_18__["default"]),
88488
+ /* harmony export */ OpenapiElement: () => (/* reexport safe */ _elements_Openapi_mjs__WEBPACK_IMPORTED_MODULE_17__["default"]),
88489
+ /* harmony export */ OperationElement: () => (/* reexport safe */ _elements_Operation_mjs__WEBPACK_IMPORTED_MODULE_19__["default"]),
88490
+ /* harmony export */ ParameterElement: () => (/* reexport safe */ _elements_Parameter_mjs__WEBPACK_IMPORTED_MODULE_20__["default"]),
88491
+ /* harmony export */ PathItemElement: () => (/* reexport safe */ _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_21__["default"]),
88492
+ /* harmony export */ PathsElement: () => (/* reexport safe */ _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_22__["default"]),
88493
+ /* harmony export */ ReferenceElement: () => (/* reexport safe */ _elements_Reference_mjs__WEBPACK_IMPORTED_MODULE_23__["default"]),
88494
+ /* harmony export */ RequestBodyElement: () => (/* reexport safe */ _elements_RequestBody_mjs__WEBPACK_IMPORTED_MODULE_24__["default"]),
88495
+ /* harmony export */ ResponseElement: () => (/* reexport safe */ _elements_Response_mjs__WEBPACK_IMPORTED_MODULE_25__["default"]),
88496
+ /* harmony export */ ResponsesElement: () => (/* reexport safe */ _elements_Responses_mjs__WEBPACK_IMPORTED_MODULE_26__["default"]),
88497
+ /* harmony export */ SchemaElement: () => (/* reexport safe */ _elements_Schema_mjs__WEBPACK_IMPORTED_MODULE_27__["default"]),
88498
+ /* harmony export */ SecurityRequirementElement: () => (/* reexport safe */ _elements_SecurityRequirement_mjs__WEBPACK_IMPORTED_MODULE_28__["default"]),
88499
+ /* harmony export */ SecuritySchemeElement: () => (/* reexport safe */ _elements_SecurityScheme_mjs__WEBPACK_IMPORTED_MODULE_29__["default"]),
88500
+ /* harmony export */ ServerElement: () => (/* reexport safe */ _elements_Server_mjs__WEBPACK_IMPORTED_MODULE_30__["default"]),
88501
+ /* harmony export */ ServerVariableElement: () => (/* reexport safe */ _elements_ServerVariable_mjs__WEBPACK_IMPORTED_MODULE_31__["default"]),
88502
+ /* harmony export */ TagElement: () => (/* reexport safe */ _elements_Tag_mjs__WEBPACK_IMPORTED_MODULE_32__["default"]),
88503
+ /* harmony export */ XmlElement: () => (/* reexport safe */ _elements_Xml_mjs__WEBPACK_IMPORTED_MODULE_33__["default"])
88504
+ /* harmony export */ });
88505
+ /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60572);
88506
+ /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34606);
88507
+ /* harmony import */ var _elements_Callback_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8041);
88508
+ /* harmony import */ var _elements_Components_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68772);
88509
+ /* harmony import */ var _elements_Contact_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16368);
88510
+ /* harmony import */ var _elements_Discriminator_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(13456);
88511
+ /* harmony import */ var _elements_Encoding_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(67071);
88512
+ /* harmony import */ var _elements_Example_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91210);
88513
+ /* harmony import */ var _elements_ExternalDocumentation_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(82753);
88514
+ /* harmony import */ var _elements_Header_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10391);
88515
+ /* harmony import */ var _elements_Info_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(80064);
88516
+ /* harmony import */ var _elements_JsonSchemaDialect_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(66035);
88517
+ /* harmony import */ var _elements_License_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(10673);
88518
+ /* harmony import */ var _elements_Link_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(64720);
88519
+ /* harmony import */ var _elements_MediaType_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(91784);
88520
+ /* harmony import */ var _elements_OAuthFlow_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(73645);
88521
+ /* harmony import */ var _elements_OAuthFlows_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(28308);
88522
+ /* harmony import */ var _elements_Openapi_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(14540);
88523
+ /* harmony import */ var _elements_OpenApi3_1_mjs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(81793);
88524
+ /* harmony import */ var _elements_Operation_mjs__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(54427);
88525
+ /* harmony import */ var _elements_Parameter_mjs__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(5849);
88526
+ /* harmony import */ var _elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(43360);
88527
+ /* harmony import */ var _elements_Paths_mjs__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(85652);
88528
+ /* harmony import */ var _elements_Reference_mjs__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(36539);
88529
+ /* harmony import */ var _elements_RequestBody_mjs__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(71387);
88530
+ /* harmony import */ var _elements_Response_mjs__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(51193);
88531
+ /* harmony import */ var _elements_Responses_mjs__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(77080);
88532
+ /* harmony import */ var _elements_Schema_mjs__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(26385);
88533
+ /* harmony import */ var _elements_SecurityRequirement_mjs__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(87051);
88534
+ /* harmony import */ var _elements_SecurityScheme_mjs__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(3719);
88535
+ /* harmony import */ var _elements_Server_mjs__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(93497);
88536
+ /* harmony import */ var _elements_ServerVariable_mjs__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(7929);
88537
+ /* harmony import */ var _elements_Tag_mjs__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(24224);
88538
+ /* harmony import */ var _elements_Xml_mjs__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(10931);
88539
+ /* harmony import */ var _specification_mjs__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(56110);
88540
+
88541
+
88542
+
88543
+ /**
88544
+ * OpenAPI 3.1 specification elements.
88545
+ */
88546
+
88547
+
88548
+
88549
+
88550
+
88551
+
88552
+
88553
+
88554
+
88555
+
88556
+
88557
+
88558
+
88559
+
88560
+
88561
+
88562
+
88563
+
88564
+
88565
+
88566
+
88567
+
88568
+
88569
+
88570
+
88571
+
88572
+
88573
+
88574
+
88575
+
88576
+
88577
+
88578
+
88579
+ /**
88580
+ * @public
88581
+ */
88582
+ // Resolve specification to dereference $ref pointers
88583
+ const resolvedSpec = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__.resolveSpecification)(_specification_mjs__WEBPACK_IMPORTED_MODULE_34__["default"]);
88584
+
88585
+ // Extract fixed fields as list of { name, alias?, $visitor }
88586
+ const getFixedFields = fixedFieldsSpec => {
88587
+ return Object.entries(fixedFieldsSpec).map(([name, fieldSpec]) => {
88588
+ if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(fieldSpec)) {
88589
+ return {
88590
+ name,
88591
+ ...fieldSpec
88592
+ };
88593
+ }
88594
+ return {
88595
+ name,
88596
+ $visitor: fieldSpec
88597
+ };
88598
+ });
88599
+ };
88600
+
88601
+ // OpenAPI 3.1 specification elements
88602
+ Object.defineProperty(_elements_OpenApi3_1_mjs__WEBPACK_IMPORTED_MODULE_18__["default"], 'fixedFields', {
88603
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.OpenApi.fixedFields),
88604
+ enumerable: true
88605
+ });
88606
+ Object.defineProperty(_elements_Info_mjs__WEBPACK_IMPORTED_MODULE_10__["default"], 'fixedFields', {
88607
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Info.fixedFields),
88608
+ enumerable: true
88609
+ });
88610
+ Object.defineProperty(_elements_Contact_mjs__WEBPACK_IMPORTED_MODULE_4__["default"], 'fixedFields', {
88611
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Contact.fixedFields),
88612
+ enumerable: true
88613
+ });
88614
+ Object.defineProperty(_elements_License_mjs__WEBPACK_IMPORTED_MODULE_12__["default"], 'fixedFields', {
88615
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.License.fixedFields),
88616
+ enumerable: true
88617
+ });
88618
+ Object.defineProperty(_elements_Server_mjs__WEBPACK_IMPORTED_MODULE_30__["default"], 'fixedFields', {
88619
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Server.fixedFields),
88620
+ enumerable: true
88621
+ });
88622
+ Object.defineProperty(_elements_ServerVariable_mjs__WEBPACK_IMPORTED_MODULE_31__["default"], 'fixedFields', {
88623
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.ServerVariable.fixedFields),
88624
+ enumerable: true
88625
+ });
88626
+ Object.defineProperty(_elements_Components_mjs__WEBPACK_IMPORTED_MODULE_3__["default"], 'fixedFields', {
88627
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Components.fixedFields),
88628
+ enumerable: true
88629
+ });
88630
+ Object.defineProperty(_elements_PathItem_mjs__WEBPACK_IMPORTED_MODULE_21__["default"], 'fixedFields', {
88631
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.PathItem.fixedFields),
88632
+ enumerable: true
88633
+ });
88634
+ Object.defineProperty(_elements_Operation_mjs__WEBPACK_IMPORTED_MODULE_19__["default"], 'fixedFields', {
88635
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Operation.fixedFields),
88636
+ enumerable: true
88637
+ });
88638
+ Object.defineProperty(_elements_ExternalDocumentation_mjs__WEBPACK_IMPORTED_MODULE_8__["default"], 'fixedFields', {
88639
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.ExternalDocumentation.fixedFields),
88640
+ enumerable: true
88641
+ });
88642
+ Object.defineProperty(_elements_Parameter_mjs__WEBPACK_IMPORTED_MODULE_20__["default"], 'fixedFields', {
88643
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Parameter.fixedFields),
88644
+ enumerable: true
88645
+ });
88646
+ Object.defineProperty(_elements_RequestBody_mjs__WEBPACK_IMPORTED_MODULE_24__["default"], 'fixedFields', {
88647
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.RequestBody.fixedFields),
88648
+ enumerable: true
88649
+ });
88650
+ Object.defineProperty(_elements_MediaType_mjs__WEBPACK_IMPORTED_MODULE_14__["default"], 'fixedFields', {
88651
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.MediaType.fixedFields),
88652
+ enumerable: true
88653
+ });
88654
+ Object.defineProperty(_elements_Encoding_mjs__WEBPACK_IMPORTED_MODULE_6__["default"], 'fixedFields', {
88655
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Encoding.fixedFields),
88656
+ enumerable: true
88657
+ });
88658
+ Object.defineProperty(_elements_Responses_mjs__WEBPACK_IMPORTED_MODULE_26__["default"], 'fixedFields', {
88659
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Responses.fixedFields),
88660
+ enumerable: true
88661
+ });
88662
+ Object.defineProperty(_elements_Response_mjs__WEBPACK_IMPORTED_MODULE_25__["default"], 'fixedFields', {
88663
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Response.fixedFields),
88664
+ enumerable: true
88665
+ });
88666
+ Object.defineProperty(_elements_Example_mjs__WEBPACK_IMPORTED_MODULE_7__["default"], 'fixedFields', {
88667
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Example.fixedFields),
88668
+ enumerable: true
88669
+ });
88670
+ Object.defineProperty(_elements_Link_mjs__WEBPACK_IMPORTED_MODULE_13__["default"], 'fixedFields', {
88671
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Link.fixedFields),
88672
+ enumerable: true
88673
+ });
88674
+ Object.defineProperty(_elements_Header_mjs__WEBPACK_IMPORTED_MODULE_9__["default"], 'fixedFields', {
88675
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Header.fixedFields),
88676
+ enumerable: true
88677
+ });
88678
+ Object.defineProperty(_elements_Tag_mjs__WEBPACK_IMPORTED_MODULE_32__["default"], 'fixedFields', {
88679
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Tag.fixedFields),
88680
+ enumerable: true
88681
+ });
88682
+ Object.defineProperty(_elements_Reference_mjs__WEBPACK_IMPORTED_MODULE_23__["default"], 'fixedFields', {
88683
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Reference.fixedFields),
88684
+ enumerable: true
88685
+ });
88686
+ Object.defineProperty(_elements_Schema_mjs__WEBPACK_IMPORTED_MODULE_27__["default"], 'fixedFields', {
88687
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Schema.fixedFields),
88688
+ enumerable: true
88689
+ });
88690
+ Object.defineProperty(_elements_Discriminator_mjs__WEBPACK_IMPORTED_MODULE_5__["default"], 'fixedFields', {
88691
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.Discriminator.fixedFields),
88692
+ enumerable: true
88693
+ });
88694
+ Object.defineProperty(_elements_Xml_mjs__WEBPACK_IMPORTED_MODULE_33__["default"], 'fixedFields', {
88695
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.XML.fixedFields),
88696
+ enumerable: true
88697
+ });
88698
+ Object.defineProperty(_elements_SecurityScheme_mjs__WEBPACK_IMPORTED_MODULE_29__["default"], 'fixedFields', {
88699
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.SecurityScheme.fixedFields),
88700
+ enumerable: true
88701
+ });
88702
+ Object.defineProperty(_elements_OAuthFlows_mjs__WEBPACK_IMPORTED_MODULE_16__["default"], 'fixedFields', {
88703
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.OAuthFlows.fixedFields),
88704
+ enumerable: true
88705
+ });
88706
+ Object.defineProperty(_elements_OAuthFlow_mjs__WEBPACK_IMPORTED_MODULE_15__["default"], 'fixedFields', {
88707
+ get: () => getFixedFields(resolvedSpec.visitors.document.objects.OAuthFlow.fixedFields),
88708
+ enumerable: true
88709
+ });
88710
+
88711
+
87546
88712
  /***/ },
87547
88713
 
87548
88714
  /***/ 68201