@kubb/adapter-oas 5.0.0-beta.20 → 5.0.0-beta.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.cjs CHANGED
@@ -1177,7 +1177,7 @@ function createSchemaParser(ctx) {
1177
1177
  * Circular refs are detected via `resolvingRefs` and leave `schema` as `undefined`.
1178
1178
  */
1179
1179
  function convertRef({ schema, name, nullable, defaultValue, rawOptions }) {
1180
- let resolvedSchema;
1180
+ let resolvedSchema = null;
1181
1181
  const refPath = schema.$ref;
1182
1182
  if (refPath && !resolvingRefs.has(refPath)) {
1183
1183
  if (!resolvedRefCache.has(refPath)) {
@@ -1191,7 +1191,7 @@ function createSchemaParser(ctx) {
1191
1191
  } catch {}
1192
1192
  resolvedRefCache.set(refPath, resolvedSchema);
1193
1193
  }
1194
- resolvedSchema = resolvedRefCache.get(refPath);
1194
+ resolvedSchema = resolvedRefCache.get(refPath) ?? null;
1195
1195
  }
1196
1196
  return _kubb_core.ast.createSchema({
1197
1197
  ...buildSchemaNode(schema, name, nullable, defaultValue),
@@ -1577,7 +1577,7 @@ function createSchemaParser(ctx) {
1577
1577
  */
1578
1578
  function convertArray({ schema, name, nullable, defaultValue, rawOptions, options }) {
1579
1579
  const rawItems = schema.items;
1580
- const itemName = rawItems?.enum?.length && name ? _kubb_core.ast.enumPropName(void 0, name, options.enumSuffix) : void 0;
1580
+ const itemName = rawItems?.enum?.length && name ? _kubb_core.ast.enumPropName(null, name, options.enumSuffix) : void 0;
1581
1581
  const items = rawItems ? [parseSchema({
1582
1582
  schema: rawItems,
1583
1583
  name: itemName
@@ -1768,13 +1768,13 @@ function createSchemaParser(ctx) {
1768
1768
  * `$ref` entries are skipped since their flags live on the dereferenced target.
1769
1769
  */
1770
1770
  function collectPropertyKeysByFlag(schema, flag) {
1771
- if (!schema?.properties) return void 0;
1771
+ if (!schema?.properties) return null;
1772
1772
  const keys = [];
1773
1773
  for (const key in schema.properties) {
1774
1774
  const prop = schema.properties[key];
1775
1775
  if (prop && !isReference(prop) && prop[flag]) keys.push(key);
1776
1776
  }
1777
- return keys.length ? keys : void 0;
1777
+ return keys.length ? keys : null;
1778
1778
  }
1779
1779
  /**
1780
1780
  * Converts an OAS `Operation` into an `OperationNode`.
@@ -1860,15 +1860,15 @@ function buildDiscriminatorChildMap(schemas) {
1860
1860
  for (const member of members) {
1861
1861
  const intersectionNode = _kubb_core.ast.narrowSchema(member, "intersection");
1862
1862
  if (!intersectionNode?.members) continue;
1863
- let refNode;
1864
- let objNode;
1863
+ let refNode = null;
1864
+ let objNode = null;
1865
1865
  for (const m of intersectionNode.members) {
1866
1866
  refNode ??= _kubb_core.ast.narrowSchema(m, "ref");
1867
1867
  objNode ??= _kubb_core.ast.narrowSchema(m, "object");
1868
1868
  }
1869
1869
  if (!refNode?.name || !objNode) continue;
1870
1870
  const prop = objNode.properties.find((p) => p.name === discriminatorPropertyName);
1871
- const enumNode = prop ? _kubb_core.ast.narrowSchema(prop.schema, "enum") : void 0;
1871
+ const enumNode = prop ? _kubb_core.ast.narrowSchema(prop.schema, "enum") : null;
1872
1872
  if (!enumNode?.enumValues?.length) continue;
1873
1873
  const enumValues = enumNode.enumValues.filter((v) => v !== null);
1874
1874
  if (!enumValues.length) continue;
@@ -1916,7 +1916,7 @@ function patchDiscriminatorNode(node, entry) {
1916
1916
  * Reads the server URL from the document's `servers` array at `serverIndex`,
1917
1917
  * interpolating any `serverVariables` into the URL template.
1918
1918
  *
1919
- * Returns `undefined` when `serverIndex` is omitted or out of range.
1919
+ * Returns `null` when `serverIndex` is omitted or out of range.
1920
1920
  *
1921
1921
  * @example Resolve the first server
1922
1922
  * `resolveBaseUrl({ document, serverIndex: 0 })`
@@ -1926,7 +1926,7 @@ function patchDiscriminatorNode(node, entry) {
1926
1926
  */
1927
1927
  function resolveBaseUrl({ document, serverIndex, serverVariables }) {
1928
1928
  const server = serverIndex !== void 0 ? document.servers?.at(serverIndex) : void 0;
1929
- return server?.url ? resolveServerUrl(server, serverVariables) : void 0;
1929
+ return server?.url ? resolveServerUrl(server, serverVariables) : null;
1930
1930
  }
1931
1931
  /**
1932
1932
  * Parses every schema once to build the lookup structures that streaming needs upfront.
@@ -2142,7 +2142,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
2142
2142
  nameMapping,
2143
2143
  resolve: (schemaName) => {
2144
2144
  const result = resolve(schemaName);
2145
- if (!result) return;
2145
+ if (!result) return null;
2146
2146
  return _kubb_core.ast.createImport({
2147
2147
  name: [result.name],
2148
2148
  path: result.path