fumadocs-openapi 8.1.11 → 9.0.0

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/ui/client.js CHANGED
@@ -8,7 +8,7 @@ export function CopyResponseTypeScript({ code }) {
8
8
  const [isChecked, onCopy] = useCopyButton(() => {
9
9
  void navigator.clipboard.writeText(code);
10
10
  });
11
- return (_jsxs("div", { className: "flex items-start justify-between gap-2 bg-fd-card border rounded-xl p-3 not-prose mb-4 last:mb-0", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium text-fd-foreground mb-2", children: "TypeScript Definitions" }), _jsx("p", { className: "text-xs", children: "Use the response body type in TypeScript." })] }), _jsxs("button", { onClick: onCopy, className: cn(buttonVariants({
11
+ return (_jsxs("div", { className: "flex items-start justify-between gap-2 bg-fd-card text-fd-card-foreground border rounded-xl p-3 not-prose mb-4 last:mb-0", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium text-sm mb-2", children: "TypeScript Definitions" }), _jsx("p", { className: "text-xs text-fd-muted-foreground", children: "Use the response body type in TypeScript." })] }), _jsxs("button", { onClick: onCopy, className: cn(buttonVariants({
12
12
  color: 'secondary',
13
13
  className: 'p-2 gap-2',
14
14
  size: 'sm',
@@ -3,7 +3,7 @@ import type { PropertyProps, RootProps } from '../render/renderer.js';
3
3
  export declare function Root({ children, className, ctx, ...props }: RootProps & HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
4
4
  export declare function APIInfo({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
5
5
  export declare function API({ children, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
6
- export declare function Property({ name, type, required, deprecated, children, }: PropertyProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Property({ name, type, required, deprecated, nested, ...props }: PropertyProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare function APIExample(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
8
8
  export declare function ObjectCollapsible(props: {
9
9
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYlE,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,GAAG,cAAc,CAAC,cAAc,CAAC,2CAyB5C;AAED,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAMhC;AAED,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,2CAmBzE;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,EAAE,aAAa,2CAsBf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY/D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAiBA;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAYlE,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,GAAG,cAAc,CAAC,cAAc,CAAC,2CAmB5C;AAED,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAMhC;AAED,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,2CAmBzE;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,MAAM,EACN,GAAG,KAAK,EACT,EAAE,aAAa,2CAyBf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY/D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAmBA;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/ui/index.js CHANGED
@@ -6,7 +6,7 @@ import { ApiProvider } from '../ui/lazy.js';
6
6
  import { cn } from 'fumadocs-ui/utils/cn';
7
7
  import { buttonVariants } from 'fumadocs-ui/components/ui/button';
8
8
  export function Root({ children, className, ctx, ...props }) {
9
- return (_jsx("div", { className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className), ...props, children: _jsx(ApiProvider, { mediaAdapters: Object.fromEntries(Object.entries(ctx.mediaAdapters).filter(([_, v]) => typeof v !== 'boolean')), servers: ctx.servers, shikiOptions: ctx.shikiOptions, defaultBaseUrl: ctx.baseUrl, children: children }) }));
9
+ return (_jsx("div", { className: cn('flex flex-col gap-24 text-sm', className), ...props, children: _jsx(ApiProvider, { mediaAdapters: Object.fromEntries(Object.entries(ctx.mediaAdapters).filter(([_, v]) => typeof v !== 'boolean')), servers: ctx.servers, shikiOptions: ctx.shikiOptions, defaultBaseUrl: ctx.baseUrl, children: children }) }));
10
10
  }
11
11
  export function APIInfo({ className, ...props }) {
12
12
  return (_jsx("div", { className: cn('min-w-0 flex-1', className), ...props, children: props.children }));
@@ -17,13 +17,13 @@ export function API({ children, ...props }) {
17
17
  ...props.style,
18
18
  }, children: children }));
19
19
  }
20
- export function Property({ name, type, required, deprecated, children, }) {
21
- return (_jsxs("div", { className: "rounded-xl border bg-fd-card p-3 prose-no-margin", children: [_jsxs("div", { className: "flex flex-row flex-wrap items-center gap-4 mb-2", children: [_jsx("code", { children: name }), required ? (_jsx(Badge, { color: "red", className: "text-xs", children: "Required" })) : null, deprecated ? (_jsx(Badge, { color: "yellow", className: "text-xs", children: "Deprecated" })) : null, _jsx("span", { className: "ms-auto text-xs font-mono text-fd-muted-foreground", children: type })] }), children] }));
20
+ export function Property({ name, type, required, deprecated, nested, ...props }) {
21
+ return (_jsxs("div", { className: cn('flex flex-col gap-3 text-sm', !nested && 'p-3 border rounded-xl bg-fd-card'), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-3 not-prose", children: [_jsxs("span", { className: "px-1 py-0.5 border rounded-md border-fd-primary/10 bg-fd-primary/10 font-mono text-xs text-fd-primary sm:text-[13px]", children: [name, required === false && '?'] }), _jsx("span", { className: "text-xs me-auto font-mono text-fd-muted-foreground", children: type }), deprecated && (_jsx(Badge, { color: "yellow", className: "text-xs", children: "Deprecated" }))] }), _jsx("div", { className: "prose-no-margin empty:hidden", children: props.children })] }));
22
22
  }
23
23
  export function APIExample(props) {
24
24
  return (_jsx("div", { ...props, className: cn('prose-no-margin md:sticky md:top-(--fd-api-info-top) xl:w-[400px]', props.className), children: props.children }));
25
25
  }
26
26
  export function ObjectCollapsible(props) {
27
- return (_jsxs(Collapsible, { ...props, children: [_jsxs(CollapsibleTrigger, { className: cn(buttonVariants({ color: 'outline', size: 'sm' }), 'group rounded-full px-2 py-1.5 text-fd-muted-foreground'), children: [props.name, _jsx(ChevronDown, { className: "size-4 group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { className: "-mx-2", children: _jsx("div", { className: "flex flex-col gap-2 p-2", children: props.children }) })] }));
27
+ return (_jsxs(Collapsible, { ...props, children: [_jsxs(CollapsibleTrigger, { className: cn(buttonVariants({ color: 'secondary', size: 'sm' }), 'group px-3 py-2 data-[state=open]:rounded-b-none data-[state=open]:border-b-0'), children: [props.name, _jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { className: "-me-3", children: _jsx("div", { className: "border-s border-y rounded-b-lg p-3", children: props.children }) })] }));
28
28
  }
29
29
  export { APIPage } from '../render/api-page.js';
@@ -1 +1 @@
1
- {"version":3,"file":"combine-schema.d.ts","sourceRoot":"","sources":["../../src/utils/combine-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CA+DlE"}
1
+ {"version":3,"file":"combine-schema.d.ts","sourceRoot":"","sources":["../../src/utils/combine-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAuDlE"}
@@ -2,9 +2,9 @@
2
2
  * Combine multiple object schemas into one
3
3
  */
4
4
  export function combineSchema(schema) {
5
- let result = {
6
- type: undefined,
7
- };
5
+ let result = {};
6
+ const types = new Set();
7
+ const title = new Set();
8
8
  function add(s) {
9
9
  if (typeof s === 'boolean') {
10
10
  result = s;
@@ -12,24 +12,23 @@ export function combineSchema(schema) {
12
12
  }
13
13
  if (typeof result === 'boolean')
14
14
  return;
15
+ if (s.title)
16
+ title.add(s.title);
15
17
  if (s.type) {
16
- result.type ?? (result.type = []);
17
- if (!Array.isArray(result.type)) {
18
- result.type = [result.type];
19
- }
20
18
  for (const v of Array.isArray(s.type) ? s.type : [s.type]) {
21
- if (Array.isArray(result.type) && !result.type.includes(v)) {
22
- result.type.push(v);
23
- }
19
+ types.add(v);
24
20
  }
25
21
  }
26
- if (s.properties) {
27
- result.properties ?? (result.properties = {});
28
- Object.assign(result.properties, s.properties);
22
+ for (const key of ['oneOf', 'required', 'enum']) {
23
+ if (!s[key])
24
+ continue;
25
+ result[key] = [...s[key], ...(result[key] ?? [])];
29
26
  }
30
- if (s.patternProperties) {
31
- result.patternProperties ?? (result.patternProperties = {});
32
- Object.assign(result.patternProperties, s.patternProperties);
27
+ for (const key of ['properties', 'patternProperties']) {
28
+ if (!s[key])
29
+ continue;
30
+ result[key] ?? (result[key] = {});
31
+ Object.assign(result[key], s[key]);
33
32
  }
34
33
  if (s.additionalProperties === true) {
35
34
  result.additionalProperties = true;
@@ -39,18 +38,14 @@ export function combineSchema(schema) {
39
38
  result.additionalProperties ?? (result.additionalProperties = {});
40
39
  Object.assign(result.additionalProperties, s.additionalProperties);
41
40
  }
42
- if (s.required) {
43
- result.required ?? (result.required = []);
44
- result.required.push(...s.required);
45
- }
46
- if (s.enum && s.enum.length > 0) {
47
- result.enum ?? (result.enum = []);
48
- result.enum.push(...s.enum);
49
- }
50
- if (s.allOf) {
51
- s.allOf.forEach(add);
52
- }
41
+ (s.allOf ?? s.anyOf)?.forEach(add);
53
42
  }
54
43
  schema.forEach(add);
44
+ if (title.size > 0)
45
+ result.title = Array.from(title).join(' & ');
46
+ if (types.size > 0) {
47
+ const typeArr = Array.from(types.values());
48
+ result.type = typeArr.length === 1 ? typeArr[0] : typeArr;
49
+ }
55
50
  return result;
56
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC;CACtB,CAAC;AAIF;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,aAAa,EACvB,YAAY,UAAQ,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA8B5B"}
1
+ {"version":3,"file":"process-document.d.ts","sourceRoot":"","sources":["../../src/utils/process-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC;CACtB,CAAC;AAIF;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,aAAa,EACvB,YAAY,UAAQ,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAoC5B"}
@@ -13,6 +13,9 @@ export async function processDocument(document, disableCache = false) {
13
13
  const loaded = await load(document, {
14
14
  plugins: [readFiles(), fetchUrls()],
15
15
  });
16
+ if (loaded.errors && loaded.errors.length > 0) {
17
+ throw new Error(loaded.errors.map((err) => `${err.code}: ${err.message}`).join('\n'));
18
+ }
16
19
  // upgrade
17
20
  loaded.specification = upgrade(loaded.specification).specification;
18
21
  const { schema: dereferenced } = await dereference(loaded.filesystem, {
@@ -1 +1 @@
1
- {"version":3,"file":"schema-to-string.d.ts","sourceRoot":"","sources":["../../src/utils/schema-to-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,UAAO,GAAG,MAAM,CAuE5E"}
1
+ {"version":3,"file":"schema-to-string.d.ts","sourceRoot":"","sources":["../../src/utils/schema-to-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,UAAO,GAAG,MAAM,CA0D5E"}
@@ -17,6 +17,7 @@ export function schemaToString(schema, isRoot = true) {
17
17
  ...schema,
18
18
  type,
19
19
  }, false))
20
+ .filter((v) => v !== 'unknown' && v !== 'null')
20
21
  .join(' | ');
21
22
  }
22
23
  if (schema.type === 'array')
@@ -24,39 +25,25 @@ export function schemaToString(schema, isRoot = true) {
24
25
  if (schema.oneOf) {
25
26
  return schema.oneOf
26
27
  .map((one) => schemaToString(one, false))
27
- .filter((v) => v !== 'unknown')
28
+ .filter((v) => v !== 'unknown' && v !== 'null')
28
29
  .join(' | ');
29
30
  }
30
- if (schema.allOf) {
31
- return schema.allOf
31
+ const combinedOf = schema.anyOf ?? schema.allOf;
32
+ if (combinedOf) {
33
+ return combinedOf
32
34
  .map((one) => schemaToString(one, false))
33
- .filter((v) => v !== 'unknown')
35
+ .filter((v) => v !== 'unknown' && v !== 'null')
34
36
  .join(' & ');
35
37
  }
36
38
  if (schema.not)
37
39
  return `not ${schemaToString(schema.not, false)}`;
38
- if (schema.anyOf) {
39
- const union = schema.anyOf
40
- .map((one) => schemaToString(one, false))
41
- .filter((v) => v !== 'unknown');
42
- if (union.length > 1) {
43
- return `Any properties in ${union.join(',')}`;
44
- }
45
- else if (union.length === 1) {
46
- return union[0];
47
- }
48
- }
49
40
  if (schema.type === 'string' && schema.format === 'binary')
50
41
  return 'file';
51
42
  if (schema.type && Array.isArray(schema.type)) {
52
- const nonNullTypes = schema.type.filter((v) => v !== 'null');
53
- if (nonNullTypes.length > 0)
54
- return nonNullTypes.join(' | ');
43
+ return schema.type.filter((v) => v !== 'null').join(' | ');
55
44
  }
56
- else if (schema.type && schema.type !== 'null') {
45
+ if (schema.type) {
57
46
  return schema.type;
58
47
  }
59
- if (typeof schema.type === 'string')
60
- return schema.type;
61
48
  return 'unknown';
62
49
  }
@@ -9,6 +9,6 @@ type NoReferenceJSONSchema<T> = T extends (infer I)[] ? NoReference<I>[] : T ext
9
9
  export type ParsedSchema = JSONSchema;
10
10
  export type ResolvedSchema = NoReferenceJSONSchema<ParsedSchema>;
11
11
  export declare function getPreferredType<B extends Record<string, unknown>>(body: B): keyof B | undefined;
12
- export declare function isNullable(schema: ParsedSchema, includeOneOf?: boolean): boolean;
12
+ export declare function isNullable(schema: ParsedSchema): boolean;
13
13
  export {};
14
14
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,eAAe,GACvB,OAAO,CAAC,CAAC,EAAE,eAAe,CAAC,GAC3B,CAAC,SAAS,MAAM,GACd;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,GACD,CAAC,CAAC;AAEV,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACjD,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzB,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GACf,CAAC,CAAC;AAER,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,IAAI,EAAE,CAAC,GACN,MAAM,CAAC,GAAG,SAAS,CAIrB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,UAAO,GAAG,OAAO,CAU7E"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,eAAe,GACvB,OAAO,CAAC,CAAC,EAAE,eAAe,CAAC,GAC3B,CAAC,SAAS,MAAM,GACd;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,GACD,CAAC,CAAC;AAEV,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACjD,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzB,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GACf,CAAC,CAAC;AAER,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,IAAI,EAAE,CAAC,GACN,MAAM,CAAC,GAAG,SAAS,CAIrB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQxD"}
@@ -3,16 +3,13 @@ export function getPreferredType(body) {
3
3
  return 'application/json';
4
4
  return Object.keys(body)[0];
5
5
  }
6
- export function isNullable(schema, includeOneOf = true) {
6
+ export function isNullable(schema) {
7
7
  if (typeof schema === 'boolean')
8
8
  return false;
9
9
  if (Array.isArray(schema.type) && schema.type.includes('null'))
10
10
  return true;
11
- if (includeOneOf && (schema.anyOf || schema.oneOf)) {
12
- if (schema.anyOf?.some((item) => isNullable(item)))
13
- return true;
14
- if (schema.oneOf?.some((item) => isNullable(item)))
15
- return true;
16
- }
17
- return false;
11
+ const combined = schema.anyOf ?? schema.oneOf ?? schema.allOf;
12
+ if (combined && combined.some(isNullable))
13
+ return true;
14
+ return schema.type === 'null';
18
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "8.1.11",
3
+ "version": "9.0.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -46,13 +46,12 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "@fumari/json-schema-to-typescript": "^1.1.3",
49
- "@radix-ui/react-dialog": "^1.1.13",
50
- "@radix-ui/react-select": "^2.2.4",
51
- "@radix-ui/react-slot": "^1.2.2",
52
- "@scalar/openapi-parser": "0.10.17",
49
+ "@radix-ui/react-dialog": "^1.1.14",
50
+ "@radix-ui/react-select": "^2.2.5",
51
+ "@radix-ui/react-slot": "^1.2.3",
52
+ "@scalar/openapi-parser": "0.11.1",
53
53
  "ajv": "^8.17.1",
54
54
  "class-variance-authority": "^0.7.1",
55
- "fast-glob": "^3.3.3",
56
55
  "github-slugger": "^2.0.0",
57
56
  "hast-util-to-jsx-runtime": "^2.3.6",
58
57
  "js-yaml": "^4.1.0",
@@ -62,16 +61,17 @@
62
61
  "remark": "^15.0.1",
63
62
  "remark-rehype": "^11.1.2",
64
63
  "shiki": "^3.4.2",
64
+ "tinyglobby": "^0.2.13",
65
65
  "xml-js": "^1.6.11",
66
- "fumadocs-core": "15.3.3",
67
- "fumadocs-ui": "15.3.3"
66
+ "fumadocs-core": "15.4.0",
67
+ "fumadocs-ui": "15.4.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@scalar/api-client-react": "^1.2.34",
70
+ "@scalar/api-client-react": "^1.3.3",
71
71
  "@types/js-yaml": "^4.0.9",
72
- "@types/node": "22.15.18",
72
+ "@types/node": "22.15.21",
73
73
  "@types/openapi-sampler": "^1.0.3",
74
- "@types/react": "^19.1.4",
74
+ "@types/react": "^19.1.5",
75
75
  "json-schema-typed": "^8.0.1",
76
76
  "next": "15.3.2",
77
77
  "openapi-types": "^12.1.3",