fumadocs-openapi 7.0.1 → 7.0.2
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/client.d.ts +1 -1
- package/dist/playground/client.d.ts.map +1 -1
- package/dist/playground/client.js +32 -23
- package/dist/render/codeblock.d.ts +2 -2
- package/dist/render/codeblock.d.ts.map +1 -1
- package/dist/render/codeblock.js +2 -2
- package/dist/render/operation/api-example.js +5 -4
- package/package.json +3 -3
|
@@ -61,6 +61,6 @@ export type DynamicField = {
|
|
|
61
61
|
schema: RequestSchema | ReferenceSchema;
|
|
62
62
|
};
|
|
63
63
|
export declare function useSchemaContext(): SchemaContextType;
|
|
64
|
-
export declare function Client({ route, method, authorization, parameters, body, fields, references, proxyUrl, components: { ResultDisplay }, ...
|
|
64
|
+
export declare function Client({ route, method, authorization, parameters, body, fields, references, proxyUrl, components: { ResultDisplay }, ...rest }: ClientProps): import("react/jsx-runtime").JSX.Element;
|
|
65
65
|
export {};
|
|
66
66
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/playground/client.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EAInB,KAAK,EAAE,EAGP,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAa5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AASrD,UAAU,UAAU;IAClB,aAAa,EACT,MAAM,GACN;QACE,QAAQ,EAAE,MAAM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W,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QACnD,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;KAC3C,CAAC;IAEF,UAAU,CAAC,EAAE,OAAO,CAAC;QACnB,aAAa,EAAE,EAAE,CAAC;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KAC1C,CAAC,CAAC;CACJ,CAAC;AAEF,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,aAAa,GAAG,eAAe,CAAC;CACzC,CAAC;AAIN,wBAAgB,gBAAgB,IAAI,iBAAiB,CAIpD;AAkBD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,MAAc,EACd,aAAa,EACb,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,UAAU,EAAE,EAAE,aAAoC,EAAO,EACzD,GAAG,IAAI,EACR,EAAE,WAAW,2CAuHb"}
|
|
@@ -12,7 +12,7 @@ import { MethodLabel } from '../ui/components/method-label.js';
|
|
|
12
12
|
import { useQuery } from '../utils/use-query.js';
|
|
13
13
|
import ServerSelect from '../ui/server-select.js';
|
|
14
14
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
|
|
15
|
-
import { ChevronDown } from 'lucide-react';
|
|
15
|
+
import { ChevronDown, Loader2 } from 'lucide-react';
|
|
16
16
|
import { OauthDialog, OauthDialogTrigger, } from '../playground/auth/oauth-dialog.js';
|
|
17
17
|
import { useRequestData } from '../ui/contexts/code-example.js';
|
|
18
18
|
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
@@ -34,17 +34,8 @@ function toRequestData(method, mediaType, value) {
|
|
|
34
34
|
query: value.query,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export function Client({ route, method = 'GET', authorization, parameters
|
|
38
|
-
const {
|
|
39
|
-
const { server, setServer, setServerVariables } = useServerSelectContext();
|
|
40
|
-
const params = useMemo(() => {
|
|
41
|
-
return {
|
|
42
|
-
headers: parameters.filter((v) => v.in === 'header'),
|
|
43
|
-
cookies: parameters.filter((v) => v.in === 'cookie'),
|
|
44
|
-
queries: parameters.filter((v) => v.in === 'query'),
|
|
45
|
-
paths: parameters.filter((v) => v.in === 'path'),
|
|
46
|
-
};
|
|
47
|
-
}, [parameters]);
|
|
37
|
+
export function Client({ route, method = 'GET', authorization, parameters, body, fields, references, proxyUrl, components: { ResultDisplay = DefaultResultDisplay } = {}, ...rest }) {
|
|
38
|
+
const { server } = useServerSelectContext();
|
|
48
39
|
const dynamicRef = useRef(new Map());
|
|
49
40
|
const requestData = useRequestData();
|
|
50
41
|
const authInfo = usePersistentAuthInfo(authorization);
|
|
@@ -90,13 +81,34 @@ export function Client({ route, method = 'GET', authorization, parameters = [],
|
|
|
90
81
|
const onSubmit = form.handleSubmit((value) => {
|
|
91
82
|
testQuery.start(value);
|
|
92
83
|
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
84
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...rest, className: cn('not-prose flex flex-col rounded-xl border p-3 gap-3 shadow-md overflow-hidden', rest.className), onSubmit: onSubmit, children: [_jsxs("div", { className: "flex flex-row items-center gap-2 text-sm", children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: testQuery.isLoading, children: testQuery.isLoading ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : ('Send') })] }), _jsx(FormBody, { body: body, fields: fields, parameters: parameters, authorization: authorization }), testQuery.data ? _jsx(ResultDisplay, { data: testQuery.data }) : null] }) }) }) }));
|
|
85
|
+
}
|
|
86
|
+
const paramNames = ['Headers', 'Cookies', 'Query', 'Path'];
|
|
87
|
+
const paramTypes = ['header', 'cookie', 'query', 'path'];
|
|
88
|
+
function FormBody({ authorization, parameters = [], body, fields = {}, }) {
|
|
89
|
+
const { servers } = useApiContext();
|
|
90
|
+
const { server, setServer, setServerVariables } = useServerSelectContext();
|
|
91
|
+
const params = useMemo(() => {
|
|
92
|
+
return paramTypes.map((param) => parameters.filter((v) => v.in === param));
|
|
93
|
+
}, [parameters]);
|
|
94
|
+
return (_jsxs(_Fragment, { children: [servers.length > 1 ? (_jsx(CollapsiblePanel, { title: "Server URL", children: _jsx(ServerSelect, { server: server, onServerChanged: setServer, onVariablesChanged: setServerVariables }) })) : null, params.map((param, i) => {
|
|
95
|
+
const name = paramNames[i];
|
|
96
|
+
const type = paramTypes[i];
|
|
97
|
+
if ((param.length === 0 && type !== 'header') || !authorization)
|
|
98
|
+
return;
|
|
99
|
+
return (_jsxs(CollapsiblePanel, { title: name, children: [type === 'header' && authorization ? (_jsx(AuthField, { authorization: authorization })) : null, param.map((field) => {
|
|
100
|
+
const fieldName = `${type}.${field.name}`;
|
|
101
|
+
if (!fields?.parameter) {
|
|
102
|
+
return (_jsx(FieldSet, { name: field.name, fieldName: fieldName, field: field }, fieldName));
|
|
103
|
+
}
|
|
104
|
+
return renderCustomField(fieldName, field, fields.parameter, field.name);
|
|
105
|
+
})] }, name));
|
|
106
|
+
}), body ? (_jsx(CollapsiblePanel, { title: "Body", children: fields.body ? (renderCustomField('body', body, fields.body)) : body.type === 'object' ? (_jsx(ObjectInput, { field: body, fieldName: "body" })) : (_jsx(FieldSet, { field: body, fieldName: "body" })) })) : null] }));
|
|
107
|
+
}
|
|
108
|
+
function renderCustomField(fieldName, info, field, key) {
|
|
109
|
+
return (_jsx(Controller, {
|
|
110
|
+
// @ts-expect-error we use string here
|
|
111
|
+
render: (props) => field.render({ ...props, info }), name: fieldName }, key));
|
|
100
112
|
}
|
|
101
113
|
function AuthProvider({ authorization, children, }) {
|
|
102
114
|
const form = useFormContext();
|
|
@@ -134,9 +146,6 @@ function Route({ route, ...props }) {
|
|
|
134
146
|
const segments = route.split('/').filter((part) => part.length > 0);
|
|
135
147
|
return (_jsx("div", { ...props, className: cn('flex flex-row items-center gap-0.5 overflow-auto text-nowrap', props.className), children: segments.map((part, index) => (_jsxs(Fragment, { children: [_jsx("span", { className: "text-fd-muted-foreground", children: "/" }), part.startsWith('{') && part.endsWith('}') ? (_jsx("code", { className: "bg-fd-primary/10 text-fd-primary", children: part })) : (_jsx("code", { className: "text-fd-foreground", children: part }))] }, index))) }));
|
|
136
148
|
}
|
|
137
|
-
function FormHeader({ route, method, isLoading, ...props }) {
|
|
138
|
-
return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-2 text-sm', props.className), children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: isLoading, children: "Send" })] }));
|
|
139
|
-
}
|
|
140
149
|
function DefaultResultDisplay({ data }) {
|
|
141
150
|
const statusInfo = useMemo(() => getStatusInfo(data.status), [data.status]);
|
|
142
151
|
const { shikiOptions } = useApiContext();
|
|
@@ -144,7 +153,7 @@ function DefaultResultDisplay({ data }) {
|
|
|
144
153
|
? 'text'
|
|
145
154
|
: data.type, code: typeof data.data === 'string'
|
|
146
155
|
? data.data
|
|
147
|
-
: JSON.stringify(data.data, null, 2),
|
|
156
|
+
: JSON.stringify(data.data, null, 2), options: shikiOptions })) : null] }));
|
|
148
157
|
}
|
|
149
158
|
function usePersistentAuthInfo(authorization) {
|
|
150
159
|
const key = authorization
|
|
@@ -3,7 +3,7 @@ import type { RenderContext } from '../types.js';
|
|
|
3
3
|
export type CodeBlockProps = HTMLAttributes<HTMLPreElement> & {
|
|
4
4
|
code: string;
|
|
5
5
|
lang: string;
|
|
6
|
-
|
|
6
|
+
ctx: RenderContext;
|
|
7
7
|
};
|
|
8
|
-
export declare function CodeBlock({ code, lang,
|
|
8
|
+
export declare function CodeBlock({ code, lang, ctx, ...rest }: CodeBlockProps): Promise<React.ReactElement>;
|
|
9
9
|
//# sourceMappingURL=codeblock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/render/codeblock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/render/codeblock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,aAAa,CAAC;CACpB,CAAC;AAEF,wBAAsB,SAAS,CAAC,EAC9B,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAU9C"}
|
package/dist/render/codeblock.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as Base from 'fumadocs-ui/components/codeblock';
|
|
3
3
|
import { highlight } from 'fumadocs-core/highlight';
|
|
4
|
-
export async function CodeBlock({ code, lang,
|
|
4
|
+
export async function CodeBlock({ code, lang, ctx, ...rest }) {
|
|
5
5
|
const rendered = await highlight(code, {
|
|
6
6
|
lang,
|
|
7
|
-
...
|
|
7
|
+
...ctx.shikiOptions,
|
|
8
8
|
components: {
|
|
9
9
|
pre: (props) => _jsx(Base.Pre, { ...props, ...rest }),
|
|
10
10
|
},
|
|
@@ -85,7 +85,8 @@ function dedupe(samples) {
|
|
|
85
85
|
}
|
|
86
86
|
return out;
|
|
87
87
|
}
|
|
88
|
-
function ResponseTabs({ operation, ctx
|
|
88
|
+
function ResponseTabs({ operation, ctx, }) {
|
|
89
|
+
const { renderer, generateTypeScriptSchema, schema } = ctx;
|
|
89
90
|
if (!operation.responses)
|
|
90
91
|
return null;
|
|
91
92
|
async function renderResponse(code) {
|
|
@@ -111,14 +112,14 @@ function ResponseTabs({ operation, ctx: { renderer, generateTypeScriptSchema, sc
|
|
|
111
112
|
exampleSlot = Object.entries(responseOfType.examples).map(([key, sample], i) => {
|
|
112
113
|
const title = sample?.summary ?? `Example ${i + 1}`;
|
|
113
114
|
values.push(title);
|
|
114
|
-
return (_jsxs(renderer.ResponseType, { label: title, children: [sample?.description ? (_jsx(Markdown, { text: sample.description })) : null, _jsx(CodeBlock, { lang: "json", code: JSON.stringify(sample.value, null, 2) })] }, key));
|
|
115
|
+
return (_jsxs(renderer.ResponseType, { label: title, children: [sample?.description ? (_jsx(Markdown, { text: sample.description })) : null, _jsx(CodeBlock, { lang: "json", code: JSON.stringify(sample.value, null, 2), ctx: ctx })] }, key));
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
else if (responseOfType?.example || responseOfType?.schema) {
|
|
118
119
|
values.push('Response');
|
|
119
|
-
exampleSlot = (_jsx(renderer.ResponseType, { label: "Response", children: _jsx(CodeBlock, { lang: "json", code: JSON.stringify(responseOfType.example ?? sample(responseOfType.schema), null, 2) }) }));
|
|
120
|
+
exampleSlot = (_jsx(renderer.ResponseType, { label: "Response", children: _jsx(CodeBlock, { lang: "json", code: JSON.stringify(responseOfType.example ?? sample(responseOfType.schema), null, 2), ctx: ctx }) }));
|
|
120
121
|
}
|
|
121
|
-
return (_jsxs(renderer.Response, { value: code, children: [description ? _jsx(Markdown, { text: description }) : null, exampleSlot ? (_jsxs(renderer.ResponseTypes, { defaultValue: values[0], children: [exampleSlot, ts ? (_jsx(renderer.ResponseType, { label: "TypeScript", children: _jsx(CodeBlock, {
|
|
122
|
+
return (_jsxs(renderer.Response, { value: code, children: [description ? _jsx(Markdown, { text: description }) : null, exampleSlot ? (_jsxs(renderer.ResponseTypes, { defaultValue: values[0], children: [exampleSlot, ts ? (_jsx(renderer.ResponseType, { label: "TypeScript", children: _jsx(CodeBlock, { lang: "ts", code: ts, ctx: ctx }) })) : null] })) : null] }));
|
|
122
123
|
}
|
|
123
124
|
const codes = Object.keys(operation.responses);
|
|
124
125
|
if (codes.length === 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"remark-rehype": "^11.1.1",
|
|
63
63
|
"shiki": "^3.2.1",
|
|
64
64
|
"xml-js": "^1.6.11",
|
|
65
|
-
"fumadocs-core": "15.0.
|
|
66
|
-
"fumadocs-ui": "15.0.
|
|
65
|
+
"fumadocs-core": "15.0.18",
|
|
66
|
+
"fumadocs-ui": "15.0.18"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@scalar/api-client-react": "^1.2.1",
|