fumadocs-openapi 9.0.3 → 9.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.
- package/dist/playground/auth/oauth-dialog.d.ts +4 -2
- package/dist/playground/auth/oauth-dialog.d.ts.map +1 -1
- package/dist/playground/auth/oauth-dialog.js +113 -26
- package/dist/playground/client.d.ts.map +1 -1
- package/dist/playground/client.js +101 -63
- package/dist/playground/index.js +26 -15
- package/dist/playground/inputs.d.ts +8 -2
- package/dist/playground/inputs.d.ts.map +1 -1
- package/dist/playground/inputs.js +32 -31
- package/dist/render/heading.d.ts +1 -1
- package/dist/render/heading.d.ts.map +1 -1
- package/dist/render/heading.js +3 -3
- package/dist/render/markdown.d.ts +2 -2
- package/dist/render/markdown.d.ts.map +1 -1
- package/dist/render/markdown.js +4 -2
- package/dist/render/operation/index.d.ts.map +1 -1
- package/dist/render/operation/index.js +68 -58
- package/dist/render/renderer.d.ts.map +1 -1
- package/dist/render/renderer.js +3 -3
- package/dist/render/schema.d.ts.map +1 -1
- package/dist/render/schema.js +7 -8
- package/dist/server/proxy.d.ts +16 -1
- package/dist/server/proxy.d.ts.map +1 -1
- package/dist/server/proxy.js +31 -17
- package/dist/ui/components/accordion.d.ts +8 -0
- package/dist/ui/components/accordion.d.ts.map +1 -0
- package/dist/ui/components/accordion.js +20 -0
- package/dist/ui/components/input.js +1 -1
- package/dist/ui/components/select.js +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +4 -2
- package/dist/ui/select-tabs.d.ts +13 -0
- package/dist/ui/select-tabs.d.ts.map +1 -0
- package/dist/ui/select-tabs.js +20 -0
- package/dist/ui/server-select.d.ts.map +1 -1
- package/dist/ui/server-select.js +22 -15
- package/dist/utils/schema-to-string.d.ts.map +1 -1
- package/dist/utils/schema-to-string.js +10 -1
- package/dist/utils/schema.d.ts +0 -1
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +0 -10
- package/package.json +10 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Primitive from '@radix-ui/react-accordion';
|
|
4
|
+
import { ChevronRight } from '../../icons.js';
|
|
5
|
+
import { cn } from 'fumadocs-ui/utils/cn';
|
|
6
|
+
export function Accordions(props) {
|
|
7
|
+
return (_jsx(Primitive.Root, { ...props, className: cn('divide-y divide-fd-border overflow-hidden', props.className) }));
|
|
8
|
+
}
|
|
9
|
+
export function AccordionItem(props) {
|
|
10
|
+
return (_jsx(Primitive.Item, { ...props, className: cn('scroll-m-20', props.className), children: props.children }));
|
|
11
|
+
}
|
|
12
|
+
export function AccordionContent(props) {
|
|
13
|
+
return (_jsx(Primitive.Content, { ...props, className: cn('overflow-hidden px-1 data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down', props.className), children: props.children }));
|
|
14
|
+
}
|
|
15
|
+
export function AccordionHeader(props) {
|
|
16
|
+
return (_jsx(Primitive.Header, { ...props, className: cn('not-prose flex py-2 text-fd-foreground font-medium', props.className), children: props.children }));
|
|
17
|
+
}
|
|
18
|
+
export function AccordionTrigger(props) {
|
|
19
|
+
return (_jsxs(Primitive.Trigger, { ...props, className: cn('flex flex-1 items-center gap-1 text-start group/accordion focus-visible:outline-none', props.className), children: [_jsx(ChevronRight, { className: "size-3.5 text-fd-muted-foreground shrink-0 transition-transform group-data-[state=open]/accordion:rotate-90" }), props.children] }));
|
|
20
|
+
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from 'fumadocs-ui/utils/cn';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
export const labelVariants = cva('text-xs font-medium text-fd-foreground
|
|
5
|
+
export const labelVariants = cva('text-xs font-medium text-fd-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
|
|
6
6
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
7
7
|
return (_jsx("input", { type: type, className: cn('flex h-9 w-full rounded-md border bg-fd-secondary px-2 py-1.5 text-[13px] text-fd-secondary-foreground transition-colors placeholder:text-fd-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50', className), ref: ref, ...props }));
|
|
8
8
|
});
|
|
@@ -6,7 +6,7 @@ import { cn } from 'fumadocs-ui/utils/cn';
|
|
|
6
6
|
const Select = SelectPrimitive.Root;
|
|
7
7
|
const SelectGroup = SelectPrimitive.Group;
|
|
8
8
|
const SelectValue = SelectPrimitive.Value;
|
|
9
|
-
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn('flex
|
|
9
|
+
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn('flex items-center w-full rounded-md border p-2 gap-2 text-start text-[13px] text-fd-secondary-foreground bg-fd-secondary hover:bg-fd-accent focus:outline-none focus:ring focus:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground" }) })] })));
|
|
10
10
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
11
11
|
const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn('flex items-center justify-center py-1', className), ...props, children: _jsx(ChevronUp, { className: "size-4" }) })));
|
|
12
12
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.tsx"],"names":[],"mappings":"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,MAAM,EACN,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf;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"}
|
package/dist/ui/index.js
CHANGED
|
@@ -18,12 +18,14 @@ export function API({ children, ...props }) {
|
|
|
18
18
|
}, children: children }));
|
|
19
19
|
}
|
|
20
20
|
export function Property({ name, type, required, deprecated, nested, ...props }) {
|
|
21
|
-
return (_jsxs("div", { className: cn('
|
|
21
|
+
return (_jsxs("div", { className: cn('text-sm border-t', nested
|
|
22
|
+
? 'p-3 border-x bg-fd-card last:rounded-b-xl first:rounded-tr-xl last:border-b'
|
|
23
|
+
: 'py-4 first:border-t-0'), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 not-prose", children: [_jsxs("span", { className: "font-medium font-mono text-fd-primary", children: [name, required === false && (_jsx("span", { className: "text-fd-muted-foreground", children: "?" }))] }), _jsx("span", { className: "me-auto text-xs font-mono text-fd-muted-foreground", children: type }), deprecated && (_jsx(Badge, { color: "yellow", className: "text-xs", children: "Deprecated" }))] }), _jsx("div", { className: "prose-no-margin pt-2.5 empty:hidden", children: props.children })] }));
|
|
22
24
|
}
|
|
23
25
|
export function APIExample(props) {
|
|
24
26
|
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
27
|
}
|
|
26
28
|
export function ObjectCollapsible(props) {
|
|
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
|
|
29
|
+
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'), children: [props.name, _jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { className: "-mt-px *:bg-fd-card", children: props.children })] }));
|
|
28
30
|
}
|
|
29
31
|
export { APIPage } from '../render/api-page.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import { SelectTrigger } from '../ui/components/select.js';
|
|
3
|
+
export declare function SelectTabs({ defaultValue, children, }: {
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SelectTab({ value, ...props }: ComponentProps<'div'> & {
|
|
8
|
+
value: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
10
|
+
export declare function SelectTabTrigger({ items, ...props }: ComponentProps<typeof SelectTrigger> & {
|
|
11
|
+
items: string[];
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=select-tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-tabs.d.ts","sourceRoot":"","sources":["../../src/ui/select-tabs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,aAAa,EAEd,MAAM,wBAAwB,CAAC;AAQhC,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAQA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,uDAKA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,2CAoB5D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useMemo, useState, } from 'react';
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select.js';
|
|
5
|
+
import { cn } from 'fumadocs-ui/utils/cn';
|
|
6
|
+
const Context = createContext(null);
|
|
7
|
+
export function SelectTabs({ defaultValue, children, }) {
|
|
8
|
+
const [type, setType] = useState(defaultValue ?? null);
|
|
9
|
+
return (_jsx(Context, { value: useMemo(() => ({ type, setType }), [type]), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export function SelectTab({ value, ...props }) {
|
|
12
|
+
const { type } = use(Context);
|
|
13
|
+
if (value !== type)
|
|
14
|
+
return;
|
|
15
|
+
return _jsx("div", { ...props, children: props.children });
|
|
16
|
+
}
|
|
17
|
+
export function SelectTabTrigger({ items, ...props }) {
|
|
18
|
+
const { type, setType } = use(Context);
|
|
19
|
+
return (_jsxs(Select, { value: type ?? '', onValueChange: setType, children: [_jsx(SelectTrigger, { ...props, className: cn('not-prose w-fit', props.className), children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: items.map((type) => (_jsx(SelectItem, { value: type, children: type }, type))) })] }));
|
|
20
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-select.d.ts","sourceRoot":"","sources":["../../src/ui/server-select.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,OAAO,CAAC;AAejE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"server-select.d.ts","sourceRoot":"","sources":["../../src/ui/server-select.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,OAAO,CAAC;AAejE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,uDA+CzE"}
|
package/dist/ui/server-select.js
CHANGED
|
@@ -8,7 +8,7 @@ import { cn } from 'fumadocs-ui/utils/cn';
|
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from '../ui/components/dialog.js';
|
|
9
9
|
import { getUrl } from '../utils/server-url.js';
|
|
10
10
|
import { FormProvider, useController, useForm } from 'react-hook-form';
|
|
11
|
-
import {
|
|
11
|
+
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
12
12
|
export default function ServerSelect(props) {
|
|
13
13
|
const { servers } = useApiContext();
|
|
14
14
|
const { server, setServer } = useServerSelectContext();
|
|
@@ -23,30 +23,37 @@ export default function ServerSelect(props) {
|
|
|
23
23
|
? server
|
|
24
24
|
? getUrl(server.url, server.variables)
|
|
25
25
|
: window.location.origin
|
|
26
|
-
: 'loading...' }), _jsxs(DialogContent, { ...props, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Server URL" }), _jsx(DialogDescription, { children: "The base URL of your API endpoint." })] }), _jsxs(Select, { value: server?.url, onValueChange: setServer, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: servers.map((item) => (_jsxs(SelectItem, { value: item.url, children: [item.url, _jsx("p", { className: "text-
|
|
26
|
+
: 'loading...' }), _jsxs(DialogContent, { ...props, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Server URL" }), _jsx(DialogDescription, { children: "The base URL of your API endpoint." })] }), _jsxs(Select, { value: server?.url, onValueChange: setServer, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: servers.map((item) => (_jsxs(SelectItem, { value: item.url, children: [_jsx("code", { className: "text-[13px]", children: item.url }), _jsx("p", { className: "text-fd-muted-foreground", children: item.description })] }, item.url))) })] }), server && server.variables && (_jsx(ServerSelectContent, { server: server }, server.url))] })] }));
|
|
27
27
|
}
|
|
28
|
-
function ServerSelectContent({ server
|
|
28
|
+
function ServerSelectContent({ server }) {
|
|
29
29
|
const { servers } = useApiContext();
|
|
30
30
|
const { setServerVariables } = useServerSelectContext();
|
|
31
31
|
const schema = servers.find((item) => item.url === server.url);
|
|
32
32
|
const form = useForm({
|
|
33
33
|
defaultValues: server.variables,
|
|
34
34
|
});
|
|
35
|
-
const
|
|
36
|
-
setServerVariables(
|
|
37
|
-
onClose();
|
|
35
|
+
const onChangeDebounced = useEffectEvent((values) => {
|
|
36
|
+
setServerVariables(values);
|
|
38
37
|
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
let timer = null;
|
|
40
|
+
return form.subscribe({
|
|
41
|
+
formState: {
|
|
42
|
+
values: true,
|
|
43
|
+
},
|
|
44
|
+
callback({ values }) {
|
|
45
|
+
if (timer !== null)
|
|
46
|
+
window.clearTimeout(timer);
|
|
47
|
+
timer = window.setTimeout(() => onChangeDebounced(values), 500);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `form` shouldn't be included
|
|
51
|
+
}, []);
|
|
39
52
|
if (!schema?.variables)
|
|
40
53
|
return;
|
|
41
|
-
return (_jsx(FormProvider, { ...form, children:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, children: [Object.entries(schema.variables).map(([key, variable]) => {
|
|
45
|
-
return (_jsxs("fieldset", { className: "flex flex-col gap-1", children: [_jsx("label", { className: cn(labelVariants()), htmlFor: key, children: key }), _jsx("p", { className: "text-xs text-fd-muted-foreground empty:hidden", children: variable.description }), _jsx(Field, { fieldName: key, variable: variable })] }, key));
|
|
46
|
-
}), _jsx("button", { type: "submit", className: cn(buttonVariants({
|
|
47
|
-
color: 'primary',
|
|
48
|
-
className: 'mt-2',
|
|
49
|
-
})), children: "Save" })] }) }));
|
|
54
|
+
return (_jsx(FormProvider, { ...form, children: _jsx("div", { className: "flex flex-col gap-4", children: Object.entries(schema.variables).map(([key, variable]) => {
|
|
55
|
+
return (_jsxs("fieldset", { className: "flex flex-col gap-1", children: [_jsx("label", { className: cn(labelVariants()), htmlFor: key, children: key }), _jsx("p", { className: "text-xs text-fd-muted-foreground empty:hidden", children: variable.description }), _jsx(Field, { fieldName: key, variable: variable })] }, key));
|
|
56
|
+
}) }) }));
|
|
50
57
|
}
|
|
51
58
|
function Field({ fieldName, variable, }) {
|
|
52
59
|
const { field } = useController({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-to-string.d.ts","sourceRoot":"","sources":["../../src/utils/schema-to-string.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"schema-to-string.d.ts","sourceRoot":"","sources":["../../src/utils/schema-to-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,UAAO,GAAG,MAAM,CA0D5E"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isNullable } from '../utils/schema.js';
|
|
2
1
|
export function schemaToString(schema, isRoot = true) {
|
|
3
2
|
if (schema === true)
|
|
4
3
|
return 'any';
|
|
@@ -47,3 +46,13 @@ export function schemaToString(schema, isRoot = true) {
|
|
|
47
46
|
}
|
|
48
47
|
return 'unknown';
|
|
49
48
|
}
|
|
49
|
+
function isNullable(schema) {
|
|
50
|
+
if (typeof schema === 'boolean')
|
|
51
|
+
return false;
|
|
52
|
+
if (Array.isArray(schema.type) && schema.type.includes('null'))
|
|
53
|
+
return true;
|
|
54
|
+
const combined = schema.anyOf ?? schema.oneOf ?? schema.allOf;
|
|
55
|
+
if (combined && combined.some(isNullable))
|
|
56
|
+
return true;
|
|
57
|
+
return schema.type === 'null';
|
|
58
|
+
}
|
package/dist/utils/schema.d.ts
CHANGED
|
@@ -9,6 +9,5 @@ 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): boolean;
|
|
13
12
|
export {};
|
|
14
13
|
//# 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,EA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AC,GAAG,SAAS,CAIrB"}
|
package/dist/utils/schema.js
CHANGED
|
@@ -3,13 +3,3 @@ export function getPreferredType(body) {
|
|
|
3
3
|
return 'application/json';
|
|
4
4
|
return Object.keys(body)[0];
|
|
5
5
|
}
|
|
6
|
-
export function isNullable(schema) {
|
|
7
|
-
if (typeof schema === 'boolean')
|
|
8
|
-
return false;
|
|
9
|
-
if (Array.isArray(schema.type) && schema.type.includes('null'))
|
|
10
|
-
return true;
|
|
11
|
-
const combined = schema.anyOf ?? schema.oneOf ?? schema.allOf;
|
|
12
|
-
if (combined && combined.some(isNullable))
|
|
13
|
-
return true;
|
|
14
|
-
return schema.type === 'null';
|
|
15
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.5",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -46,10 +46,11 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fumari/json-schema-to-typescript": "^1.1.3",
|
|
49
|
+
"@radix-ui/react-accordion": "^1.2.11",
|
|
49
50
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
50
51
|
"@radix-ui/react-select": "^2.2.5",
|
|
51
52
|
"@radix-ui/react-slot": "^1.2.3",
|
|
52
|
-
"@scalar/openapi-parser": "0.
|
|
53
|
+
"@scalar/openapi-parser": "0.13.0",
|
|
53
54
|
"ajv": "^8.17.1",
|
|
54
55
|
"class-variance-authority": "^0.7.1",
|
|
55
56
|
"github-slugger": "^2.0.0",
|
|
@@ -63,19 +64,19 @@
|
|
|
63
64
|
"shiki": "^3.4.2",
|
|
64
65
|
"tinyglobby": "^0.2.14",
|
|
65
66
|
"xml-js": "^1.6.11",
|
|
66
|
-
"fumadocs-core": "15.
|
|
67
|
-
"fumadocs-ui": "15.
|
|
67
|
+
"fumadocs-core": "15.5.0",
|
|
68
|
+
"fumadocs-ui": "15.5.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
|
-
"@scalar/api-client-react": "^1.3.
|
|
71
|
+
"@scalar/api-client-react": "^1.3.5",
|
|
71
72
|
"@types/js-yaml": "^4.0.9",
|
|
72
|
-
"@types/node": "22.15.
|
|
73
|
+
"@types/node": "22.15.28",
|
|
73
74
|
"@types/openapi-sampler": "^1.0.3",
|
|
74
|
-
"@types/react": "^19.1.
|
|
75
|
+
"@types/react": "^19.1.6",
|
|
75
76
|
"json-schema-typed": "^8.0.1",
|
|
76
|
-
"next": "15.3.
|
|
77
|
+
"next": "15.3.3",
|
|
77
78
|
"openapi-types": "^12.1.3",
|
|
78
|
-
"tailwindcss": "^4.1.
|
|
79
|
+
"tailwindcss": "^4.1.8",
|
|
79
80
|
"tsc-alias": "^1.8.16",
|
|
80
81
|
"eslint-config-custom": "0.0.0",
|
|
81
82
|
"tsconfig": "0.0.0"
|