@hey-api/shared 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import colors from "ansi-colors";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
- import ts from "typescript";
4
+ import open from "open";
5
5
  import { sync } from "cross-spawn";
6
6
  import * as semver from "semver";
7
7
  import { getResolvedInput, sendRequest } from "@hey-api/json-schema-ref-parser";
@@ -54,12 +54,6 @@ function findTsConfigPath(baseDir, tsConfigPath) {
54
54
  }
55
55
  return null;
56
56
  }
57
- function loadTsConfig(configPath) {
58
- if (!configPath) return null;
59
- const raw = ts.readConfigFile(configPath, ts.sys.readFile);
60
- if (raw.error) throw new Error(`Couldn't read tsconfig from path: ${configPath}`);
61
- return ts.parseJsonConfigFileContent(raw.config, ts.sys, path.dirname(configPath));
62
- }
63
57
 
64
58
  //#endregion
65
59
  //#region src/cli.ts
@@ -112,8 +106,8 @@ function printCliIntro(initialDir, showLogo = false) {
112
106
 
113
107
  //#endregion
114
108
  //#region src/fs.ts
115
- function ensureDirSync(path$1) {
116
- if (!fs.existsSync(path$1)) fs.mkdirSync(path$1, { recursive: true });
109
+ function ensureDirSync(path) {
110
+ if (!fs.existsSync(path)) fs.mkdirSync(path, { recursive: true });
117
111
  }
118
112
 
119
113
  //#endregion
@@ -207,9 +201,7 @@ async function openGitHubIssueWithCrashReport(error, initialDir) {
207
201
  labels: "bug 🔥",
208
202
  title: "Crash Report"
209
203
  });
210
- const url = `${packageJson.bugs.url}new?${search.toString()}`;
211
- const open = (await import("open")).default;
212
- await open(url);
204
+ await open(`${packageJson.bugs.url}new?${search.toString()}`);
213
205
  }
