@kubb/adapter-oas 5.0.0-alpha.20 → 5.0.0-alpha.21

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.d.ts CHANGED
@@ -15,7 +15,7 @@ import { ParserOptions } from "@kubb/ast/types";
15
15
  * const ct: contentType = 'application/vnd.api+json'
16
16
  * ```
17
17
  */
18
- type contentType = 'application/json' | (string & {});
18
+ type ContentType = 'application/json' | (string & {});
19
19
  /**
20
20
  * Normalized OpenAPI document type used throughout the adapter.
21
21
  */
@@ -46,7 +46,7 @@ type AdapterOasOptions = {
46
46
  * Preferred content-type used when extracting request/response schemas.
47
47
  * Defaults to the first valid JSON media type found in the spec.
48
48
  */
49
- contentType?: contentType;
49
+ contentType?: ContentType;
50
50
  /**
51
51
  * Index into `oas.api.servers` for computing `baseURL`.
52
52
  * `0` → first server, `1` → second server. Omit to leave `baseURL` undefined.
package/dist/index.js CHANGED
@@ -1620,6 +1620,7 @@ const adapterOas = createAdapter((options) => {
1620
1620
  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;
1621
1621
  let nameMapping = /* @__PURE__ */ new Map();
1622
1622
  let parsedDocument;
1623
+ let rootNode;
1623
1624
  return {
1624
1625
  name: "oas",
1625
1626
  get options() {
@@ -1640,6 +1641,9 @@ const adapterOas = createAdapter((options) => {
1640
1641
  get document() {
1641
1642
  return parsedDocument;
1642
1643
  },
1644
+ get rootNode() {
1645
+ return rootNode;
1646
+ },
1643
1647
  getImports(node, resolve) {
1644
1648
  return collectImports({
1645
1649
  node,
@@ -1667,11 +1671,11 @@ const adapterOas = createAdapter((options) => {
1667
1671
  emptySchemaType,
1668
1672
  enumSuffix
1669
1673
  });
1670
- const root = discriminator === "inherit" ? applyDiscriminatorInheritance(parsedRoot) : parsedRoot;
1674
+ const node = discriminator === "inherit" ? applyDiscriminatorInheritance(parsedRoot) : parsedRoot;
1671
1675
  nameMapping = parsedNameMapping;
1672
1676
  parsedDocument = document;
1673
- return createRoot({
1674
- ...root,
1677
+ rootNode = createRoot({
1678
+ ...node,
1675
1679
  meta: {
1676
1680
  title: document.info?.title,
1677
1681
  description: document.info?.description,
@@ -1679,6 +1683,7 @@ const adapterOas = createAdapter((options) => {
1679
1683
  baseURL
1680
1684
  }
1681
1685
  });
1686
+ return rootNode;
1682
1687
  }
1683
1688
  };
1684
1689
  });