@kubb/adapter-oas 5.0.0-alpha.31 → 5.0.0-alpha.32

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.cjs CHANGED
@@ -152,11 +152,11 @@ const typeOptionMap = new Map([
152
152
  /**
153
153
  * Injects discriminator enum values into child schemas so they know which value identifies them.
154
154
  *
155
- * Finds every union schema in `root.schemas` that has a `discriminatorPropertyName`, collects the
155
+ * Finds every union schema in `input.schemas` that has a `discriminatorPropertyName`, collects the
156
156
  * enum value each union member is mapped to, then adds (or replaces) that property on the matching
157
157
  * child object schema.
158
158
  *
159
- * Returns a new `RootNode` — the original is never mutated.
159
+ * Returns a new `InputNode` — the original is never mutated.
160
160
  *
161
161
  * @example
162
162
  * ```ts
@@ -205,7 +205,7 @@ function applyDiscriminatorInheritance(root) {
205
205
  }
206
206
  if (childMap.size === 0) return root;
207
207
  return (0, _kubb_ast.transform)(root, { schema(node, { parent }) {
208
- if (parent?.kind !== "Root" || !node.name) return;
208
+ if (parent?.kind !== "Input" || !node.name) return;
209
209
  const entry = childMap.get(node.name);
210
210
  if (!entry) return;
211
211
  const objectNode = (0, _kubb_ast.narrowSchema)(node, "object");
@@ -1630,7 +1630,7 @@ function createSchemaParser(ctx) {
1630
1630
  };
1631
1631
  }
1632
1632
  /**
1633
- * Converts the entire OpenAPI spec into a `RootNode` (the top-level `@kubb/ast` tree).
1633
+ * Converts the entire OpenAPI spec into an `InputNode` (the top-level `@kubb/ast` tree).
1634
1634
  *
1635
1635
  * This is the main entry point: `OpenAPI / Swagger → Kubb AST`.
1636
1636
  * No code is generated here — the resulting tree is spec-agnostic and consumed by
@@ -1659,7 +1659,7 @@ function parseOas(document, options = {}) {
1659
1659
  }, mergedOptions));
1660
1660
  const paths = new oas.default(document).getPaths();
1661
1661
  return {
1662
- root: (0, _kubb_ast.createRoot)({
1662
+ root: (0, _kubb_ast.createInput)({
1663
1663
  schemas,
1664
1664
  operations: Object.entries(paths).flatMap(([_path, methods]) => Object.entries(methods).map(([, operation]) => operation ? _parseOperation(mergedOptions, operation) : null).filter((op) => op !== null))
1665
1665
  }),
@@ -1676,7 +1676,7 @@ const adapterOasName = "oas";
1676
1676
  * Creates the default OpenAPI / Swagger adapter for Kubb.
1677
1677
  *
1678
1678
  * Parses the spec, optionally validates it, resolves the base URL, and converts
1679
- * everything into a `RootNode` that downstream plugins consume.
1679
+ * everything into an `InputNode` that downstream plugins consume.
1680
1680
  *
1681
1681
  * @example
1682
1682
  * ```ts
@@ -1695,7 +1695,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
1695
1695
  const { validate = true, contentType, serverIndex, serverVariables, discriminator = "strict", dateType = DEFAULT_PARSER_OPTIONS.dateType, integerType = DEFAULT_PARSER_OPTIONS.integerType, unknownType = DEFAULT_PARSER_OPTIONS.unknownType, enumSuffix = DEFAULT_PARSER_OPTIONS.enumSuffix, emptySchemaType = unknownType || DEFAULT_PARSER_OPTIONS.emptySchemaType } = options;
1696
1696
  let nameMapping = /* @__PURE__ */ new Map();
1697
1697
  let parsedDocument;
1698
- let rootNode;
1698
+ let inputNode;
1699
1699
  return {
1700
1700
  name: "oas",
1701
1701
  get options() {
@@ -1716,8 +1716,8 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
1716
1716
  get document() {
1717
1717
  return parsedDocument;
1718
1718
  },
1719
- get rootNode() {
1720
- return rootNode;
1719
+ get inputNode() {
1720
+ return inputNode;
1721
1721
  },
1722
1722
  getImports(node, resolve) {
1723
1723
  return (0, _kubb_ast.collectImports)({
@@ -1726,10 +1726,10 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
1726
1726
  resolve: (schemaName) => {
1727
1727
  const result = resolve(schemaName);
1728
1728
  if (!result) return;
1729
- return {
1729
+ return (0, _kubb_ast.createImport)({
1730
1730
  name: [result.name],
1731
1731
  path: result.path
1732
- };
1732
+ });
1733
1733
  }
1734
1734
  });
1735
1735
  },
@@ -1749,7 +1749,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
1749
1749
  const node = discriminator === "inherit" ? applyDiscriminatorInheritance(parsedRoot) : parsedRoot;
1750
1750
  nameMapping = parsedNameMapping;
1751
1751
  parsedDocument = document;
1752
- rootNode = (0, _kubb_ast.createRoot)({
1752
+ inputNode = (0, _kubb_ast.createInput)({
1753
1753
  ...node,
1754
1754
  meta: {
1755
1755
  title: document.info?.title,
@@ -1758,7 +1758,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
1758
1758
  baseURL
1759
1759
  }
1760
1760
  });
1761
- return rootNode;
1761
+ return inputNode;
1762
1762
  }
1763
1763
  };
1764
1764
  });