214
206
  function printCrashReport({ error, logPath }) {
215
207
  if (error instanceof ConfigValidationError && error.errors.length) {
@@ -429,7 +421,7 @@ function inputToApiRegistry(input) {
429
421
  return;
430
422
  }
431
423
  if (input.path.startsWith(".")) return;
432
- if (input.path.startsWith(heyApiRegistryBaseUrl)) {
424
+ if (input.path.startsWith("https://get.heyapi.dev")) {
433
425
  input.path = input.path.slice(heyApiRegistryBaseUrl.length + 1);
434
426
  Object.assign(input, inputToHeyApiPath(input));
435
427
  return;
@@ -504,9 +496,9 @@ function compileInputPath(input) {
504
496
  }
505
497
  const [basePath, baseQuery] = input.path.split("?");
506
498
  const queryPath = (baseQuery || "").split("&").map((part) => part.split("="));
507
- let path$1 = basePath || "";
508
- if (path$1.endsWith("/")) path$1 = path$1.slice(0, path$1.length - 1);
509
- const [, pathUrl] = path$1.split("://");
499
+ let path = basePath || "";
500
+ if (path.endsWith("/")) path = path.slice(0, path.length - 1);
501
+ const [, pathUrl] = path.split("://");
510
502
  const [baseUrl, organization, project] = (pathUrl || "").split("/");
511
503
  result.organization = organization || input.organization;
512
504
  result.project = project || input.project;
@@ -629,36 +621,36 @@ const mergeResult = (result, mapped) => {
629
621
  for (const [key, value] of Object.entries(mapped)) if (value !== void 0 && value !== "") result[key] = value;
630
622
  return result;
631
623
  };
632
- const valueToObject = ({ defaultValue, mappers: mappers$1, value }) => {
624
+ const valueToObject = ({ defaultValue, mappers, value }) => {
633
625
  let result = { ...defaultValue };
634
626
  switch (typeof value) {
635
627
  case "boolean":
636
- if (mappers$1 && "boolean" in mappers$1) {
637
- const mapper = mappers$1.boolean;
628
+ if (mappers && "boolean" in mappers) {
629
+ const mapper = mappers.boolean;
638
630
  result = mergeResult(result, mapper(value));
639
631
  }
640
632
  break;
641
633
  case "function":
642
- if (mappers$1 && "function" in mappers$1) {
643
- const mapper = mappers$1.function;
634
+ if (mappers && "function" in mappers) {
635
+ const mapper = mappers.function;
644
636
  result = mergeResult(result, mapper(value));
645
637
  }
646
638
  break;
647
639
  case "number":
648
- if (mappers$1 && "number" in mappers$1) {
649
- const mapper = mappers$1.number;
640
+ if (mappers && "number" in mappers) {
641
+ const mapper = mappers.number;
650
642
  result = mergeResult(result, mapper(value));
651
643
  }
652
644
  break;
653
645
  case "string":
654
- if (mappers$1 && "string" in mappers$1) {
655
- const mapper = mappers$1.string;
646
+ if (mappers && "string" in mappers) {
647
+ const mapper = mappers.string;
656
648
  result = mergeResult(result, mapper(value));
657
649
  }
658
650
  break;
659
651
  case "object":
660
- if (isPlainObject(value)) if (mappers$1 && "object" in mappers$1 && typeof mappers$1.object === "function") {
661
- const mapper = mappers$1.object;
652
+ if (isPlainObject(value)) if (mappers && "object" in mappers && typeof mappers.object === "function") {
653
+ const mapper = mappers.object;
662
654
  result = mergeResult(result, mapper(value, defaultValue));
663
655
  } else result = mergeResult(result, value);
664
656
  break;
@@ -730,50 +722,50 @@ function getParser(userConfig) {
730
722
  }),
731
723
  transforms: valueToObject({
732
724
  defaultValue: { ...defaultValue.transforms },
733
- mappers: { object: (fields$1, defaultValue$1) => ({
734
- ...fields$1,
725
+ mappers: { object: (fields, defaultValue) => ({
726
+ ...fields,
735
727
  enums: valueToObject({
736
728
  defaultValue: {
737
- ...defaultValue$1.enums,
738
- enabled: fields$1.enums !== void 0 ? Boolean(fields$1.enums) : defaultValue$1.enums.enabled
729
+ ...defaultValue.enums,
730
+ enabled: fields.enums !== void 0 ? Boolean(fields.enums) : defaultValue.enums.enabled
739
731
  },
740
732
  mappers: {
741
733
  boolean: (enabled) => ({ enabled }),
742
734
  string: (mode) => ({ mode })
743
735
  },
744
- value: fields$1.enums
736
+ value: fields.enums
745
737
  }),
746
- propertiesRequiredByDefault: fields$1.propertiesRequiredByDefault !== void 0 ? fields$1.propertiesRequiredByDefault : defaultValue$1.propertiesRequiredByDefault,
738
+ propertiesRequiredByDefault: fields.propertiesRequiredByDefault !== void 0 ? fields.propertiesRequiredByDefault : defaultValue.propertiesRequiredByDefault,
747
739
  readWrite: valueToObject({
748
740
  defaultValue: {
749
- ...defaultValue$1.readWrite,
750
- enabled: fields$1.readWrite !== void 0 ? Boolean(fields$1.readWrite) : defaultValue$1.readWrite.enabled
741
+ ...defaultValue.readWrite,
742
+ enabled: fields.readWrite !== void 0 ? Boolean(fields.readWrite) : defaultValue.readWrite.enabled
751
743
  },
752
744
  mappers: {
753
745
  boolean: (enabled) => ({ enabled }),
754
- object: (fields$2, defaultValue$2) => ({
755
- ...fields$2,
746
+ object: (fields, defaultValue) => ({
747
+ ...fields,
756
748
  requests: valueToObject({
757
- defaultValue: { ...defaultValue$2.requests },
749
+ defaultValue: { ...defaultValue.requests },
758
750
  mappers: {
759
751
  function: (name) => ({ name }),
760
752
  string: (name) => ({ name })
761
753
  },
762
- value: fields$2.requests
754
+ value: fields.requests
763
755
  }),
764
756
  responses: valueToObject({
765
- defaultValue: { ...defaultValue$2.responses },
757
+ defaultValue: { ...defaultValue.responses },
766
758
  mappers: {
767
759
  function: (name) => ({ name }),
768
760
  string: (name) => ({ name })
769
761
  },
770
- value: fields$2.responses
762
+ value: fields.responses
771
763
  })
772
764
  })
773
765
  },
774
- value: fields$1.readWrite
766
+ value: fields.readWrite
775
767
  }),
776
- schemaName: fields$1.schemaName !== void 0 ? fields$1.schemaName : defaultValue$1.schemaName
768
+ schemaName: fields.schemaName !== void 0 ? fields.schemaName : defaultValue.schemaName
777
769
  }) },
778
770
  value: fields.transforms
779
771
  }),
@@ -810,31 +802,31 @@ function dependencyFactory(dependencies) {
810
802
 
811
803
  //#endregion
812
804
  //#region src/debug/graph.ts
813
- const analyzeStructure = (graph$1) => {
805
+ const analyzeStructure = (graph) => {
814
806
  let maxDepth = 0;
815
807
  let maxChildren = 0;
816
808
  const computeDepth = (pointer, depth) => {
817
809
  maxDepth = Math.max(maxDepth, depth);
818
- const children = Array.from(graph$1.nodes.entries()).filter(([, nodeInfo]) => nodeInfo.parentPointer === pointer).map(([childPointer]) => childPointer);
810
+ const children = Array.from(graph.nodes.entries()).filter(([, nodeInfo]) => nodeInfo.parentPointer === pointer).map(([childPointer]) => childPointer);
819
811
  maxChildren = Math.max(maxChildren, children.length);
820
812
  for (const childPointer of children) computeDepth(childPointer, depth + 1);
821
813
  };
822
- const totalNodes = graph$1.nodes.size;
823
- if (graph$1.nodes.has("#")) computeDepth("#", 1);
814
+ const totalNodes = graph.nodes.size;
815
+ if (graph.nodes.has("#")) computeDepth("#", 1);
824
816
  return {
825
817
  maxChildren,
826
818
  maxDepth,
827
819
  totalNodes
828
820
  };
829
821
  };
830
- const exportForVisualization = (graph$1) => {
822
+ const exportForVisualization = (graph) => {
831
823
  const childrenMap = /* @__PURE__ */ new Map();
832
- for (const [pointer, nodeInfo] of graph$1.nodes) {
824
+ for (const [pointer, nodeInfo] of graph.nodes) {
833
825
  if (!nodeInfo.parentPointer) continue;
834
826
  if (!childrenMap.has(nodeInfo.parentPointer)) childrenMap.set(nodeInfo.parentPointer, []);
835
827
  childrenMap.get(nodeInfo.parentPointer).push(pointer);
836
828
  }
837
- return Array.from(graph$1.nodes.keys()).map((pointer) => ({
829
+ return Array.from(graph.nodes.keys()).map((pointer) => ({
838
830
  children: childrenMap.get(pointer)?.length ?? 0,
839
831
  childrenPointers: childrenMap.get(pointer) || [],
840
832
  pointer
@@ -1001,7 +993,7 @@ const hasOperationDataRequired = (operation) => {
1001
993
  if (operation.body?.required) return true;
1002
994
  return false;
1003
995
  };
1004
- const createOperationKey = ({ method, path: path$1 }) => `${method.toUpperCase()} ${path$1}`;
996
+ const createOperationKey = ({ method, path }) => `${method.toUpperCase()} ${path}`;
1005
997
  const operationPagination = ({ context, operation }) => {
1006
998
  const body = operation.body;
1007
999
  if (!body || !body.pagination) return parameterWithPagination({
@@ -1117,7 +1109,7 @@ const uppercaseRegExp = /[\p{Lu}]/u;
1117
1109
  const lowercaseRegExp = /[\p{Ll}]/u;
1118
1110
  const identifierRegExp = /([\p{Alpha}\p{N}_]|$)/u;
1119
1111
  const separatorsRegExp = /[_.$+:\- `\\[\](){}\\/]+/;
1120
- const leadingSeparatorsRegExp = /* @__PURE__ */ new RegExp(`^${separatorsRegExp.source}`);
1112
+ const leadingSeparatorsRegExp = new RegExp(`^${separatorsRegExp.source}`);
1121
1113
  const separatorsAndIdentifierRegExp = new RegExp(`${separatorsRegExp.source}${identifierRegExp.source}`, "gu");
1122
1114
  const numbersAndIdentifierRegExp = new RegExp(`\\d+${identifierRegExp.source}`, "gu");
1123
1115
  const preserveCase = (value, casing) => {
@@ -1265,24 +1257,24 @@ const sanitizeNamespaceIdentifier = (name) => name.replace(/^[^\p{ID_Start}]+/u,
1265
1257
  *
1266
1258
  * @deprecated
1267
1259
  */
1268
- function operationToId({ context, count = 1, id, method, path: path$1, state }) {
1260
+ function operationToId({ context, count = 1, id, method, path, state }) {
1269
1261
  let result;
1270
1262
  const { output } = context.config;
1271
1263
  const targetCase = (output !== void 0 && typeof output === "object" && "case" in output ? output.case : void 0) ?? "camelCase";
1272
1264
  if (id && (!context.config.plugins["@hey-api/sdk"] || context.config.plugins["@hey-api/sdk"].config.operations && typeof context.config.plugins["@hey-api/sdk"].config.operations !== "function" && typeof context.config.plugins["@hey-api/sdk"].config.operations === "object" && context.config.plugins["@hey-api/sdk"].config.operations.nesting === "operationId")) result = toCase(sanitizeNamespaceIdentifier(id), targetCase);
1273
- else result = toCase(`${method}-${path$1.replace(/{(.*?)}/g, "by-$1").replace(/[/:+]/g, "-")}`, targetCase);
1265
+ else result = toCase(`${method}-${path.replace(/{(.*?)}/g, "by-$1").replace(/[/:+]/g, "-")}`, targetCase);
1274
1266
  if (count > 1) result = `${result}${count}`;
1275
1267
  if (state.ids.has(result)) return operationToId({
1276
1268
  context,
1277
1269
  count: count + 1,
1278
1270
  id,
1279
1271
  method,
1280
- path: path$1,
1272
+ path,
1281
1273
  state
1282
1274
  });
1283
1275
  state.ids.set(result, createOperationKey({
1284
1276
  method,
1285
- path: path$1
1277
+ path
1286
1278
  }));
1287
1279
  return result;
1288
1280
  }
@@ -1291,7 +1283,7 @@ function operationToId({ context, count = 1, id, method, path: path$1, state })
1291
1283
  //#region src/debug/ir.ts
1292
1284
  const indent = (level) => " ".repeat(level);
1293
1285
  const log = (message, level) => console.log(`${indent(level ?? 0)}${message}`);
1294
- const print = (ir$1, options = {}) => {
1286
+ const print = (ir, options = {}) => {
1295
1287
  const { depth = 2, section = "all", verbosity = "summary" } = options;
1296
1288
  const printObject = (obj, level, kind = "generic") => {
1297
1289
  if (verbosity === "summary" && obj && typeof obj === "object") if (kind === "responses") {
@@ -1316,25 +1308,25 @@ const print = (ir$1, options = {}) => {
1316
1308
  if (operation.responses) printObject(operation.responses, base + 1, "responses");
1317
1309
  }
1318
1310
  };
1319
- const sections = section === "all" ? Object.keys(ir$1) : [section];
1320
- for (const section$1 of sections) switch (section$1) {
1311
+ const sections = section === "all" ? Object.keys(ir) : [section];
1312
+ for (const section of sections) switch (section) {
1321
1313
  case "components":
1322
- if (ir$1.components?.schemas) {
1323
- log(`Components: ${Object.keys(ir$1.components.schemas).length} schemas`);
1324
- for (const [, schema] of Object.entries(ir$1.components.schemas)) printObject(schema, 1, "schema");
1314
+ if (ir.components?.schemas) {
1315
+ log(`Components: ${Object.keys(ir.components.schemas).length} schemas`);
1316
+ for (const [, schema] of Object.entries(ir.components.schemas)) printObject(schema, 1, "schema");
1325
1317
  }
1326
1318
  break;
1327
1319
  case "paths": {
1328
- const paths = ir$1.paths || {};
1320
+ const paths = ir.paths || {};
1329
1321
  log(`paths (${Object.keys(paths).length} items):`);
1330
- for (const [path$1, item] of Object.entries(paths)) printPathItem(path$1, item);
1322
+ for (const [path, item] of Object.entries(paths)) printPathItem(path, item);
1331
1323
  break;
1332
1324
  }
1333
1325
  case "servers": break;
1334
1326
  case "webhooks": {
1335
- const webhooks = ir$1.webhooks || {};
1327
+ const webhooks = ir.webhooks || {};
1336
1328
  log(`webhooks (${Object.keys(webhooks).length} items):`);
1337
- for (const [path$1, item] of Object.entries(webhooks)) printPathItem(path$1, item);
1329
+ for (const [path, item] of Object.entries(webhooks)) printPathItem(path, item);
1338
1330
  break;
1339
1331
  }
1340
1332
  }
@@ -1540,8 +1532,8 @@ var MinHeap = class {
1540
1532
  * is not required and the caller only wants nodes in the order they were
1541
1533
  * added to the graph.
1542
1534
  */
1543
- const walkDeclarations = (graph$1, callback, options) => {
1544
- const pointers = Array.from(graph$1.nodes.keys());
1535
+ const walkDeclarations = (graph, callback, options) => {
1536
+ const pointers = Array.from(graph.nodes.keys());
1545
1537
  if (options?.preferGroups && options.preferGroups.length > 0) {
1546
1538
  const emitted = /* @__PURE__ */ new Set();
1547
1539
  if (options.matchPointerToGroup) for (const kind of options.preferGroups) for (const pointer of pointers) {
@@ -1549,16 +1541,16 @@ const walkDeclarations = (graph$1, callback, options) => {
1549
1541
  if (!result.matched) continue;
1550
1542
  if (result.kind === kind) {
1551
1543
  emitted.add(pointer);
1552
- callback(pointer, graph$1.nodes.get(pointer));
1544
+ callback(pointer, graph.nodes.get(pointer));
1553
1545
  }
1554
1546
  }
1555
1547
  for (const pointer of pointers) {
1556
1548
  if (emitted.has(pointer)) continue;
1557
- callback(pointer, graph$1.nodes.get(pointer));
1549
+ callback(pointer, graph.nodes.get(pointer));
1558
1550
  }
1559
1551
  return;
1560
1552
  }
1561
- for (const pointer of pointers) callback(pointer, graph$1.nodes.get(pointer));
1553
+ for (const pointer of pointers) callback(pointer, graph.nodes.get(pointer));
1562
1554
  };
1563
1555
  /**
1564
1556
  * Walks the nodes of the graph in topological order (dependencies before dependents).
@@ -1568,8 +1560,8 @@ const walkDeclarations = (graph$1, callback, options) => {
1568
1560
  * @param graph - The dependency graph
1569
1561
  * @param callback - Function to call for each node pointer
1570
1562
  */
1571
- const walkTopological = (graph$1, callback, options) => {
1572
- const pointers = Array.from(graph$1.nodes.keys());
1563
+ const walkTopological = (graph, callback, options) => {
1564
+ const pointers = Array.from(graph.nodes.keys());
1573
1565
  const baseIndex = /* @__PURE__ */ new Map();
1574
1566
  pointers.forEach((pointer, index) => baseIndex.set(pointer, index));
1575
1567
  const declIndex = /* @__PURE__ */ new Map();
@@ -1579,11 +1571,11 @@ const walkTopological = (graph$1, callback, options) => {
1579
1571
  }
1580
1572
  const depsOf = /* @__PURE__ */ new Map();
1581
1573
  for (const pointer of pointers) {
1582
- const raw = graph$1.subtreeDependencies?.get(pointer) ?? /* @__PURE__ */ new Set();
1574
+ const raw = graph.subtreeDependencies?.get(pointer) ?? /* @__PURE__ */ new Set();
1583
1575
  const filtered = /* @__PURE__ */ new Set();
1584
1576
  for (const rawPointer of raw) {
1585
1577
  if (rawPointer === pointer) continue;
1586
- if (graph$1.nodes.has(rawPointer)) filtered.add(rawPointer);
1578
+ if (graph.nodes.has(rawPointer)) filtered.add(rawPointer);
1587
1579
  }
1588
1580
  depsOf.set(pointer, filtered);
1589
1581
  }
@@ -1650,11 +1642,11 @@ const walkTopological = (graph$1, callback, options) => {
1650
1642
  return false;
1651
1643
  })()) finalOrder = proposed;
1652
1644
  }
1653
- for (const pointer of finalOrder) callback(pointer, graph$1.nodes.get(pointer));
1645
+ for (const pointer of finalOrder) callback(pointer, graph.nodes.get(pointer));
1654
1646
  };
1655
- const walk = (graph$1, callback, options) => {
1656
- if (options?.order === "topological") return walkTopological(graph$1, callback, options);
1657
- return walkDeclarations(graph$1, callback, options);
1647
+ const walk = (graph, callback, options) => {
1648
+ if (options?.order === "topological") return walkTopological(graph, callback, options);
1649
+ return walkDeclarations(graph, callback, options);
1658
1650
  };
1659
1651
 
1660
1652
  //#endregion
@@ -1688,9 +1680,9 @@ const matchIrPointerToGroup = (pointer, kind) => {
1688
1680
  matched: true
1689
1681
  } : { matched: false };
1690
1682
  for (const key of Object.keys(patterns)) {
1691
- const kind$1 = key;
1692
- if (patterns[kind$1].test(pointer)) return {
1693
- kind: kind$1,
1683
+ const kind = key;
1684
+ if (patterns[kind].test(pointer)) return {
1685
+ kind,
1694
1686
  matched: true
1695
1687
  };
1696
1688
  }
@@ -1728,8 +1720,8 @@ const jsonPointerTilde = /~0/g;
1728
1720
  * Returns the reusable component name from `$ref`.
1729
1721
  */
1730
1722
  function refToName($ref) {
1731
- const path$1 = jsonPointerToPath($ref);
1732
- const name = path$1[path$1.length - 1];
1723
+ const path = jsonPointerToPath($ref);
1724
+ const name = path[path.length - 1];
1733
1725
  return decodeURI(name);
1734
1726
  }
1735
1727
  /**
@@ -1789,8 +1781,8 @@ function normalizeJsonPointer(pointer) {
1789
1781
  * @param path
1790
1782
  * @returns
1791
1783
  */
1792
- function pathToJsonPointer(path$1) {
1793
- const segments = path$1.map(encodeJsonPointerSegment).join("/");
1784
+ function pathToJsonPointer(path) {
1785
+ const segments = path.map(encodeJsonPointerSegment).join("/");
1794
1786
  return "#" + (segments ? `/${segments}` : "");
1795
1787
  }
1796
1788
  /**
@@ -1807,15 +1799,15 @@ function pathToJsonPointer(path$1) {
1807
1799
  * @returns true if the ref points to a top-level component, false otherwise
1808
1800
  */
1809
1801
  function isTopLevelComponent(refOrPath) {
1810
- const path$1 = refOrPath instanceof Array ? refOrPath : jsonPointerToPath(refOrPath);
1811
- if (path$1[0] === "components") return path$1.length === 3;
1812
- if (path$1[0] === "definitions") return path$1.length === 2;
1802
+ const path = refOrPath instanceof Array ? refOrPath : jsonPointerToPath(refOrPath);
1803
+ if (path[0] === "components") return path.length === 3;
1804
+ if (path[0] === "definitions") return path.length === 2;
1813
1805
  return false;
1814
1806
  }
1815
1807
  function resolveRef({ $ref, spec }) {
1816
- const path$1 = jsonPointerToPath(decodeURI($ref));
1808
+ const path = jsonPointerToPath(decodeURI($ref));
1817
1809
  let current = spec;
1818
- for (const part of path$1) {
1810
+ for (const part of path) {
1819
1811
  const segment = part;
1820
1812
  if (current[segment] === void 0) throw new Error(`Reference not found: ${$ref}`);
1821
1813
  current = current[segment];
@@ -2272,10 +2264,10 @@ var IntentContext = class {
2272
2264
  constructor(spec) {
2273
2265
  this.spec = spec;
2274
2266
  }
2275
- getOperation(path$1, method) {
2267
+ getOperation(path, method) {
2276
2268
  const paths = this.spec.paths;
2277
2269
  if (!paths) return;
2278
- return paths[path$1]?.[method];
2270
+ return paths[path]?.[method];
2279
2271
  }
2280
2272
  setExample(operation, example) {
2281
2273
  const source = this.getOperation(operation.path, operation.method);
@@ -2298,11 +2290,11 @@ function createSchemaProcessor() {
2298
2290
  tags: contextTags
2299
2291
  };
2300
2292
  },
2301
- hasEmitted(path$1) {
2302
- return emitted.has(pathToJsonPointer(path$1));
2293
+ hasEmitted(path) {
2294
+ return emitted.has(pathToJsonPointer(path));
2303
2295
  },
2304
- markEmitted(path$1) {
2305
- const pointer = pathToJsonPointer(path$1);
2296
+ markEmitted(path) {
2297
+ const pointer = pathToJsonPointer(path);
2306
2298
  if (emitted.has(pointer)) return false;
2307
2299
  emitted.add(pointer);
2308
2300
  return true;
@@ -2333,21 +2325,21 @@ function createSchemaProcessor() {
2333
2325
  * - Path tracking for child schemas
2334
2326
  */
2335
2327
  function createSchemaWalker(visitor) {
2336
- const walk$1 = (schema, ctx) => {
2328
+ const walk = (schema, ctx) => {
2337
2329
  if (visitor.intercept) {
2338
- const intercepted = visitor.intercept(schema, ctx, walk$1);
2330
+ const intercepted = visitor.intercept(schema, ctx, walk);
2339
2331
  if (intercepted !== void 0) return intercepted;
2340
2332
  }
2341
2333
  if (schema.$ref) return visitor.reference(schema.$ref, schema, ctx);
2342
2334
  if (schema.type) {
2343
- let result = visitTyped(schema, ctx, visitor, walk$1);
2335
+ let result = visitTyped(schema, ctx, visitor, walk);
2344
2336
  if (visitor.postProcess) result = visitor.postProcess(result, schema, ctx);
2345
2337
  return result;
2346
2338
  }
2347
2339
  if (schema.items) {
2348
2340
  const deduplicated = deduplicateSchema({ schema });
2349
- if (!deduplicated.items) return walk$1(deduplicated, ctx);
2350
- const itemResults = deduplicated.items.map((item, index) => walk$1(item, {
2341
+ if (!deduplicated.items) return walk(deduplicated, ctx);
2342
+ const itemResults = deduplicated.items.map((item, index) => walk(item, {
2351
2343
  ...ctx,
2352
2344
  path: ref([
2353
2345
  ...fromRef(ctx.path),
@@ -2359,23 +2351,23 @@ function createSchemaWalker(visitor) {
2359
2351
  }
2360
2352
  return visitor.unknown({ type: "unknown" }, ctx);
2361
2353
  };
2362
- return walk$1;
2354
+ return walk;
2363
2355
  }
2364
2356
  /**
2365
2357
  * Dispatch to the appropriate visitor method based on schema type.
2366
2358
  */
2367
- function visitTyped(schema, ctx, visitor, walk$1) {
2359
+ function visitTyped(schema, ctx, visitor, walk) {
2368
2360
  switch (schema.type) {
2369
- case "array": return visitor.array(schema, ctx, walk$1);
2361
+ case "array": return visitor.array(schema, ctx, walk);
2370
2362
  case "boolean": return visitor.boolean(schema, ctx);
2371
- case "enum": return visitor.enum(schema, ctx, walk$1);
2363
+ case "enum": return visitor.enum(schema, ctx, walk);
2372
2364
  case "integer": return visitor.integer(schema, ctx);
2373
2365
  case "never": return visitor.never(schema, ctx);
2374
2366
  case "null": return visitor.null(schema, ctx);
2375
2367
  case "number": return visitor.number(schema, ctx);
2376
- case "object": return visitor.object(schema, ctx, walk$1);
2368
+ case "object": return visitor.object(schema, ctx, walk);
2377
2369
  case "string": return visitor.string(schema, ctx);
2378
- case "tuple": return visitor.tuple(schema, ctx, walk$1);
2370
+ case "tuple": return visitor.tuple(schema, ctx, walk);
2379
2371
  case "undefined": return visitor.undefined(schema, ctx);
2380
2372
  case "unknown": return visitor.unknown(schema, ctx);
2381
2373
  case "void": return visitor.void(schema, ctx);
@@ -2394,7 +2386,7 @@ function childContext(ctx, ...segments) {
2394
2386
  //#endregion
2395
2387
  //#region src/openApi/shared/utils/filter.ts
2396
2388
  const namespaceNeedle = "/";
2397
- const addNamespace = (namespace$2, value = "") => `${namespace$2}${namespaceNeedle}${value}`;
2389
+ const addNamespace = (namespace, value = "") => `${namespace}${namespaceNeedle}${value}`;
2398
2390
  const removeNamespace = (key) => {
2399
2391
  const index = key.indexOf(namespaceNeedle);
2400
2392
  return {
@@ -2429,13 +2421,13 @@ const createFiltersSetAndRegExps = (type, filters) => {
2429
2421
  };
2430
2422
  const collectFiltersSetFromRegExpsOpenApiV2 = ({ excludeOperations, excludeSchemas, includeOperations, includeSchemas, spec }) => {
2431
2423
  if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) for (const entry of Object.entries(spec.paths)) {
2432
- const path$1 = entry[0];
2424
+ const path = entry[0];
2433
2425
  const pathItem = entry[1];
2434
2426
  for (const method of httpMethods) {
2435
2427
  if (!pathItem[method]) continue;
2436
2428
  const key = createOperationKey({
2437
2429
  method,
2438
- path: path$1
2430
+ path
2439
2431
  });
2440
2432
  if (excludeOperations.regexps.some((regexp) => regexp.test(key))) excludeOperations.set.add(addNamespace("operation", key));
2441
2433
  if (includeOperations.regexps.some((regexp) => regexp.test(key))) includeOperations.set.add(addNamespace("operation", key));
@@ -2450,13 +2442,13 @@ const collectFiltersSetFromRegExpsOpenApiV2 = ({ excludeOperations, excludeSchem
2450
2442
  };
2451
2443
  const collectFiltersSetFromRegExpsOpenApiV3 = ({ excludeOperations, excludeParameters, excludeRequestBodies, excludeResponses, excludeSchemas, includeOperations, includeParameters, includeRequestBodies, includeResponses, includeSchemas, spec }) => {
2452
2444
  if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) for (const entry of Object.entries(spec.paths)) {
2453
- const path$1 = entry[0];
2445
+ const path = entry[0];
2454
2446
  const pathItem = entry[1];
2455
2447
  for (const method of httpMethods) {
2456
2448
  if (!pathItem[method]) continue;
2457
2449
  const key = createOperationKey({
2458
2450
  method,
2459
- path: path$1
2451
+ path
2460
2452
  });
2461
2453
  if (excludeOperations.regexps.some((regexp) => regexp.test(key))) excludeOperations.set.add(addNamespace("operation", key));
2462
2454
  if (includeOperations.regexps.some((regexp) => regexp.test(key))) includeOperations.set.add(addNamespace("operation", key));
@@ -2568,8 +2560,8 @@ const collectOperations = ({ filters, parameters, requestBodies, resourceMetadat
2568
2560
  if (filters.tags.exclude.size && node.tags.size && [...filters.tags.exclude].some((tag) => node.tags.has(tag))) continue;
2569
2561
  if (filters.tags.include.size && !new Set([...filters.tags.include].filter((tag) => node.tags.has(tag))).size) continue;
2570
2562
  if ([...node.dependencies].some((dependency) => {
2571
- const { namespace: namespace$2 } = removeNamespace(dependency);
2572
- switch (namespace$2) {
2563
+ const { namespace } = removeNamespace(dependency);
2564
+ switch (namespace) {
2573
2565
  case "body": return !requestBodies.has(dependency);
2574
2566
  case "parameter": return !parameters.has(dependency);
2575
2567
  case "response": return !responses.has(dependency);
@@ -2596,8 +2588,8 @@ const collectParameters = ({ filters, resourceMetadata, schemas }) => {
2596
2588
  finalSet.add(key);
2597
2589
  if (!node.dependencies.size) continue;
2598
2590
  for (const dependency of node.dependencies) {
2599
- const { namespace: namespace$2 } = removeNamespace(dependency);
2600
- switch (namespace$2) {
2591
+ const { namespace } = removeNamespace(dependency);
2592
+ switch (namespace) {
2601
2593
  case "body":
2602
2594
  if (filters.requestBodies.exclude.has(dependency)) finalSet.delete(key);
2603
2595
  else if (!finalSet.has(dependency)) stack.push(dependency);
@@ -2626,8 +2618,8 @@ const collectRequestBodies = ({ filters, resourceMetadata, schemas }) => {
2626
2618
  finalSet.add(key);
2627
2619
  if (!node.dependencies.size) continue;
2628
2620
  for (const dependency of node.dependencies) {
2629
- const { namespace: namespace$2 } = removeNamespace(dependency);
2630
- switch (namespace$2) {
2621
+ const { namespace } = removeNamespace(dependency);
2622
+ switch (namespace) {
2631
2623
  case "body":
2632
2624
  if (filters.requestBodies.exclude.has(dependency)) finalSet.delete(key);
2633
2625
  else if (!finalSet.has(dependency)) stack.push(dependency);
@@ -2656,8 +2648,8 @@ const collectResponses = ({ filters, resourceMetadata, schemas }) => {
2656
2648
  finalSet.add(key);
2657
2649
  if (!node.dependencies.size) continue;
2658
2650
  for (const dependency of node.dependencies) {
2659
- const { namespace: namespace$2 } = removeNamespace(dependency);
2660
- switch (namespace$2) {
2651
+ const { namespace } = removeNamespace(dependency);
2652
+ switch (namespace) {
2661
2653
  case "body":
2662
2654
  if (filters.requestBodies.exclude.has(dependency)) finalSet.delete(key);
2663
2655
  else if (!finalSet.has(dependency)) stack.push(dependency);
@@ -2686,8 +2678,8 @@ const collectSchemas = ({ filters, resourceMetadata }) => {
2686
2678
  finalSet.add(key);
2687
2679
  if (!node.dependencies.size) continue;
2688
2680
  for (const dependency of node.dependencies) {
2689
- const { namespace: namespace$2 } = removeNamespace(dependency);
2690
- switch (namespace$2) {
2681
+ const { namespace } = removeNamespace(dependency);
2682
+ switch (namespace) {
2691
2683
  case "schema":
2692
2684
  if (!finalSet.has(dependency) && !filters.schemas.exclude.has(dependency)) stack.push(dependency);
2693
2685
  break;
@@ -2765,13 +2757,13 @@ const collectOperationDependencies = ({ operations, resourceMetadata }) => {
2765
2757
  const key = stack.pop();
2766
2758
  if (finalSet.has(key)) continue;
2767
2759
  finalSet.add(key);
2768
- const { namespace: namespace$2 } = removeNamespace(key);
2760
+ const { namespace } = removeNamespace(key);
2769
2761
  let dependencies;
2770
- if (namespace$2 === "body") dependencies = resourceMetadata.requestBodies.get(key)?.dependencies;
2771
- else if (namespace$2 === "operation") dependencies = resourceMetadata.operations.get(key)?.dependencies;
2772
- else if (namespace$2 === "parameter") dependencies = resourceMetadata.parameters.get(key)?.dependencies;
2773
- else if (namespace$2 === "response") dependencies = resourceMetadata.responses.get(key)?.dependencies;
2774
- else if (namespace$2 === "schema") dependencies = resourceMetadata.schemas.get(key)?.dependencies;
2762
+ if (namespace === "body") dependencies = resourceMetadata.requestBodies.get(key)?.dependencies;
2763
+ else if (namespace === "operation") dependencies = resourceMetadata.operations.get(key)?.dependencies;
2764
+ else if (namespace === "parameter") dependencies = resourceMetadata.parameters.get(key)?.dependencies;
2765
+ else if (namespace === "response") dependencies = resourceMetadata.responses.get(key)?.dependencies;
2766
+ else if (namespace === "schema") dependencies = resourceMetadata.schemas.get(key)?.dependencies;
2775
2767
  if (!dependencies?.size) continue;
2776
2768
  for (const dependency of dependencies) if (!finalSet.has(dependency)) stack.push(dependency);
2777
2769
  }
@@ -2855,7 +2847,7 @@ const createFilteredDependencies = ({ filters, logger, resourceMetadata }) => {
2855
2847
  * Builds a resource metadata map from a Graph, matching the old Graph interface
2856
2848
  * for compatibility with filtering code.
2857
2849
  */
2858
- const buildResourceMetadata = (graph$1, logger) => {
2850
+ const buildResourceMetadata = (graph, logger) => {
2859
2851
  const eventBuildResourceMetadata = logger.timeEvent("build-resource-metadata");
2860
2852
  const resourceMetadata = {
2861
2853
  operations: /* @__PURE__ */ new Map(),
@@ -2866,43 +2858,43 @@ const buildResourceMetadata = (graph$1, logger) => {
2866
2858
  };
2867
2859
  const getDependencies = (pointer) => {
2868
2860
  const dependencies = /* @__PURE__ */ new Set();
2869
- const nodeDependencies = graph$1.transitiveDependencies.get(pointer);
2861
+ const nodeDependencies = graph.transitiveDependencies.get(pointer);
2870
2862
  if (nodeDependencies?.size) for (const dependency of nodeDependencies) {
2871
- const path$1 = jsonPointerToPath(dependency);
2872
- const type = path$1[path$1.length - 2];
2873
- const name = path$1[path$1.length - 1];
2863
+ const path = jsonPointerToPath(dependency);
2864
+ const type = path[path.length - 2];
2865
+ const name = path[path.length - 1];
2874
2866
  if (type && name) {
2875
- const namespace$2 = stringToNamespace(type);
2876
- if (namespace$2 === "unknown") console.warn(`unsupported type: ${type}`);
2877
- dependencies.add(addNamespace(namespace$2, name));
2867
+ const namespace = stringToNamespace(type);
2868
+ if (namespace === "unknown") console.warn(`unsupported type: ${type}`);
2869
+ dependencies.add(addNamespace(namespace, name));
2878
2870
  }
2879
2871
  }
2880
2872
  return dependencies;
2881
2873
  };
2882
- for (const [pointer, nodeInfo] of graph$1.nodes) {
2883
- const path$1 = jsonPointerToPath(pointer);
2884
- if (path$1[0] === "components") {
2885
- if (path$1.length === 3) {
2886
- if (path$1[1] === "schemas") {
2887
- const name = path$1[path$1.length - 1];
2874
+ for (const [pointer, nodeInfo] of graph.nodes) {
2875
+ const path = jsonPointerToPath(pointer);
2876
+ if (path[0] === "components") {
2877
+ if (path.length === 3) {
2878
+ if (path[1] === "schemas") {
2879
+ const name = path[path.length - 1];
2888
2880
  resourceMetadata.schemas.set(addNamespace("schema", name), {
2889
2881
  dependencies: getDependencies(pointer),
2890
2882
  deprecated: nodeInfo.deprecated ?? false
2891
2883
  });
2892
- } else if (path$1[1] === "parameters") {
2893
- const name = path$1[path$1.length - 1];
2884
+ } else if (path[1] === "parameters") {
2885
+ const name = path[path.length - 1];
2894
2886
  resourceMetadata.parameters.set(addNamespace("parameter", name), {
2895
2887
  dependencies: getDependencies(pointer),
2896
2888
  deprecated: nodeInfo.deprecated ?? false
2897
2889
  });
2898
- } else if (path$1[1] === "requestBodies") {
2899
- const name = path$1[path$1.length - 1];
2890
+ } else if (path[1] === "requestBodies") {
2891
+ const name = path[path.length - 1];
2900
2892
  resourceMetadata.requestBodies.set(addNamespace("body", name), {
2901
2893
  dependencies: getDependencies(pointer),
2902
2894
  deprecated: nodeInfo.deprecated ?? false
2903
2895
  });
2904
- } else if (path$1[1] === "responses") {
2905
- const name = path$1[path$1.length - 1];
2896
+ } else if (path[1] === "responses") {
2897
+ const name = path[path.length - 1];
2906
2898
  resourceMetadata.responses.set(addNamespace("response", name), {
2907
2899
  dependencies: getDependencies(pointer),
2908
2900
  deprecated: nodeInfo.deprecated ?? false
@@ -2911,12 +2903,12 @@ const buildResourceMetadata = (graph$1, logger) => {
2911
2903
  }
2912
2904
  continue;
2913
2905
  }
2914
- if (path$1[0] === "paths") {
2915
- if (path$1.length === 3 && httpMethods.includes(path$1[2])) {
2916
- const method = path$1[path$1.length - 1];
2906
+ if (path[0] === "paths") {
2907
+ if (path.length === 3 && httpMethods.includes(path[2])) {
2908
+ const method = path[path.length - 1];
2917
2909
  const operationKey = createOperationKey({
2918
2910
  method,
2919
- path: path$1.slice(1, -1).join("/")
2911
+ path: path.slice(1, -1).join("/")
2920
2912
  });
2921
2913
  resourceMetadata.operations.set(addNamespace("operation", operationKey), {
2922
2914
  dependencies: getDependencies(pointer),
@@ -2926,9 +2918,9 @@ const buildResourceMetadata = (graph$1, logger) => {
2926
2918
  }
2927
2919
  continue;
2928
2920
  }
2929
- if (path$1[0] === "definitions") {
2930
- if (path$1.length === 2) {
2931
- const name = path$1[path$1.length - 1];
2921
+ if (path[0] === "definitions") {
2922
+ if (path.length === 2) {
2923
+ const name = path[path.length - 1];
2932
2924
  resourceMetadata.schemas.set(addNamespace("schema", name), {
2933
2925
  dependencies: getDependencies(pointer),
2934
2926
  deprecated: nodeInfo.deprecated ?? false
@@ -2997,7 +2989,7 @@ const getUniqueComponentName = ({ base, components, extraComponents }) => {
2997
2989
  }
2998
2990
  return name;
2999
2991
  };
3000
- const isPathRootSchema = (path$1) => path$1.length === 3 && path$1[0] === "components" && path$1[1] === "schemas" || path$1.length === 2 && path$1[0] === "definitions";
2992
+ const isPathRootSchema = (path) => path.length === 3 && path[0] === "components" && path[1] === "schemas" || path.length === 2 && path[0] === "definitions";
3001
2993
  const specToSchemasPointerNamespace = (spec) => {
3002
2994
  if (spec && typeof spec === "object") {
3003
2995
  if ("swagger" in spec) return "#/definitions/";
@@ -3034,21 +3026,21 @@ const getEnumSignature = (schema) => {
3034
3026
  * @param path - The path to the current node
3035
3027
  * @param visitor - Function to call for each visited node
3036
3028
  */
3037
- const walkSchemas$1 = ({ key, node, parent, path: path$1, visitor }) => {
3029
+ const walkSchemas$1 = ({ key, node, parent, path, visitor }) => {
3038
3030
  if (!node || typeof node !== "object" || node instanceof Array) return;
3039
3031
  const value = node;
3040
3032
  if ("type" in value || "enum" in value || childSchemaRelationships.some(([keyword]) => keyword in value)) visitor({
3041
3033
  key,
3042
3034
  node,
3043
3035
  parent,
3044
- path: path$1
3036
+ path
3045
3037
  });
3046
3038
  for (const [k, v] of Object.entries(value)) if (typeof v === "object" && v !== null) if (v instanceof Array) v.forEach((item, index) => walkSchemas$1({
3047
3039
  key: index,
3048
3040
  node: item,
3049
3041
  parent: v,
3050
3042
  path: [
3051
- ...path$1,
3043
+ ...path,
3052
3044
  k,
3053
3045
  index
3054
3046
  ],
@@ -3058,7 +3050,7 @@ const walkSchemas$1 = ({ key, node, parent, path: path$1, visitor }) => {
3058
3050
  key: k,
3059
3051
  node: v,
3060
3052
  parent: node,
3061
- path: [...path$1, k],
3053
+ path: [...path, k],
3062
3054
  visitor
3063
3055
  });
3064
3056
  };
@@ -3083,8 +3075,8 @@ const inlineMode = ({ spec }) => {
3083
3075
  };
3084
3076
  replaceEnumRefs(spec);
3085
3077
  for (const pointer of Object.keys(rootEnums)) {
3086
- const path$1 = jsonPointerToPath(pointer);
3087
- const name = path$1[path$1.length - 1];
3078
+ const path = jsonPointerToPath(pointer);
3079
+ const name = path[path.length - 1];
3088
3080
  if (name) delete schemasObj[name];
3089
3081
  }
3090
3082
  };
@@ -3182,21 +3174,21 @@ const enumsTransform = ({ config, spec }) => {
3182
3174
  * @param path - The path to the current node
3183
3175
  * @param visitor - Function to call for each visited node
3184
3176
  */
3185
- const walkSchemas = ({ key, node, parent, path: path$1, visitor }) => {
3177
+ const walkSchemas = ({ key, node, parent, path, visitor }) => {
3186
3178
  if (!node || typeof node !== "object" || node instanceof Array) return;
3187
3179
  const value = node;
3188
3180
  if ("type" in value || childSchemaRelationships.some(([keyword]) => keyword in value)) visitor({
3189
3181
  key,
3190
3182
  node,
3191
3183
  parent,
3192
- path: path$1
3184
+ path
3193
3185
  });
3194
3186
  for (const [k, v] of Object.entries(value)) if (typeof v === "object" && v !== null) if (v instanceof Array) v.forEach((item, index) => walkSchemas({
3195
3187
  key: index,
3196
3188
  node: item,
3197
3189
  parent: v,
3198
3190
  path: [
3199
- ...path$1,
3191
+ ...path,
3200
3192
  k,
3201
3193
  index
3202
3194
  ],
@@ -3206,7 +3198,7 @@ const walkSchemas = ({ key, node, parent, path: path$1, visitor }) => {
3206
3198
  key: k,
3207
3199
  node: v,
3208
3200
  parent: node,
3209
- path: [...path$1, k],
3201
+ path: [...path, k],
3210
3202
  visitor
3211
3203
  });
3212
3204
  };
@@ -3257,7 +3249,6 @@ const deepEqual = (a, b) => {
3257
3249
  for (const key of keysA) if (!deepEqual(objA[key], objB[key])) return false;
3258
3250
  return true;
3259
3251
  };
3260
- var deepEqual_default = deepEqual;
3261
3252
 
3262
3253
  //#endregion
3263
3254
  //#region src/openApi/shared/utils/graph.ts
@@ -3279,7 +3270,7 @@ const annotateChildScopes = (nodes) => {
3279
3270
  /**
3280
3271
  * Recursively collects all $ref dependencies in the subtree rooted at `pointer`.
3281
3272
  */
3282
- const collectPointerDependencies = ({ cache, graph: graph$1, pointer, visited }) => {
3273
+ const collectPointerDependencies = ({ cache, graph, pointer, visited }) => {
3283
3274
  const cached = cache.transitiveDependencies.get(pointer);
3284
3275
  if (cached) return {
3285
3276
  subtreeDependencies: cache.subtreeDependencies.get(pointer),
@@ -3290,19 +3281,19 @@ const collectPointerDependencies = ({ cache, graph: graph$1, pointer, visited })
3290
3281
  transitiveDependencies: /* @__PURE__ */ new Set()
3291
3282
  };
3292
3283
  visited.add(pointer);
3293
- if (!graph$1.nodes.get(pointer)) return {
3284
+ if (!graph.nodes.get(pointer)) return {
3294
3285
  subtreeDependencies: /* @__PURE__ */ new Set(),
3295
3286
  transitiveDependencies: /* @__PURE__ */ new Set()
3296
3287
  };
3297
3288
  const transitiveDependencies = /* @__PURE__ */ new Set();
3298
3289
  const subtreeDependencies = /* @__PURE__ */ new Set();
3299
- const nodeDependencies = graph$1.nodeDependencies.get(pointer);
3290
+ const nodeDependencies = graph.nodeDependencies.get(pointer);
3300
3291
  if (nodeDependencies) for (const depPointer of nodeDependencies) {
3301
3292
  transitiveDependencies.add(depPointer);
3302
3293
  subtreeDependencies.add(depPointer);
3303
3294
  const depResult = collectPointerDependencies({
3304
3295
  cache,
3305
- graph: graph$1,
3296
+ graph,
3306
3297
  pointer: depPointer,
3307
3298
  visited
3308
3299
  });
@@ -3317,7 +3308,7 @@ const collectPointerDependencies = ({ cache, graph: graph$1, pointer, visited })
3317
3308
  if (!childResult.subtreeDependencies || !childResult.transitiveDependencies) {
3318
3309
  childResult = collectPointerDependencies({
3319
3310
  cache,
3320
- graph: graph$1,
3311
+ graph,
3321
3312
  pointer: childPointer,
3322
3313
  visited
3323
3314
  });
@@ -3346,8 +3337,8 @@ const collectPointerDependencies = ({ cache, graph: graph$1, pointer, visited })
3346
3337
  *
3347
3338
  * @param graph - The Graph structure containing nodes, dependencies, and reverseNodeDependencies.
3348
3339
  */
3349
- const propagateScopes = (graph$1) => {
3350
- const worklist = new Set(Array.from(graph$1.nodes.entries()).filter(([, nodeInfo]) => nodeInfo.scopes && nodeInfo.scopes.size > 0).map(([pointer]) => pointer));
3340
+ const propagateScopes = (graph) => {
3341
+ const worklist = new Set(Array.from(graph.nodes.entries()).filter(([, nodeInfo]) => nodeInfo.scopes && nodeInfo.scopes.size > 0).map(([pointer]) => pointer));
3351
3342
  /**
3352
3343
  * Notifies all dependents of a node that its scopes may have changed.
3353
3344
  * Dependents include:
@@ -3361,7 +3352,7 @@ const propagateScopes = (graph$1) => {
3361
3352
  */
3362
3353
  const notifyAllDependents = (pointer, nodeInfo, childPointer) => {
3363
3354
  if (nodeInfo.parentPointer) worklist.add(nodeInfo.parentPointer);
3364
- const reverseNodeDependencies = graph$1.reverseNodeDependencies.get(pointer);
3355
+ const reverseNodeDependencies = graph.reverseNodeDependencies.get(pointer);
3365
3356
  if (reverseNodeDependencies) for (const dependentPointer of reverseNodeDependencies) worklist.add(dependentPointer);
3366
3357
  if (childPointer) {
3367
3358
  const combinatorChildMatch = childPointer.match(/(.*)\/(allOf|anyOf|oneOf)\/\d+$/);
@@ -3381,14 +3372,14 @@ const propagateScopes = (graph$1) => {
3381
3372
  */
3382
3373
  const propagateChildScopes = (pointer, nodeInfo, childPointer) => {
3383
3374
  if (!nodeInfo?.scopes) return;
3384
- const childInfo = graph$1.nodes.get(childPointer);
3375
+ const childInfo = graph.nodes.get(childPointer);
3385
3376
  if (!childInfo?.scopes) return;
3386
3377
  if (propagateScopesToNode(childInfo, nodeInfo)) notifyAllDependents(pointer, nodeInfo, childPointer);
3387
3378
  };
3388
3379
  while (worklist.size > 0) {
3389
3380
  const pointer = worklist.values().next().value;
3390
3381
  worklist.delete(pointer);
3391
- const nodeInfo = graph$1.nodes.get(pointer);
3382
+ const nodeInfo = graph.nodes.get(pointer);
3392
3383
  if (!nodeInfo) continue;
3393
3384
  if (!nodeInfo.scopes) nodeInfo.scopes = /* @__PURE__ */ new Set();
3394
3385
  const node = nodeInfo.node;
@@ -3403,15 +3394,15 @@ const propagateScopes = (graph$1) => {
3403
3394
  else if (typeof value === "object" && value !== null) propagateChildScopes(pointer, nodeInfo, `${pointer}/${keyword}`);
3404
3395
  }
3405
3396
  }
3406
- const nodeDependencies = graph$1.nodeDependencies.get(pointer);
3397
+ const nodeDependencies = graph.nodeDependencies.get(pointer);
3407
3398
  if (nodeDependencies) for (const depPointer of nodeDependencies) {
3408
- const depNode = graph$1.nodes.get(depPointer);
3399
+ const depNode = graph.nodes.get(depPointer);
3409
3400
  if (depNode?.scopes) {
3410
3401
  if (propagateScopesToNode(depNode, nodeInfo)) notifyAllDependents(pointer, nodeInfo);
3411
3402
  }
3412
3403
  }
3413
3404
  if (nodeInfo.parentPointer) {
3414
- const parentInfo = graph$1.nodes.get(nodeInfo.parentPointer);
3405
+ const parentInfo = graph.nodes.get(nodeInfo.parentPointer);
3415
3406
  if (parentInfo) {
3416
3407
  if (propagateScopesToNode(nodeInfo, parentInfo)) notifyAllDependents(nodeInfo.parentPointer, parentInfo);
3417
3408
  }
@@ -3474,48 +3465,48 @@ const seedLocalScopes = (nodes) => {
3474
3465
  */
3475
3466
  function buildGraph(root, logger) {
3476
3467
  const eventBuildGraph = logger.timeEvent("build-graph");
3477
- const graph$1 = {
3468
+ const graph = {
3478
3469
  nodeDependencies: /* @__PURE__ */ new Map(),
3479
3470
  nodes: /* @__PURE__ */ new Map(),
3480
3471
  reverseNodeDependencies: /* @__PURE__ */ new Map(),
3481
3472
  subtreeDependencies: /* @__PURE__ */ new Map(),
3482
3473
  transitiveDependencies: /* @__PURE__ */ new Map()
3483
3474
  };
3484
- const walk$1 = ({ key, node, parentPointer, path: path$1 }) => {
3475
+ const walk = ({ key, node, parentPointer, path }) => {
3485
3476
  if (typeof node !== "object" || node === null) return;
3486
- const pointer = pathToJsonPointer(path$1);
3477
+ const pointer = pathToJsonPointer(path);
3487
3478
  let deprecated;
3488
3479
  let tags;
3489
3480
  if (typeof node === "object" && node !== null) {
3490
3481
  if ("deprecated" in node && typeof node.deprecated === "boolean") deprecated = Boolean(node.deprecated);
3491
3482
  if ("$ref" in node && typeof node.$ref === "string") {
3492
3483
  const refPointer = normalizeJsonPointer(node.$ref);
3493
- if (!graph$1.nodeDependencies.has(pointer)) graph$1.nodeDependencies.set(pointer, /* @__PURE__ */ new Set());
3494
- graph$1.nodeDependencies.get(pointer).add(refPointer);
3484
+ if (!graph.nodeDependencies.has(pointer)) graph.nodeDependencies.set(pointer, /* @__PURE__ */ new Set());
3485
+ graph.nodeDependencies.get(pointer).add(refPointer);
3495
3486
  }
3496
3487
  if ("tags" in node && node.tags instanceof Array) tags = new Set(node.tags.filter((tag) => typeof tag === "string"));
3497
3488
  }
3498
- graph$1.nodes.set(pointer, {
3489
+ graph.nodes.set(pointer, {
3499
3490
  deprecated,
3500
3491
  key,
3501
3492
  node,
3502
3493
  parentPointer,
3503
3494
  tags
3504
3495
  });
3505
- if (node instanceof Array) node.forEach((item, index) => walk$1({
3496
+ if (node instanceof Array) node.forEach((item, index) => walk({
3506
3497
  key: index,
3507
3498
  node: item,
3508
3499
  parentPointer: pointer,
3509
- path: [...path$1, index]
3500
+ path: [...path, index]
3510
3501
  }));
3511
- else for (const [childKey, value] of Object.entries(node)) walk$1({
3502
+ else for (const [childKey, value] of Object.entries(node)) walk({
3512
3503
  key: childKey,
3513
3504
  node: value,
3514
3505
  parentPointer: pointer,
3515
- path: [...path$1, childKey]
3506
+ path: [...path, childKey]
3516
3507
  });
3517
3508
  };
3518
- walk$1({
3509
+ walk({
3519
3510
  key: null,
3520
3511
  node: root,
3521
3512
  parentPointer: null,
@@ -3526,31 +3517,31 @@ function buildGraph(root, logger) {
3526
3517
  subtreeDependencies: /* @__PURE__ */ new Map(),
3527
3518
  transitiveDependencies: /* @__PURE__ */ new Map()
3528
3519
  };
3529
- for (const [pointer, nodeInfo] of graph$1.nodes) {
3520
+ for (const [pointer, nodeInfo] of graph.nodes) {
3530
3521
  const parent = nodeInfo.parentPointer;
3531
3522
  if (!parent) continue;
3532
3523
  if (!cache.parentToChildren.has(parent)) cache.parentToChildren.set(parent, []);
3533
3524
  cache.parentToChildren.get(parent).push(pointer);
3534
3525
  }
3535
- for (const [pointerFrom, pointers] of graph$1.nodeDependencies) for (const pointerTo of pointers) {
3536
- if (!graph$1.reverseNodeDependencies.has(pointerTo)) graph$1.reverseNodeDependencies.set(pointerTo, /* @__PURE__ */ new Set());
3537
- graph$1.reverseNodeDependencies.get(pointerTo).add(pointerFrom);
3526
+ for (const [pointerFrom, pointers] of graph.nodeDependencies) for (const pointerTo of pointers) {
3527
+ if (!graph.reverseNodeDependencies.has(pointerTo)) graph.reverseNodeDependencies.set(pointerTo, /* @__PURE__ */ new Set());
3528
+ graph.reverseNodeDependencies.get(pointerTo).add(pointerFrom);
3538
3529
  }
3539
- seedLocalScopes(graph$1.nodes);
3540
- propagateScopes(graph$1);
3541
- annotateChildScopes(graph$1.nodes);
3542
- for (const pointer of graph$1.nodes.keys()) {
3530
+ seedLocalScopes(graph.nodes);
3531
+ propagateScopes(graph);
3532
+ annotateChildScopes(graph.nodes);
3533
+ for (const pointer of graph.nodes.keys()) {
3543
3534
  const result = collectPointerDependencies({
3544
3535
  cache,
3545
- graph: graph$1,
3536
+ graph,
3546
3537
  pointer,
3547
3538
  visited: /* @__PURE__ */ new Set()
3548
3539
  });
3549
- graph$1.transitiveDependencies.set(pointer, result.transitiveDependencies);
3550
- graph$1.subtreeDependencies.set(pointer, result.subtreeDependencies);
3540
+ graph.transitiveDependencies.set(pointer, result.transitiveDependencies);
3541
+ graph.subtreeDependencies.set(pointer, result.subtreeDependencies);
3551
3542
  }
3552
3543
  eventBuildGraph.timeEnd();
3553
- return { graph: graph$1 };
3544
+ return { graph };
3554
3545
  }
3555
3546
 
3556
3547
  //#endregion
@@ -3567,16 +3558,16 @@ const schemaKeys = new Set([
3567
3558
  "schema",
3568
3559
  "unevaluatedProperties"
3569
3560
  ]);
3570
- const getComponentContext = (path$1) => {
3571
- if (path$1.length === 3 && path$1[0] === "components") {
3572
- const type = path$1[1];
3561
+ const getComponentContext = (path) => {
3562
+ if (path.length === 3 && path[0] === "components") {
3563
+ const type = path[1];
3573
3564
  if (type === "parameters") return "write";
3574
3565
  if (type === "requestBodies") return "write";
3575
3566
  if (type === "responses") return "read";
3576
3567
  if (type === "headers") return "read";
3577
3568
  }
3578
- if (path$1.length === 2) {
3579
- const type = path$1[0];
3569
+ if (path.length === 2) {
3570
+ const type = path[0];
3580
3571
  if (type === "parameters") return "write";
3581
3572
  if (type === "responses") return "read";
3582
3573
  }
@@ -3621,10 +3612,10 @@ const insertSplitSchemasIntoSpec = ({ logger, spec, split }) => {
3621
3612
  * @param scope - The scope to exclude ('readOnly' or 'writeOnly')
3622
3613
  * @returns boolean - Whether the schema should be removed from its parent
3623
3614
  */
3624
- const pruneSchemaByScope = (graph$1, schema, scope) => {
3615
+ const pruneSchemaByScope = (graph, schema, scope) => {
3625
3616
  if (schema && typeof schema === "object") {
3626
3617
  if ("$ref" in schema && typeof schema.$ref === "string") {
3627
- const nodeInfo = graph$1.nodes.get(schema.$ref);
3618
+ const nodeInfo = graph.nodes.get(schema.$ref);
3628
3619
  if (nodeInfo?.scopes) {
3629
3620
  if (scope === "writeOnly" && nodeInfo.scopes.size === 1 && nodeInfo.scopes.has("write") || scope === "readOnly" && nodeInfo.scopes.size === 1 && nodeInfo.scopes.has("read")) {
3630
3621
  delete schema["$ref"];
@@ -3639,7 +3630,7 @@ const pruneSchemaByScope = (graph$1, schema, scope) => {
3639
3630
  for (let index = value.length - 1; index >= 0; index--) {
3640
3631
  const item = value[index];
3641
3632
  if (item && typeof item === "object" && item[scope] === true) value.splice(index, 1);
3642
- else if (pruneSchemaByScope(graph$1, item, scope)) value.splice(index, 1);
3633
+ else if (pruneSchemaByScope(graph, item, scope)) value.splice(index, 1);
3643
3634
  }
3644
3635
  if (!value.length) delete schema[keyword];
3645
3636
  } else if (type === "objectMap" && typeof value === "object" && value !== null && !(value instanceof Array)) {
@@ -3650,7 +3641,7 @@ const pruneSchemaByScope = (graph$1, schema, scope) => {
3650
3641
  if (prop && typeof prop === "object" && prop[scope] === true) {
3651
3642
  delete objMap[key];
3652
3643
  if (keyword === "properties") removedProperties.add(key);
3653
- } else if (pruneSchemaByScope(graph$1, prop, scope)) {
3644
+ } else if (pruneSchemaByScope(graph, prop, scope)) {
3654
3645
  delete objMap[key];
3655
3646
  if (keyword === "properties") removedProperties.add(key);
3656
3647
  }
@@ -3663,18 +3654,18 @@ const pruneSchemaByScope = (graph$1, schema, scope) => {
3663
3654
  if (!Object.keys(objMap).length) delete schema[keyword];
3664
3655
  } else if (type === "single" && typeof value === "object" && value !== null) {
3665
3656
  if (value[scope] === true) delete schema[keyword];
3666
- else if (pruneSchemaByScope(graph$1, value, scope)) delete schema[keyword];
3657
+ else if (pruneSchemaByScope(graph, value, scope)) delete schema[keyword];
3667
3658
  } else if (type === "singleOrArray") {
3668
3659
  if (value instanceof Array) {
3669
3660
  for (let index = value.length - 1; index >= 0; index--) {
3670
3661
  const item = value[index];
3671
3662
  if (item && typeof item === "object" && item[scope] === true) value.splice(index, 1);
3672
- else if (pruneSchemaByScope(graph$1, item, scope)) value.splice(index, 1);
3663
+ else if (pruneSchemaByScope(graph, item, scope)) value.splice(index, 1);
3673
3664
  }
3674
3665
  if (!value.length) delete schema[keyword];
3675
3666
  } else if (typeof value === "object" && value !== null) {
3676
3667
  if (value[scope] === true) delete schema[keyword];
3677
- else if (pruneSchemaByScope(graph$1, value, scope)) delete schema[keyword];
3668
+ else if (pruneSchemaByScope(graph, value, scope)) delete schema[keyword];
3678
3669
  }
3679
3670
  }
3680
3671
  }
@@ -3694,8 +3685,8 @@ const removeOriginalSplitSchemas = ({ logger, originalSchemas, spec, split }) =>
3694
3685
  const event = logger.timeEvent("remove-original-split-schemas");
3695
3686
  const schemasObj = getSchemasObject(spec);
3696
3687
  for (const originalPointer of Object.keys(split.mapping)) {
3697
- const path$1 = jsonPointerToPath(originalPointer);
3698
- const name = path$1[path$1.length - 1];
3688
+ const path = jsonPointerToPath(originalPointer);
3689
+ const name = path[path.length - 1];
3699
3690
  if (typeof name === "string" && schemasObj && Object.prototype.hasOwnProperty.call(schemasObj, name) && schemasObj[name] === originalSchemas[originalPointer]) delete schemasObj[name];
3700
3691
  }
3701
3692
  event.timeEnd();
@@ -3795,7 +3786,7 @@ function splitDiscriminatorSchemas({ config, existingNames, schemasPointerNamesp
3795
3786
  * @param spec - The OpenAPI spec object
3796
3787
  * @returns SplitSchemas - The split schemas and pointer mappings
3797
3788
  */
3798
- const splitSchemas = ({ config, graph: graph$1, logger, spec }) => {
3789
+ const splitSchemas = ({ config, graph, logger, spec }) => {
3799
3790
  const event = logger.timeEvent("split-schemas");
3800
3791
  const existingNames = /* @__PURE__ */ new Set();
3801
3792
  const split = {
@@ -3813,20 +3804,20 @@ const splitSchemas = ({ config, graph: graph$1, logger, spec }) => {
3813
3804
  */
3814
3805
  const pointerToSchema = (pointer) => {
3815
3806
  if (pointer.startsWith(schemasPointerNamespace)) {
3816
- const path$1 = jsonPointerToPath(pointer);
3817
- if (path$1.length === schemasNamespaceSegments) return path$1[schemasNamespaceSegments - 1] || "";
3807
+ const path = jsonPointerToPath(pointer);
3808
+ if (path.length === schemasNamespaceSegments) return path[schemasNamespaceSegments - 1] || "";
3818
3809
  }
3819
3810
  return "";
3820
3811
  };
3821
- for (const pointer of graph$1.nodes.keys()) {
3812
+ for (const pointer of graph.nodes.keys()) {
3822
3813
  const name = pointerToSchema(pointer);
3823
3814
  if (name) existingNames.add(name);
3824
3815
  }
3825
- for (const [pointer, nodeInfo] of graph$1.nodes) {
3816
+ for (const [pointer, nodeInfo] of graph.nodes) {
3826
3817
  const name = pointerToSchema(pointer);
3827
3818
  if (!name || !(nodeInfo.scopes?.has("read") || nodeInfo.scopes?.has("write")) || !nodeInfo.scopes?.has("normal")) continue;
3828
3819
  const readSchema = deepClone(nodeInfo.node);
3829
- pruneSchemaByScope(graph$1, readSchema, "writeOnly");
3820
+ pruneSchemaByScope(graph, readSchema, "writeOnly");
3830
3821
  const readBase = applyNaming(name, config.responses);
3831
3822
  const readName = readBase === name ? readBase : getUniqueComponentName({
3832
3823
  base: readBase,
@@ -3836,12 +3827,12 @@ const splitSchemas = ({ config, graph: graph$1, logger, spec }) => {
3836
3827
  split.schemas[readName] = readSchema;
3837
3828
  const readPointer = `${schemasPointerNamespace}${readName}`;
3838
3829
  const writeSchema = deepClone(nodeInfo.node);
3839
- pruneSchemaByScope(graph$1, writeSchema, "readOnly");
3840
- const transitiveDeps = graph$1.transitiveDependencies.get(pointer) || /* @__PURE__ */ new Set();
3830
+ pruneSchemaByScope(graph, writeSchema, "readOnly");
3831
+ const transitiveDeps = graph.transitiveDependencies.get(pointer) || /* @__PURE__ */ new Set();
3841
3832
  if (!Array.from(transitiveDeps).some((depPointer) => {
3842
- const depNodeInfo = graph$1.nodes.get(depPointer);
3833
+ const depNodeInfo = graph.nodes.get(depPointer);
3843
3834
  return depNodeInfo?.scopes?.has("normal") && (depNodeInfo.scopes.has("read") || depNodeInfo.scopes.has("write"));
3844
- }) && deepEqual_default(readSchema, writeSchema) && deepEqual_default(readSchema, nodeInfo.node)) continue;
3835
+ }) && deepEqual(readSchema, writeSchema) && deepEqual(readSchema, nodeInfo.node)) continue;
3845
3836
  const writeBase = applyNaming(name, config.requests);
3846
3837
  const writeName = writeBase === name && writeBase !== readName ? writeBase : getUniqueComponentName({
3847
3838
  base: writeBase,
@@ -3877,20 +3868,20 @@ const splitSchemas = ({ config, graph: graph$1, logger, spec }) => {
3877
3868
  const updateRefsInSpec = ({ logger, spec, split }) => {
3878
3869
  const event = logger.timeEvent("update-refs-in-spec");
3879
3870
  const schemasPointerNamespace = specToSchemasPointerNamespace(spec);
3880
- const walk$1 = ({ context, currentPointer, inSchema, node, path: path$1, visited = /* @__PURE__ */ new Set() }) => {
3881
- if (node instanceof Array) node.forEach((item, index) => walk$1({
3871
+ const walk = ({ context, currentPointer, inSchema, node, path, visited = /* @__PURE__ */ new Set() }) => {
3872
+ if (node instanceof Array) node.forEach((item, index) => walk({
3882
3873
  context,
3883
3874
  currentPointer,
3884
3875
  inSchema,
3885
3876
  node: item,
3886
- path: [...path$1, index],
3877
+ path: [...path, index],
3887
3878
  visited
3888
3879
  }));
3889
3880
  else if (node && typeof node === "object") {
3890
3881
  let nextPointer = currentPointer;
3891
3882
  let nextContext = context;
3892
- if (isPathRootSchema(path$1)) {
3893
- nextPointer = `${schemasPointerNamespace}${path$1[path$1.length - 1]}`;
3883
+ if (isPathRootSchema(path)) {
3884
+ nextPointer = `${schemasPointerNamespace}${path[path.length - 1]}`;
3894
3885
  const originalPointer = split.reverseMapping[nextPointer];
3895
3886
  if (originalPointer) {
3896
3887
  const mapping = split.mapping[originalPointer];
@@ -3898,16 +3889,16 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
3898
3889
  else if (mapping?.write === nextPointer) nextContext = "write";
3899
3890
  }
3900
3891
  }
3901
- const compContext = getComponentContext(path$1);
3892
+ const compContext = getComponentContext(path);
3902
3893
  if (compContext !== void 0) {
3903
3894
  for (const key in node) {
3904
3895
  if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
3905
- walk$1({
3896
+ walk({
3906
3897
  context: compContext,
3907
3898
  currentPointer: nextPointer,
3908
3899
  inSchema: false,
3909
3900
  node: node[key],
3910
- path: [...path$1, key],
3901
+ path: [...path, key],
3911
3902
  visited
3912
3903
  });
3913
3904
  }
@@ -3918,49 +3909,49 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
3918
3909
  const value = node[key];
3919
3910
  if (!inSchema) {
3920
3911
  if (key === "requestBody") {
3921
- walk$1({
3912
+ walk({
3922
3913
  context: "write",
3923
3914
  currentPointer: nextPointer,
3924
3915
  inSchema: false,
3925
3916
  node: value,
3926
- path: [...path$1, key],
3917
+ path: [...path, key],
3927
3918
  visited
3928
3919
  });
3929
3920
  continue;
3930
3921
  }
3931
3922
  if (key === "responses") {
3932
- walk$1({
3923
+ walk({
3933
3924
  context: "read",
3934
3925
  currentPointer: nextPointer,
3935
3926
  inSchema: false,
3936
3927
  node: value,
3937
- path: [...path$1, key],
3928
+ path: [...path, key],
3938
3929
  visited
3939
3930
  });
3940
3931
  continue;
3941
3932
  }
3942
3933
  if (key === "parameters" && Array.isArray(value)) {
3943
3934
  value.forEach((param, index) => {
3944
- if (param && typeof param === "object" && "schema" in param) walk$1({
3935
+ if (param && typeof param === "object" && "schema" in param) walk({
3945
3936
  context: "write",
3946
3937
  currentPointer: nextPointer,
3947
3938
  inSchema: true,
3948
3939
  node: param.schema,
3949
3940
  path: [
3950
- ...path$1,
3941
+ ...path,
3951
3942
  key,
3952
3943
  index,
3953
3944
  "schema"
3954
3945
  ],
3955
3946
  visited
3956
3947
  });
3957
- if (param && typeof param === "object" && "content" in param) walk$1({
3948
+ if (param && typeof param === "object" && "content" in param) walk({
3958
3949
  context: "write",
3959
3950
  currentPointer: nextPointer,
3960
3951
  inSchema: false,
3961
3952
  node: param.content,
3962
3953
  path: [
3963
- ...path$1,
3954
+ ...path,
3964
3955
  key,
3965
3956
  index,
3966
3957
  "content"
@@ -3973,13 +3964,13 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
3973
3964
  if (key === "headers" && typeof value === "object" && value !== null) {
3974
3965
  for (const headerKey in value) {
3975
3966
  if (!Object.prototype.hasOwnProperty.call(value, headerKey)) continue;
3976
- walk$1({
3967
+ walk({
3977
3968
  context: "read",
3978
3969
  currentPointer: nextPointer,
3979
3970
  inSchema: false,
3980
3971
  node: value[headerKey],
3981
3972
  path: [
3982
- ...path$1,
3973
+ ...path,
3983
3974
  key,
3984
3975
  headerKey
3985
3976
  ],
@@ -3989,12 +3980,12 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
3989
3980
  continue;
3990
3981
  }
3991
3982
  }
3992
- if (schemaKeys.has(key)) walk$1({
3983
+ if (schemaKeys.has(key)) walk({
3993
3984
  context: nextContext,
3994
3985
  currentPointer: nextPointer,
3995
3986
  inSchema: true,
3996
3987
  node: value,
3997
- path: [...path$1, key],
3988
+ path: [...path, key],
3998
3989
  visited
3999
3990
  });
4000
3991
  else if (key === "$ref" && typeof value === "string") {
@@ -4016,26 +4007,26 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
4016
4007
  }
4017
4008
  value.mapping = updatedMapping;
4018
4009
  }
4019
- walk$1({
4010
+ walk({
4020
4011
  context: nextContext,
4021
4012
  currentPointer: nextPointer,
4022
4013
  inSchema,
4023
4014
  node: value,
4024
- path: [...path$1, key],
4015
+ path: [...path, key],
4025
4016
  visited
4026
4017
  });
4027
- } else walk$1({
4018
+ } else walk({
4028
4019
  context: nextContext,
4029
4020
  currentPointer: nextPointer,
4030
4021
  inSchema,
4031
4022
  node: value,
4032
- path: [...path$1, key],
4023
+ path: [...path, key],
4033
4024
  visited
4034
4025
  });
4035
4026
  }
4036
4027
  }
4037
4028
  };
4038
- walk$1({
4029
+ walk({
4039
4030
  context: null,
4040
4031
  currentPointer: null,
4041
4032
  inSchema: false,
@@ -4056,11 +4047,11 @@ const updateRefsInSpec = ({ logger, spec, split }) => {
4056
4047
  * @param spec - The OpenAPI spec object
4057
4048
  */
4058
4049
  const readWriteTransform = ({ config, logger, spec }) => {
4059
- const { graph: graph$1 } = buildGraph(spec, logger);
4050
+ const { graph } = buildGraph(spec, logger);
4060
4051
  const originalSchemas = captureOriginalSchemas(spec, logger);
4061
4052
  const split = splitSchemas({
4062
4053
  config,
4063
- graph: graph$1,
4054
+ graph,
4064
4055
  logger,
4065
4056
  spec
4066
4057
  });
@@ -4178,7 +4169,7 @@ const mergeParametersObjects = ({ source, target }) => {
4178
4169
  //#endregion
4179
4170
  //#region src/openApi/shared/utils/validator.ts
4180
4171
  const isSimpleKey = (key) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
4181
- const formatPath = (path$1) => path$1.map((segment, i) => {
4172
+ const formatPath = (path) => path.map((segment, i) => {
4182
4173
  if (typeof segment === "number") return `[${segment}]`;
4183
4174
  if (i === 0) return segment;
4184
4175
  return isSimpleKey(segment) ? `.${segment}` : `['${segment.replace(/"/g, "\\'")}']`;
@@ -4221,17 +4212,17 @@ const filterSpec$2 = ({ logger, operations, preserveOrder, schemas, spec }) => {
4221
4212
  spec.definitions = filtered;
4222
4213
  }
4223
4214
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
4224
- const path$1 = entry[0];
4215
+ const path = entry[0];
4225
4216
  const pathItem = entry[1];
4226
4217
  for (const method of httpMethods) {
4227
4218
  if (!pathItem[method]) continue;
4228
4219
  const key = addNamespace("operation", createOperationKey({
4229
4220
  method,
4230
- path: path$1
4221
+ path
4231
4222
  }));
4232
4223
  if (!operations.has(key)) delete pathItem[method];
4233
4224
  }
4234
- if (!Object.keys(pathItem).length) delete spec.paths[path$1];
4225
+ if (!Object.keys(pathItem).length) delete spec.paths[path];
4235
4226
  }
4236
4227
  eventFilterSpec.timeEnd();
4237
4228
  };
@@ -4487,20 +4478,20 @@ const parseAllOf$2 = ({ context, schema, state }) => {
4487
4478
  else irCompositionSchema.required = schema.required;
4488
4479
  schemaItems.push(irCompositionSchema);
4489
4480
  if (compositionSchema.$ref) {
4490
- const ref$1 = context.resolveRef(compositionSchema.$ref);
4491
- if (ref$1.discriminator && state.$ref) {
4481
+ const ref = context.resolveRef(compositionSchema.$ref);
4482
+ if (ref.discriminator && state.$ref) {
4492
4483
  const valueSchemas = discriminatorValues(state.$ref).map((value) => ({
4493
4484
  const: value,
4494
4485
  type: "string"
4495
4486
  }));
4496
4487
  const irDiscriminatorSchema = {
4497
- properties: { [ref$1.discriminator]: valueSchemas.length > 1 ? {
4488
+ properties: { [ref.discriminator]: valueSchemas.length > 1 ? {
4498
4489
  items: valueSchemas,
4499
4490
  logicalOperator: "or"
4500
4491
  } : valueSchemas[0] },
4501
4492
  type: "object"
4502
4493
  };
4503
- if (ref$1.required?.includes(ref$1.discriminator)) irDiscriminatorSchema.required = [ref$1.discriminator];
4494
+ if (ref.required?.includes(ref.discriminator)) irDiscriminatorSchema.required = [ref.discriminator];
4504
4495
  schemaItems.push(irDiscriminatorSchema);
4505
4496
  }
4506
4497
  }
@@ -4593,13 +4584,13 @@ const parseRef$2 = ({ context, schema, state }) => {
4593
4584
  const refSchema = context.resolveRef(schema.$ref);
4594
4585
  const originalRef = state.$ref;
4595
4586
  state.$ref = schema.$ref;
4596
- const irSchema$1 = schemaToIrSchema$2({
4587
+ const irSchema = schemaToIrSchema$2({
4597
4588
  context,
4598
4589
  schema: refSchema,
4599
4590
  state
4600
4591
  });
4601
4592
  state.$ref = originalRef;
4602
- return irSchema$1;
4593
+ return irSchema;
4603
4594
  }
4604
4595
  }
4605
4596
  irSchema.$ref = decodeURI(schema.$ref);
@@ -4766,19 +4757,19 @@ const isPaginationType$2 = (schemaType) => schemaType === "boolean" || schemaTyp
4766
4757
  const paginationField$2 = ({ context, name, schema }) => {
4767
4758
  if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) return true;
4768
4759
  if ("$ref" in schema) {
4769
- const ref$1 = context.resolveRef(schema.$ref ?? "");
4770
- if ("in" in ref$1 && ref$1.in) return paginationField$2({
4760
+ const ref = context.resolveRef(schema.$ref ?? "");
4761
+ if ("in" in ref && ref.in) return paginationField$2({
4771
4762
  context,
4772
4763
  name,
4773
- schema: "schema" in ref$1 ? ref$1.schema : {
4774
- ...ref$1,
4764
+ schema: "schema" in ref ? ref.schema : {
4765
+ ...ref,
4775
4766
  in: void 0
4776
4767
  }
4777
4768
  });
4778
4769
  return paginationField$2({
4779
4770
  context,
4780
4771
  name,
4781
- schema: ref$1
4772
+ schema: ref
4782
4773
  });
4783
4774
  }
4784
4775
  if ("in" in schema) {
@@ -4792,10 +4783,10 @@ const paginationField$2 = ({ context, name, schema }) => {
4792
4783
  }
4793
4784
  });
4794
4785
  }
4795
- for (const name$1 in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name$1)) {
4796
- const property = schema.properties[name$1];
4786
+ for (const name in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) {
4787
+ const property = schema.properties[name];
4797
4788
  if (typeof property !== "boolean" && !("$ref" in property)) {
4798
- if (isPaginationType$2(getSchemaType$1({ schema: property }))) return name$1;
4789
+ if (isPaginationType$2(getSchemaType$1({ schema: property }))) return name;
4799
4790
  }
4800
4791
  }
4801
4792
  for (const allOf of schema.allOf ?? []) {
@@ -4817,17 +4808,17 @@ const parseOperationJsDoc$2 = ({ irOperation, operation }) => {
4817
4808
  if (operation.summary) irOperation.summary = operation.summary;
4818
4809
  if (operation.tags?.length) irOperation.tags = operation.tags;
4819
4810
  };
4820
- const initIrOperation$2 = ({ context, method, operation, path: path$1, state }) => {
4811
+ const initIrOperation$2 = ({ context, method, operation, path, state }) => {
4821
4812
  const irOperation = {
4822
4813
  id: operationToId({
4823
4814
  context,
4824
4815
  id: operation.operationId,
4825
4816
  method,
4826
- path: path$1,
4817
+ path,
4827
4818
  state
4828
4819
  }),
4829
4820
  method,
4830
- path: path$1
4821
+ path
4831
4822
  };
4832
4823
  if (operation.operationId) irOperation.operationId = operation.operationId;
4833
4824
  parseOperationJsDoc$2({
@@ -4840,12 +4831,12 @@ const initIrOperation$2 = ({ context, method, operation, path: path$1, state })
4840
4831
  });
4841
4832
  return irOperation;
4842
4833
  };
4843
- const operationToIrOperation$2 = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
4834
+ const operationToIrOperation$2 = ({ context, method, operation, path, securitySchemesMap, state }) => {
4844
4835
  const irOperation = initIrOperation$2({
4845
4836
  context,
4846
4837
  method,
4847
4838
  operation,
4848
- path: path$1,
4839
+ path,
4849
4840
  state
4850
4841
  });
4851
4842
  if (operation.parameters) irOperation.parameters = operation.parameters;
@@ -4876,7 +4867,7 @@ const operationToIrOperation$2 = ({ context, method, operation, path: path$1, se
4876
4867
  mimeTypes,
4877
4868
  response: { schema }
4878
4869
  });
4879
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
4870
+ const content = contents.find((content) => content.type === "json") || contents[0];
4880
4871
  if (content) {
4881
4872
  const pagination = paginationField$2({
4882
4873
  context,
@@ -4932,7 +4923,7 @@ const operationToIrOperation$2 = ({ context, method, operation, path: path$1, se
4932
4923
  mimeTypes: operation.produces ? operation.produces : ["application/json"],
4933
4924
  response: responseObject
4934
4925
  });
4935
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
4926
+ const content = contents.find((content) => content.type === "json") || contents[0];
4936
4927
  if (content) irOperation.responses[name] = {
4937
4928
  mediaType: content.mediaType,
4938
4929
  schema: schemaToIrSchema$2({
@@ -5002,14 +4993,14 @@ const operationToIrOperation$2 = ({ context, method, operation, path: path$1, se
5002
4993
  }
5003
4994
  return irOperation;
5004
4995
  };
5005
- const parsePathOperation$2 = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
4996
+ const parsePathOperation$2 = ({ context, method, operation, path, securitySchemesMap, state }) => {
5006
4997
  if (!context.ir.paths) context.ir.paths = {};
5007
- if (!context.ir.paths[path$1]) context.ir.paths[path$1] = {};
5008
- context.ir.paths[path$1][method] = operationToIrOperation$2({
4998
+ if (!context.ir.paths[path]) context.ir.paths[path] = {};
4999
+ context.ir.paths[path][method] = operationToIrOperation$2({
5009
5000
  context,
5010
5001
  method,
5011
5002
  operation,
5012
- path: path$1,
5003
+ path,
5013
5004
  securitySchemesMap,
5014
5005
  state
5015
5006
  });
@@ -5023,10 +5014,6 @@ const parsePathOperation$2 = ({ context, method, operation, path: path$1, securi
5023
5014
  const defaultExplode$2 = (collectionFormat) => {
5024
5015
  switch (collectionFormat) {
5025
5016
  case "multi": return true;
5026
- case "csv":
5027
- case "pipes":
5028
- case "ssv":
5029
- case "tsv":
5030
5017
  default: return false;
5031
5018
  }
5032
5019
  };
@@ -5037,7 +5024,6 @@ const defaultStyle$2 = (_in) => {
5037
5024
  switch (_in) {
5038
5025
  case "header":
5039
5026
  case "path": return "simple";
5040
- case "query":
5041
5027
  default: return "form";
5042
5028
  }
5043
5029
  };
@@ -5122,12 +5108,12 @@ function parseUrl(value) {
5122
5108
  if (!match) return errorResponse;
5123
5109
  const host = match[5] || "";
5124
5110
  if (host === "." || host === "..") return errorResponse;
5125
- const path$1 = match[8] || "";
5111
+ const path = match[8] || "";
5126
5112
  const protocol = match[2] || "";
5127
5113
  if (protocol.length === 1) return errorResponse;
5128
5114
  return {
5129
5115
  host,
5130
- path: path$1 === "/" ? "" : path$1,
5116
+ path: path === "/" ? "" : path,
5131
5117
  port: match[7] || "",
5132
5118
  protocol
5133
5119
  };
@@ -5138,7 +5124,7 @@ function parseUrl(value) {
5138
5124
  const parseServers$2 = ({ context }) => {
5139
5125
  let schemes = context.spec.schemes ?? [];
5140
5126
  let host = context.spec.host ?? "";
5141
- const path$1 = context.spec.basePath ?? "";
5127
+ const path = context.spec.basePath ?? "";
5142
5128
  for (const input of context.config.input) if (typeof input.path === "string") {
5143
5129
  const url = parseUrl(input.path);
5144
5130
  if (!schemes.length) {
@@ -5147,7 +5133,7 @@ const parseServers$2 = ({ context }) => {
5147
5133
  if (!host) host = `${url.host}${url.port ? `:${url.port}` : ""}`;
5148
5134
  }
5149
5135
  if (!schemes.length) schemes = [""];
5150
- const servers = schemes.map((scheme) => `${scheme ? `${scheme}://` : ""}${host}${path$1}`).filter(Boolean);
5136
+ const servers = schemes.map((scheme) => `${scheme ? `${scheme}://` : ""}${host}${path}`).filter(Boolean);
5151
5137
  if (servers.length) context.ir.servers = servers.map((url) => ({ url }));
5152
5138
  };
5153
5139
 
@@ -5158,7 +5144,7 @@ const validateOpenApiSpec$2 = (spec, logger) => {
5158
5144
  const issues = [];
5159
5145
  const operationIds = /* @__PURE__ */ new Map();
5160
5146
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
5161
- const path$1 = entry[0];
5147
+ const path = entry[0];
5162
5148
  const pathItem = entry[1];
5163
5149
  for (const method of httpMethods) {
5164
5150
  if (method === "trace") continue;
@@ -5166,7 +5152,7 @@ const validateOpenApiSpec$2 = (spec, logger) => {
5166
5152
  if (!operation) continue;
5167
5153
  const operationKey = createOperationKey({
5168
5154
  method,
5169
- path: path$1
5155
+ path
5170
5156
  });
5171
5157
  if (operation.operationId) if (!operationIds.has(operation.operationId)) operationIds.set(operation.operationId, operationKey);
5172
5158
  else issues.push({
@@ -5178,7 +5164,7 @@ const validateOpenApiSpec$2 = (spec, logger) => {
5178
5164
  message: "Duplicate `operationId` found. Each `operationId` must be unique.",
5179
5165
  path: [
5180
5166
  "paths",
5181
- path$1,
5167
+ path,
5182
5168
  method,
5183
5169
  "operationId"
5184
5170
  ],
@@ -5202,8 +5188,8 @@ const parseV2_0_X = (context) => {
5202
5188
  });
5203
5189
  if (hasFilters(context.config.parser.filters)) {
5204
5190
  const filters = createFilters(context.config.parser.filters, context.spec, context.logger);
5205
- const { graph: graph$1 } = buildGraph(context.spec, context.logger);
5206
- const { resourceMetadata } = buildResourceMetadata(graph$1, context.logger);
5191
+ const { graph } = buildGraph(context.spec, context.logger);
5192
+ const { resourceMetadata } = buildResourceMetadata(graph, context.logger);
5207
5193
  filterSpec$2({
5208
5194
  ...createFilteredDependencies({
5209
5195
  filters,
@@ -5232,9 +5218,9 @@ const parseV2_0_X = (context) => {
5232
5218
  });
5233
5219
  }
5234
5220
  parseServers$2({ context });
5235
- for (const path$1 in context.spec.paths) {
5236
- if (path$1.startsWith("x-")) continue;
5237
- const pathItem = context.spec.paths[path$1];
5221
+ for (const path in context.spec.paths) {
5222
+ if (path.startsWith("x-")) continue;
5223
+ const pathItem = context.spec.paths[path];
5238
5224
  const finalPathItem = pathItem.$ref ? {
5239
5225
  ...context.resolveRef(pathItem.$ref),
5240
5226
  ...pathItem
@@ -5255,7 +5241,7 @@ const parseV2_0_X = (context) => {
5255
5241
  parameters: finalPathItem.parameters
5256
5242
  })
5257
5243
  },
5258
- path: path$1,
5244
+ path,
5259
5245
  securitySchemesMap,
5260
5246
  state
5261
5247
  };
@@ -5449,17 +5435,17 @@ const filterSpec$1 = ({ logger, operations, parameters, preserveOrder, requestBo
5449
5435
  }
5450
5436
  }
5451
5437
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
5452
- const path$1 = entry[0];
5438
+ const path = entry[0];
5453
5439
  const pathItem = entry[1];
5454
5440
  for (const method of httpMethods) {
5455
5441
  if (!pathItem[method]) continue;
5456
5442
  const key = addNamespace("operation", createOperationKey({
5457
5443
  method,
5458
- path: path$1
5444
+ path
5459
5445
  }));
5460
5446
  if (!operations.has(key)) delete pathItem[method];
5461
5447
  }
5462
- if (!Object.keys(pathItem).length) delete spec.paths[path$1];
5448
+ if (!Object.keys(pathItem).length) delete spec.paths[path];
5463
5449
  }
5464
5450
  eventFilterSpec.timeEnd();
5465
5451
  };
@@ -5673,11 +5659,11 @@ const parseAllOf$1 = ({ context, schema, state }) => {
5673
5659
  else irCompositionSchema.required = schema.required;
5674
5660
  schemaItems.push(irCompositionSchema);
5675
5661
  if ("$ref" in compositionSchema) {
5676
- const ref$1 = context.resolveRef(compositionSchema.$ref);
5662
+ const ref = context.resolveRef(compositionSchema.$ref);
5677
5663
  if (state.$ref) {
5678
5664
  const discriminators = findDiscriminatorsInSchema$1({
5679
5665
  context,
5680
- schema: ref$1
5666
+ schema: ref
5681
5667
  });
5682
5668
  for (const { discriminator, oneOf } of discriminators) {
5683
5669
  const values = discriminatorValues(state.$ref, discriminator.mapping, oneOf ? () => oneOf.some((o) => "$ref" in o && o.$ref === state.$ref) : void 0);
@@ -5686,7 +5672,7 @@ const parseAllOf$1 = ({ context, schema, state }) => {
5686
5672
  const existingIndex = discriminatorsToAdd.findIndex((d) => d.discriminator.propertyName === discriminator.propertyName);
5687
5673
  if (existingIndex !== -1) if (isExplicitMapping && !discriminatorsToAdd[existingIndex].isExplicitMapping) discriminatorsToAdd.splice(existingIndex, 1);
5688
5674
  else continue;
5689
- const isRequired = discriminators.some((d) => d.discriminator.propertyName === discriminator.propertyName && (ref$1.required?.includes(d.discriminator.propertyName) || ref$1.allOf && ref$1.allOf.some((item) => {
5675
+ const isRequired = discriminators.some((d) => d.discriminator.propertyName === discriminator.propertyName && (ref.required?.includes(d.discriminator.propertyName) || ref.allOf && ref.allOf.some((item) => {
5690
5676
  return ("$ref" in item ? context.resolveRef(item.$ref) : item).required?.includes(d.discriminator.propertyName);
5691
5677
  })));
5692
5678
  discriminatorsToAdd.push({
@@ -5950,13 +5936,13 @@ const parseRef$1 = ({ context, schema, state }) => {
5950
5936
  const refSchema = context.resolveRef(schema.$ref);
5951
5937
  const originalRef = state.$ref;
5952
5938
  state.$ref = schema.$ref;
5953
- const irSchema$1 = schemaToIrSchema$1({
5939
+ const irSchema = schemaToIrSchema$1({
5954
5940
  context,
5955
5941
  schema: refSchema,
5956
5942
  state
5957
5943
  });
5958
5944
  state.$ref = originalRef;
5959
- return irSchema$1;
5945
+ return irSchema;
5960
5946
  }
5961
5947
  }
5962
5948
  const irSchema = {};
@@ -6133,13 +6119,13 @@ const isPaginationType$1 = (schemaType) => schemaType === "boolean" || schemaTyp
6133
6119
  const paginationField$1 = ({ context, name, schema }) => {
6134
6120
  if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) return true;
6135
6121
  if ("$ref" in schema) {
6136
- const ref$1 = context.resolveRef(schema.$ref);
6137
- if ("content" in ref$1 || "in" in ref$1) {
6122
+ const ref = context.resolveRef(schema.$ref);
6123
+ if ("content" in ref || "in" in ref) {
6138
6124
  let refSchema;
6139
- if ("in" in ref$1) refSchema = ref$1.schema;
6125
+ if ("in" in ref) refSchema = ref.schema;
6140
6126
  if (!refSchema) {
6141
- const contents = mediaTypeObjects$1({ content: ref$1.content });
6142
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
6127
+ const contents = mediaTypeObjects$1({ content: ref.content });
6128
+ const content = contents.find((content) => content.type === "json") || contents[0];
6143
6129
  if (content?.schema) refSchema = content.schema;
6144
6130
  }
6145
6131
  if (!refSchema) return false;
@@ -6152,13 +6138,13 @@ const paginationField$1 = ({ context, name, schema }) => {
6152
6138
  return paginationField$1({
6153
6139
  context,
6154
6140
  name,
6155
- schema: ref$1
6141
+ schema: ref
6156
6142
  });
6157
6143
  }
6158
- for (const name$1 in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name$1)) {
6159
- const property = schema.properties[name$1];
6144
+ for (const name in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) {
6145
+ const property = schema.properties[name];
6160
6146
  if (typeof property !== "boolean" && !("$ref" in property)) {
6161
- if (isPaginationType$1(getSchemaType({ schema: property }))) return name$1;
6147
+ if (isPaginationType$1(getSchemaType({ schema: property }))) return name;
6162
6148
  }
6163
6149
  }
6164
6150
  for (const allOf of schema.allOf ?? []) {
@@ -6180,17 +6166,17 @@ const parseOperationJsDoc$1 = ({ irOperation, operation }) => {
6180
6166
  if (operation.summary) irOperation.summary = operation.summary;
6181
6167
  if (operation.tags?.length) irOperation.tags = operation.tags;
6182
6168
  };
6183
- const initIrOperation$1 = ({ context, method, operation, path: path$1, state }) => {
6169
+ const initIrOperation$1 = ({ context, method, operation, path, state }) => {
6184
6170
  const irOperation = {
6185
6171
  id: operationToId({
6186
6172
  context,
6187
6173
  id: operation.operationId,
6188
6174
  method,
6189
- path: path$1,
6175
+ path,
6190
6176
  state
6191
6177
  }),
6192
6178
  method,
6193
- path: path$1
6179
+ path
6194
6180
  };
6195
6181
  if (operation.operationId) irOperation.operationId = operation.operationId;
6196
6182
  parseOperationJsDoc$1({
@@ -6203,19 +6189,19 @@ const initIrOperation$1 = ({ context, method, operation, path: path$1, state })
6203
6189
  });
6204
6190
  return irOperation;
6205
6191
  };
6206
- const operationToIrOperation$1 = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
6192
+ const operationToIrOperation$1 = ({ context, method, operation, path, securitySchemesMap, state }) => {
6207
6193
  const irOperation = initIrOperation$1({
6208
6194
  context,
6209
6195
  method,
6210
6196
  operation,
6211
- path: path$1,
6197
+ path,
6212
6198
  state
6213
6199
  });
6214
6200
  if (operation.parameters) irOperation.parameters = operation.parameters;
6215
6201
  if (operation.requestBody) {
6216
6202
  const requestBody = "$ref" in operation.requestBody ? context.resolveRef(operation.requestBody.$ref) : operation.requestBody;
6217
6203
  const contents = mediaTypeObjects$1({ content: requestBody.content });
6218
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
6204
+ const content = contents.find((content) => content.type === "json") || contents[0];
6219
6205
  if (content) {
6220
6206
  const pagination = paginationField$1({
6221
6207
  context,
@@ -6256,7 +6242,7 @@ const operationToIrOperation$1 = ({ context, method, operation, path: path$1, se
6256
6242
  const response = operation.responses[name];
6257
6243
  const responseObject = "$ref" in response ? context.resolveRef(response.$ref) : response;
6258
6244
  const contents = mediaTypeObjects$1({ content: responseObject.content });
6259
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
6245
+ const content = contents.find((content) => content.type === "json") || contents[0];
6260
6246
  if (content) irOperation.responses[name] = {
6261
6247
  mediaType: content.mediaType,
6262
6248
  schema: schemaToIrSchema$1({
@@ -6284,15 +6270,15 @@ const operationToIrOperation$1 = ({ context, method, operation, path: path$1, se
6284
6270
  }
6285
6271
  return irOperation;
6286
6272
  };
6287
- const parsePathOperation$1 = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
6273
+ const parsePathOperation$1 = ({ context, method, operation, path, securitySchemesMap, state }) => {
6288
6274
  if (!context.ir.paths) context.ir.paths = {};
6289
- if (!context.ir.paths[path$1]) context.ir.paths[path$1] = {};
6275
+ if (!context.ir.paths[path]) context.ir.paths[path] = {};
6290
6276
  if (operation.servers) context.ir.servers = [...context.ir.servers ?? [], ...operation.servers];
6291
- context.ir.paths[path$1][method] = operationToIrOperation$1({
6277
+ context.ir.paths[path][method] = operationToIrOperation$1({
6292
6278
  context,
6293
6279
  method,
6294
6280
  operation,
6295
- path: path$1,
6281
+ path,
6296
6282
  securitySchemesMap,
6297
6283
  state
6298
6284
  });
@@ -6348,7 +6334,7 @@ const parameterToIrParameter$1 = ({ $ref, context, parameter }) => {
6348
6334
  let schema = parameter.schema;
6349
6335
  if (!schema) {
6350
6336
  const contents = mediaTypeObjects$1({ content: parameter.content });
6351
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
6337
+ const content = contents.find((content) => content.type === "json") || contents[0];
6352
6338
  if (content) schema = content.schema;
6353
6339
  }
6354
6340
  const finalSchema = schema && "$ref" in schema ? {
@@ -6406,7 +6392,7 @@ const parseParameter$1 = ({ $ref, context, parameter }) => {
6406
6392
  //#region src/openApi/3.0.x/parser/requestBody.ts
6407
6393
  const requestBodyToIrRequestBody$1 = ({ $ref, context, requestBody }) => {
6408
6394
  const contents = mediaTypeObjects$1({ content: requestBody.content });
6409
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
6395
+ const content = contents.find((content) => content.type === "json") || contents[0];
6410
6396
  const schema = content ? content.schema : void 0;
6411
6397
  const irRequestBody = { schema: schemaToIrSchema$1({
6412
6398
  context,
@@ -6454,14 +6440,14 @@ const validateOpenApiSpec$1 = (spec, logger) => {
6454
6440
  const issues = [];
6455
6441
  const operationIds = /* @__PURE__ */ new Map();
6456
6442
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
6457
- const path$1 = entry[0];
6443
+ const path = entry[0];
6458
6444
  const pathItem = entry[1];
6459
6445
  for (const method of httpMethods) {
6460
6446
  const operation = pathItem[method];
6461
6447
  if (!operation) continue;
6462
6448
  const operationKey = createOperationKey({
6463
6449
  method,
6464
- path: path$1
6450
+ path
6465
6451
  });
6466
6452
  if (operation.operationId) if (!operationIds.has(operation.operationId)) operationIds.set(operation.operationId, operationKey);
6467
6453
  else issues.push({
@@ -6473,7 +6459,7 @@ const validateOpenApiSpec$1 = (spec, logger) => {
6473
6459
  message: "Duplicate `operationId` found. Each `operationId` must be unique.",
6474
6460
  path: [
6475
6461
  "paths",
6476
- path$1,
6462
+ path,
6477
6463
  method,
6478
6464
  "operationId"
6479
6465
  ],
@@ -6525,8 +6511,8 @@ const parseV3_0_X = (context) => {
6525
6511
  });
6526
6512
  if (hasFilters(context.config.parser.filters)) {
6527
6513
  const filters = createFilters(context.config.parser.filters, context.spec, context.logger);
6528
- const { graph: graph$1 } = buildGraph(context.spec, context.logger);
6529
- const { resourceMetadata } = buildResourceMetadata(graph$1, context.logger);
6514
+ const { graph } = buildGraph(context.spec, context.logger);
6515
+ const { resourceMetadata } = buildResourceMetadata(graph, context.logger);
6530
6516
  filterSpec$1({
6531
6517
  ...createFilteredDependencies({
6532
6518
  filters,
@@ -6576,9 +6562,9 @@ const parseV3_0_X = (context) => {
6576
6562
  }
6577
6563
  }
6578
6564
  parseServers$1({ context });
6579
- for (const path$1 in context.spec.paths) {
6580
- if (path$1.startsWith("x-")) continue;
6581
- const pathItem = context.spec.paths[path$1];
6565
+ for (const path in context.spec.paths) {
6566
+ if (path.startsWith("x-")) continue;
6567
+ const pathItem = context.spec.paths[path];
6582
6568
  const finalPathItem = pathItem.$ref ? {
6583
6569
  ...context.resolveRef(pathItem.$ref),
6584
6570
  ...pathItem
@@ -6595,7 +6581,7 @@ const parseV3_0_X = (context) => {
6595
6581
  servers: finalPathItem.servers,
6596
6582
  summary: finalPathItem.summary
6597
6583
  },
6598
- path: path$1,
6584
+ path,
6599
6585
  securitySchemesMap,
6600
6586
  state
6601
6587
  };
@@ -6776,17 +6762,17 @@ const filterSpec = ({ logger, operations, parameters, preserveOrder, requestBodi
6776
6762
  }
6777
6763
  }
6778
6764
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
6779
- const path$1 = entry[0];
6765
+ const path = entry[0];
6780
6766
  const pathItem = entry[1];
6781
6767
  for (const method of httpMethods) {
6782
6768
  if (!pathItem[method]) continue;
6783
6769
  const key = addNamespace("operation", createOperationKey({
6784
6770
  method,
6785
- path: path$1
6771
+ path
6786
6772
  }));
6787
6773
  if (!operations.has(key)) delete pathItem[method];
6788
6774
  }
6789
- if (!Object.keys(pathItem).length) delete spec.paths[path$1];
6775
+ if (!Object.keys(pathItem).length) delete spec.paths[path];
6790
6776
  }
6791
6777
  eventFilterSpec.timeEnd();
6792
6778
  };
@@ -7050,11 +7036,11 @@ const parseAllOf = ({ context, schema, state }) => {
7050
7036
  else irCompositionSchema.required = schema.required;
7051
7037
  schemaItems.push(irCompositionSchema);
7052
7038
  if (compositionSchema.$ref) {
7053
- const ref$1 = context.resolveRef(compositionSchema.$ref);
7039
+ const ref = context.resolveRef(compositionSchema.$ref);
7054
7040
  if (state.$ref) {
7055
7041
  const discriminators = findDiscriminatorsInSchema({
7056
7042
  context,
7057
- schema: ref$1
7043
+ schema: ref
7058
7044
  });
7059
7045
  for (const { discriminator, oneOf } of discriminators) {
7060
7046
  const values = discriminatorValues(state.$ref, discriminator.mapping, oneOf ? () => oneOf.some((o) => "$ref" in o && o.$ref === state.$ref) : void 0);
@@ -7063,7 +7049,7 @@ const parseAllOf = ({ context, schema, state }) => {
7063
7049
  const existingIndex = discriminatorsToAdd.findIndex((d) => d.discriminator.propertyName === discriminator.propertyName);
7064
7050
  if (existingIndex !== -1) if (isExplicitMapping && !discriminatorsToAdd[existingIndex].isExplicitMapping) discriminatorsToAdd.splice(existingIndex, 1);
7065
7051
  else continue;
7066
- const isRequired = discriminators.some((d) => d.discriminator.propertyName === discriminator.propertyName && (ref$1.required?.includes(d.discriminator.propertyName) || ref$1.allOf && ref$1.allOf.some((item) => {
7052
+ const isRequired = discriminators.some((d) => d.discriminator.propertyName === discriminator.propertyName && (ref.required?.includes(d.discriminator.propertyName) || ref.allOf && ref.allOf.some((item) => {
7067
7053
  return (item.$ref ? context.resolveRef(item.$ref) : item).required?.includes(d.discriminator.propertyName);
7068
7054
  })));
7069
7055
  discriminatorsToAdd.push({
@@ -7332,13 +7318,13 @@ const parseRef = ({ context, schema, state }) => {
7332
7318
  const refSchema = context.resolveRef(schema.$ref);
7333
7319
  const originalRef = state.$ref;
7334
7320
  state.$ref = schema.$ref;
7335
- const irSchema$1 = schemaToIrSchema({
7321
+ const irSchema = schemaToIrSchema({
7336
7322
  context,
7337
7323
  schema: refSchema,
7338
7324
  state
7339
7325
  });
7340
7326
  state.$ref = originalRef;
7341
- return irSchema$1;
7327
+ return irSchema;
7342
7328
  }
7343
7329
  }
7344
7330
  let irSchema = initIrSchema({ schema });
@@ -7548,13 +7534,13 @@ const isPaginationType = (schemaTypes) => schemaTypes.includes("boolean") || sch
7548
7534
  const paginationField = ({ context, name, schema }) => {
7549
7535
  if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) return true;
7550
7536
  if (schema.$ref) {
7551
- const ref$1 = context.resolveRef(schema.$ref);
7552
- if ("content" in ref$1 || "in" in ref$1) {
7537
+ const ref = context.resolveRef(schema.$ref);
7538
+ if ("content" in ref || "in" in ref) {
7553
7539
  let refSchema;
7554
- if ("in" in ref$1) refSchema = ref$1.schema;
7540
+ if ("in" in ref) refSchema = ref.schema;
7555
7541
  if (!refSchema) {
7556
- const contents = mediaTypeObjects({ content: ref$1.content });
7557
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
7542
+ const contents = mediaTypeObjects({ content: ref.content });
7543
+ const content = contents.find((content) => content.type === "json") || contents[0];
7558
7544
  if (content?.schema) refSchema = content.schema;
7559
7545
  }
7560
7546
  if (!refSchema) return false;
@@ -7567,20 +7553,20 @@ const paginationField = ({ context, name, schema }) => {
7567
7553
  return paginationField({
7568
7554
  context,
7569
7555
  name,
7570
- schema: ref$1
7556
+ schema: ref
7571
7557
  });
7572
7558
  }
7573
- for (const name$1 in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name$1)) {
7574
- const property = schema.properties[name$1];
7559
+ for (const name in schema.properties) if (getPaginationKeywordsRegExp(context.config.parser.pagination).test(name)) {
7560
+ const property = schema.properties[name];
7575
7561
  if (typeof property !== "boolean") {
7576
7562
  const schemaTypes = getSchemaTypes({ schema: property });
7577
7563
  if (!schemaTypes.length) {
7578
- const nonNullCompositionSchemas = (property.anyOf ?? property.oneOf ?? []).filter((schema$1) => schema$1.type !== "null");
7564
+ const nonNullCompositionSchemas = (property.anyOf ?? property.oneOf ?? []).filter((schema) => schema.type !== "null");
7579
7565
  if (nonNullCompositionSchemas.length === 1) {
7580
- if (isPaginationType(getSchemaTypes({ schema: nonNullCompositionSchemas[0] }))) return name$1;
7566
+ if (isPaginationType(getSchemaTypes({ schema: nonNullCompositionSchemas[0] }))) return name;
7581
7567
  }
7582
7568
  }
7583
- if (isPaginationType(schemaTypes)) return name$1;
7569
+ if (isPaginationType(schemaTypes)) return name;
7584
7570
  }
7585
7571
  }
7586
7572
  for (const allOf of schema.allOf ?? []) {
@@ -7602,17 +7588,17 @@ const parseOperationJsDoc = ({ irOperation, operation }) => {
7602
7588
  if (operation.summary) irOperation.summary = operation.summary;
7603
7589
  if (operation.tags?.length) irOperation.tags = operation.tags;
7604
7590
  };
7605
- const initIrOperation = ({ context, method, operation, path: path$1, state }) => {
7591
+ const initIrOperation = ({ context, method, operation, path, state }) => {
7606
7592
  const irOperation = {
7607
7593
  id: operationToId({
7608
7594
  context,
7609
7595
  id: operation.operationId,
7610
7596
  method,
7611
- path: path$1,
7597
+ path,
7612
7598
  state
7613
7599
  }),
7614
7600
  method,
7615
- path: path$1
7601
+ path
7616
7602
  };
7617
7603
  if (operation.operationId) irOperation.operationId = operation.operationId;
7618
7604
  parseOperationJsDoc({
@@ -7625,19 +7611,19 @@ const initIrOperation = ({ context, method, operation, path: path$1, state }) =>
7625
7611
  });
7626
7612
  return irOperation;
7627
7613
  };
7628
- const operationToIrOperation = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
7614
+ const operationToIrOperation = ({ context, method, operation, path, securitySchemesMap, state }) => {
7629
7615
  const irOperation = initIrOperation({
7630
7616
  context,
7631
7617
  method,
7632
7618
  operation,
7633
- path: path$1,
7619
+ path,
7634
7620
  state
7635
7621
  });
7636
7622
  if (operation.parameters) irOperation.parameters = operation.parameters;
7637
7623
  if (operation.requestBody) {
7638
7624
  const requestBody = "$ref" in operation.requestBody ? context.resolveRef(operation.requestBody.$ref) : operation.requestBody;
7639
7625
  const contents = mediaTypeObjects({ content: requestBody.content });
7640
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
7626
+ const content = contents.find((content) => content.type === "json") || contents[0];
7641
7627
  if (content) {
7642
7628
  const pagination = paginationField({
7643
7629
  context,
@@ -7669,7 +7655,7 @@ const operationToIrOperation = ({ context, method, operation, path: path$1, secu
7669
7655
  const response = operation.responses[name];
7670
7656
  const responseObject = "$ref" in response ? context.resolveRef(response.$ref) : response;
7671
7657
  const contents = mediaTypeObjects({ content: responseObject.content });
7672
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
7658
+ const content = contents.find((content) => content.type === "json") || contents[0];
7673
7659
  if (content) irOperation.responses[name] = {
7674
7660
  mediaType: content.mediaType,
7675
7661
  schema: schemaToIrSchema({
@@ -7697,27 +7683,27 @@ const operationToIrOperation = ({ context, method, operation, path: path$1, secu
7697
7683
  }
7698
7684
  return irOperation;
7699
7685
  };
7700
- const parseOperationObject = ({ context, method, operation, path: path$1, securitySchemesMap, state }) => {
7686
+ const parseOperationObject = ({ context, method, operation, path, securitySchemesMap, state }) => {
7701
7687
  if (operation.servers) context.ir.servers = [...context.ir.servers ?? [], ...operation.servers];
7702
7688
  return { parsed: operationToIrOperation({
7703
7689
  context,
7704
7690
  method,
7705
7691
  operation,
7706
- path: path$1,
7692
+ path,
7707
7693
  securitySchemesMap,
7708
7694
  state
7709
7695
  }) };
7710
7696
  };
7711
- const parsePathOperation = ({ context, method, path: path$1, ...options }) => {
7697
+ const parsePathOperation = ({ context, method, path, ...options }) => {
7712
7698
  if (!context.ir.paths) context.ir.paths = {};
7713
- if (!context.ir.paths[path$1]) context.ir.paths[path$1] = {};
7699
+ if (!context.ir.paths[path]) context.ir.paths[path] = {};
7714
7700
  const { parsed } = parseOperationObject({
7715
7701
  context,
7716
7702
  method,
7717
- path: path$1,
7703
+ path,
7718
7704
  ...options
7719
7705
  });
7720
- context.ir.paths[path$1][method] = parsed;
7706
+ context.ir.paths[path][method] = parsed;
7721
7707
  };
7722
7708
  const parseWebhookOperation = ({ context, key, method, ...options }) => {
7723
7709
  if (!context.ir.webhooks) context.ir.webhooks = {};
@@ -7781,7 +7767,7 @@ const parameterToIrParameter = ({ $ref, context, parameter }) => {
7781
7767
  let schema = parameter.schema;
7782
7768
  if (!schema) {
7783
7769
  const contents = mediaTypeObjects({ content: parameter.content });
7784
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
7770
+ const content = contents.find((content) => content.type === "json") || contents[0];
7785
7771
  if (content) schema = content.schema;
7786
7772
  }
7787
7773
  const finalSchema = {
@@ -7835,7 +7821,7 @@ const parseParameter = ({ $ref, context, parameter }) => {
7835
7821
  //#region src/openApi/3.1.x/parser/requestBody.ts
7836
7822
  const requestBodyToIrRequestBody = ({ $ref, context, requestBody }) => {
7837
7823
  const contents = mediaTypeObjects({ content: requestBody.content });
7838
- const content = contents.find((content$1) => content$1.type === "json") || contents[0];
7824
+ const content = contents.find((content) => content.type === "json") || contents[0];
7839
7825
  const schema = content ? content.schema : void 0;
7840
7826
  const irRequestBody = { schema: schemaToIrSchema({
7841
7827
  context,
@@ -7883,14 +7869,14 @@ const validateOpenApiSpec = (spec, logger) => {
7883
7869
  const issues = [];
7884
7870
  const operationIds = /* @__PURE__ */ new Map();
7885
7871
  if (spec.paths) for (const entry of Object.entries(spec.paths)) {
7886
- const path$1 = entry[0];
7872
+ const path = entry[0];
7887
7873
  const pathItem = entry[1];
7888
7874
  for (const method of httpMethods) {
7889
7875
  const operation = pathItem[method];
7890
7876
  if (!operation) continue;
7891
7877
  const operationKey = createOperationKey({
7892
7878
  method,
7893
- path: path$1
7879
+ path
7894
7880
  });
7895
7881
  if (operation.operationId) if (!operationIds.has(operation.operationId)) operationIds.set(operation.operationId, operationKey);
7896
7882
  else issues.push({
@@ -7902,7 +7888,7 @@ const validateOpenApiSpec = (spec, logger) => {
7902
7888
  message: "Duplicate `operationId` found. Each `operationId` must be unique.",
7903
7889
  path: [
7904
7890
  "paths",
7905
- path$1,
7891
+ path,
7906
7892
  method,
7907
7893
  "operationId"
7908
7894
  ],
@@ -8103,8 +8089,8 @@ const parseV3_1_X = (context) => {
8103
8089
  });
8104
8090
  if (hasFilters(context.config.parser.filters)) {
8105
8091
  const filters = createFilters(context.config.parser.filters, context.spec, context.logger);
8106
- const { graph: graph$1 } = buildGraph(context.spec, context.logger);
8107
- const { resourceMetadata } = buildResourceMetadata(graph$1, context.logger);
8092
+ const { graph } = buildGraph(context.spec, context.logger);
8093
+ const { resourceMetadata } = buildResourceMetadata(graph, context.logger);
8108
8094
  filterSpec({
8109
8095
  ...createFilteredDependencies({
8110
8096
  filters,
@@ -8154,9 +8140,9 @@ const parseV3_1_X = (context) => {
8154
8140
  }
8155
8141
  }
8156
8142
  parseServers({ context });
8157
- for (const path$1 in context.spec.paths) {
8158
- if (path$1.startsWith("x-")) continue;
8159
- const pathItem = context.spec.paths[path$1];
8143
+ for (const path in context.spec.paths) {
8144
+ if (path.startsWith("x-")) continue;
8145
+ const pathItem = context.spec.paths[path];
8160
8146
  const finalPathItem = pathItem.$ref ? {
8161
8147
  ...context.resolveRef(pathItem.$ref),
8162
8148
  ...pathItem
@@ -8173,7 +8159,7 @@ const parseV3_1_X = (context) => {
8173
8159
  servers: finalPathItem.servers,
8174
8160
  summary: finalPathItem.summary
8175
8161
  },
8176
- path: path$1,
8162
+ path,
8177
8163
  securitySchemesMap,
8178
8164
  state
8179
8165
  };
@@ -8396,7 +8382,7 @@ async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
8396
8382
  const patchFn = patchOptions.schemas[key];
8397
8383
  await patchFn(schema);
8398
8384
  }
8399
- if (patchOptions.operations && spec.paths) if (typeof patchOptions.operations === "function") for (const [path$1, pathItem] of Object.entries(spec.paths)) {
8385
+ if (patchOptions.operations && spec.paths) if (typeof patchOptions.operations === "function") for (const [path, pathItem] of Object.entries(spec.paths)) {
8400
8386
  if (!pathItem || typeof pathItem !== "object") continue;
8401
8387
  for (const method of [
8402
8388
  "get",
@@ -8410,13 +8396,13 @@ async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
8410
8396
  ]) {
8411
8397
  const operation = pathItem[method];
8412
8398
  if (!operation || typeof operation !== "object") continue;
8413
- await patchOptions.operations(method, path$1, operation);
8399
+ await patchOptions.operations(method, path, operation);
8414
8400
  }
8415
8401
  }
8416
8402
  else for (const key in patchOptions.operations) {
8417
- const [method, path$1] = key.split(" ");
8418
- if (!method || !path$1) continue;
8419
- const pathItem = spec.paths[path$1];
8403
+ const [method, path] = key.split(" ");
8404
+ if (!method || !path) continue;
8405
+ const pathItem = spec.paths[path];
8420
8406
  if (!pathItem) continue;
8421
8407
  const operation = pathItem[method.toLocaleLowerCase()] || pathItem[method.toLocaleUpperCase()];
8422
8408
  if (!operation || typeof operation !== "object") continue;
@@ -8455,7 +8441,7 @@ async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
8455
8441
  patchFn(schema);
8456
8442
  }
8457
8443
  }
8458
- if (patchOptions.operations && spec.paths) if (typeof patchOptions.operations === "function") for (const [path$1, pathItem] of Object.entries(spec.paths)) {
8444
+ if (patchOptions.operations && spec.paths) if (typeof patchOptions.operations === "function") for (const [path, pathItem] of Object.entries(spec.paths)) {
8459
8445
  if (!pathItem || typeof pathItem !== "object") continue;
8460
8446
  for (const method of [
8461
8447
  "get",
@@ -8469,13 +8455,13 @@ async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
8469
8455
  ]) {
8470
8456
  const operation = pathItem[method];
8471
8457
  if (!operation || typeof operation !== "object") continue;
8472
- await patchOptions.operations(method, path$1, operation);
8458
+ await patchOptions.operations(method, path, operation);
8473
8459
  }
8474
8460
  }
8475
8461
  else for (const key in patchOptions.operations) {
8476
- const [method, path$1] = key.split(" ");
8477
- if (!method || !path$1) continue;
8478
- const pathItem = spec.paths[path$1];
8462
+ const [method, path] = key.split(" ");
8463
+ if (!method || !path) continue;
8464
+ const pathItem = spec.paths[path];
8479
8465
  if (!pathItem) continue;
8480
8466
  const operation = pathItem[method.toLocaleLowerCase()] || pathItem[method.toLocaleUpperCase()];
8481
8467
  if (!operation || typeof operation !== "object") continue;
@@ -8552,9 +8538,14 @@ const utils = {
8552
8538
  /**
8553
8539
  * Converts an {@link OutputHeader} value to a string prefix for file content.
8554
8540
  */
8555
- function outputHeaderToPrefix(header, project) {
8556
- let lines = typeof header === "function" ? header({ project }) : header;
8557
- if (lines === null || lines === void 0) return "";
8541
+ function outputHeaderToPrefix(ctx) {
8542
+ const { defaultValue, header, project } = ctx;
8543
+ let lines = typeof header === "function" ? header({
8544
+ defaultValue,
8545
+ project
8546
+ }) : header;
8547
+ if (lines === void 0) lines = defaultValue;
8548
+ if (lines === null) return "";
8558
8549
  lines = typeof lines === "string" ? lines.split(/\r?\n/) : lines.flatMap((line) => line.split(/\r?\n/));
8559
8550
  const content = lines.join("\n");
8560
8551
  return content ? `${content}\n\n` : "";
@@ -8628,35 +8619,35 @@ function sanitizeSegment(segment) {
8628
8619
  * paths//event/get/properties/query, { anchor: 'event.subscribe' }
8629
8620
  * → 'event.subscribe-Query'
8630
8621
  */
8631
- function pathToName(path$1, options) {
8622
+ function pathToName(path, options) {
8632
8623
  const names = [];
8633
8624
  let index = 0;
8634
- const rootContext = ROOT_CONTEXT[path$1[0]];
8625
+ const rootContext = ROOT_CONTEXT[path[0]];
8635
8626
  if (rootContext) {
8636
8627
  index = rootContext.skip;
8637
8628
  if (options?.anchor) {
8638
8629
  names.push(options.anchor);
8639
8630
  index += rootContext.names;
8640
- } else for (let n = 0; n < rootContext.names && index < path$1.length; n++) {
8641
- names.push(sanitizeSegment(path$1[index]));
8631
+ } else for (let n = 0; n < rootContext.names && index < path.length; n++) {
8632
+ names.push(sanitizeSegment(path[index]));
8642
8633
  index++;
8643
8634
  }
8644
8635
  } else if (options?.anchor) {
8645
8636
  names.push(options.anchor);
8646
8637
  index++;
8647
- } else if (index < path$1.length) {
8648
- names.push(sanitizeSegment(path$1[index]));
8638
+ } else if (index < path.length) {
8639
+ names.push(sanitizeSegment(path[index]));
8649
8640
  index++;
8650
8641
  }
8651
- while (index < path$1.length) {
8652
- const segment = String(path$1[index]);
8642
+ while (index < path.length) {
8643
+ const segment = String(path[index]);
8653
8644
  const role = STRUCTURAL_ROLE[segment];
8654
8645
  if (role === "name") {
8655
8646
  index++;
8656
- if (index < path$1.length) names.push(sanitizeSegment(path$1[index]));
8647
+ if (index < path.length) names.push(sanitizeSegment(path[index]));
8657
8648
  } else if (role === "index") {
8658
8649
  index++;
8659
- if (index < path$1.length && typeof path$1[index] === "number") index++;
8650
+ if (index < path.length && typeof path[index] === "number") index++;
8660
8651
  continue;
8661
8652
  } else if (STRUCTURAL_SUFFIX[segment]) names.push(STRUCTURAL_SUFFIX[segment]);
8662
8653
  index++;
@@ -8665,5 +8656,5 @@ function pathToName(path$1, options) {
8665
8656
  }
8666
8657
 
8667
8658
  //#endregion
8668
- export { ConfigError, ConfigValidationError, Context, HeyApiError, IntentContext, JobError, MinHeap, OperationPath, OperationStrategy, PluginInstance, addItemsToSchema, applyNaming, buildGraph, buildSymbolIn, checkNodeVersion, childContext, compileInputPath, createOperationKey, createSchemaProcessor, createSchemaWalker, debugTools, deduplicateSchema, defaultPaginationKeywords, definePluginConfig, dependencyFactory, encodeJsonPointerSegment, ensureDirSync, escapeComment, findPackageJson, findTsConfigPath, getInput, getLogs, getParser, getSpec, hasOperationDataRequired, hasParameterGroupObjectRequired, hasParametersObjectRequired, heyApiRegistryBaseUrl, inputToApiRegistry, isEnvironment, isTopLevelComponent, jsonPointerToPath, loadPackageJson, loadTsConfig, logCrashReport, logInputPaths, mappers, normalizeJsonPointer, openGitHubIssueWithCrashReport, operationPagination, operationResponsesMap, outputHeaderToPrefix, parameterWithPagination, parseOpenApiSpec, parseUrl, parseV2_0_X, parseV3_0_X, parseV3_1_X, patchOpenApiSpec, pathToJsonPointer, pathToName, postprocessOutput, printCliIntro, printCrashReport, refToName, resolveNaming, resolveRef, resolveSource, satisfies, shouldReportCrash, statusCodeToGroup, toCase, utils, valueToObject };
8659
+ export { ConfigError, ConfigValidationError, Context, HeyApiError, IntentContext, JobError, MinHeap, OperationPath, OperationStrategy, PluginInstance, addItemsToSchema, applyNaming, buildGraph, buildSymbolIn, checkNodeVersion, childContext, compileInputPath, createOperationKey, createSchemaProcessor, createSchemaWalker, debugTools, deduplicateSchema, defaultPaginationKeywords, definePluginConfig, dependencyFactory, encodeJsonPointerSegment, ensureDirSync, escapeComment, findPackageJson, findTsConfigPath, getInput, getLogs, getParser, getSpec, hasOperationDataRequired, hasParameterGroupObjectRequired, hasParametersObjectRequired, heyApiRegistryBaseUrl, inputToApiRegistry, isEnvironment, isTopLevelComponent, jsonPointerToPath, loadPackageJson, logCrashReport, logInputPaths, mappers, normalizeJsonPointer, openGitHubIssueWithCrashReport, operationPagination, operationResponsesMap, outputHeaderToPrefix, parameterWithPagination, parseOpenApiSpec, parseUrl, parseV2_0_X, parseV3_0_X, parseV3_1_X, patchOpenApiSpec, pathToJsonPointer, pathToName, postprocessOutput, printCliIntro, printCrashReport, refToName, resolveNaming, resolveRef, resolveSource, satisfies, shouldReportCrash, statusCodeToGroup, toCase, utils, valueToObject };
8669
8660
  //# sourceMappingURL=index.mjs.map