fumadocs-openapi 10.0.3 → 10.0.5

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.
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { createContext, Fragment, use, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
4
4
  import { Tabs, TabsContent, TabsList, TabsTrigger, } from 'fumadocs-ui/components/tabs';
5
5
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
@@ -43,7 +43,7 @@ function SchemaUIContent({ $type }) {
43
43
  const schema = refs[$type];
44
44
  if ((schema.readOnly && !readOnly) || (schema.writeOnly && !writeOnly))
45
45
  return;
46
- let child = _jsx(_Fragment, {});
46
+ let child = null;
47
47
  if (schema.type === 'or' && schema.items.length > 0) {
48
48
  child = (_jsxs(_Fragment, { children: [child, _jsxs(Tabs, { defaultValue: schema.items[0].$type, children: [_jsx(TabsList, { children: schema.items.map((item) => (_jsx(TabsTrigger, { value: item.$type, children: item.name }, item.$type))) }), schema.items.map((item) => (_jsx(TabsContent, { value: item.$type, forceMount: undefined, className: "py-0", children: _jsx(SchemaUIContent, { ...item }) }, item.$type)))] })] }));
49
49
  }
@@ -122,11 +122,17 @@ function generateSchemaUI({ ctx, root, }) {
122
122
  };
123
123
  refs[id] = out;
124
124
  for (const item of schema.oneOf) {
125
- const $type = getSchemaId(item);
126
- scanRefs($type, item);
125
+ if (typeof item !== 'object')
126
+ continue;
127
+ const key = `${id}_extends:${getSchemaId(item)}`;
128
+ const extended = {
129
+ ...schema,
130
+ ...item,
131
+ };
132
+ scanRefs(key, extended);
127
133
  out.items.push({
128
- name: schemaToString(item, ctx.schema, FormatFlags.UseAlias),
129
- $type,
134
+ $type: key,
135
+ name: schemaToString(extended, ctx.schema, FormatFlags.UseAlias),
130
136
  });
131
137
  }
132
138
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.0.3",
3
+ "version": "10.0.5",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -69,8 +69,8 @@
69
69
  "remark-rehype": "^11.1.2",
70
70
  "tinyglobby": "^0.2.15",
71
71
  "xml-js": "^1.6.11",
72
- "fumadocs-core": "16.0.9",
73
- "fumadocs-ui": "16.0.9"
72
+ "fumadocs-ui": "16.0.11",
73
+ "fumadocs-core": "16.0.11"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@scalar/api-client-react": "^1.3.48",