fumadocs-openapi 5.11.2 → 5.11.4
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.d.ts +6 -1
- package/dist/server/index.d.ts +5 -1
- package/dist/server/index.js +79 -46
- package/dist/ui/{client-client-Dxsry8Mu.js → client-client-Co3JBILS.js} +7 -7
- package/dist/ui/{fetcher-C0NHTJev.js → fetcher-DLRl_kVF.js} +1 -1
- package/dist/ui/{index-client-wsc_5cAY.js → index-client-cz-xNo9A.js} +45 -39
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +2 -2
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -179,6 +179,7 @@ type ReferenceObject = OpenAPIV3_1.ReferenceObject;
|
|
|
179
179
|
type PathItemObject = OpenAPIV3_1.PathItemObject;
|
|
180
180
|
type TagObject = OpenAPIV3_1.TagObject;
|
|
181
181
|
type ServerObject = NoReference<OpenAPIV3_1.ServerObject>;
|
|
182
|
+
type CallbackObject = NoReference<OpenAPIV3_1.CallbackObject>;
|
|
182
183
|
type MethodInformation = NoReference<OperationObject> & {
|
|
183
184
|
method: string;
|
|
184
185
|
};
|
|
@@ -215,6 +216,10 @@ interface RenderContext {
|
|
|
215
216
|
*/
|
|
216
217
|
generateCodeSamples?: (endpoint: EndpointSample) => Awaitable<CodeSample[]>;
|
|
217
218
|
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
219
|
+
/**
|
|
220
|
+
* Show full response schema instead of only example response & Typescript definitions
|
|
221
|
+
*/
|
|
222
|
+
showResponseSchema?: boolean;
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
|
|
@@ -317,4 +322,4 @@ interface Config extends GenerateOptions {
|
|
|
317
322
|
}
|
|
318
323
|
declare function generateFiles(options: Config): Promise<void>;
|
|
319
324
|
|
|
320
|
-
export { type Config, type DereferenceMap, type Document, type GenerateOptions, type GeneratePageOutput, type GenerateTagOutput, type MethodInformation, type OperationObject, type ParameterObject, type PathItemObject, type ReferenceObject, type RenderContext, type SecurityRequirementObject, type SecuritySchemeObject, type ServerObject, type TagObject, generateAll, generateFiles, generatePages, generateTags };
|
|
325
|
+
export { type CallbackObject, type Config, type DereferenceMap, type Document, type GenerateOptions, type GeneratePageOutput, type GenerateTagOutput, type MethodInformation, type OperationObject, type ParameterObject, type PathItemObject, type ReferenceObject, type RenderContext, type SecurityRequirementObject, type SecuritySchemeObject, type ServerObject, type TagObject, generateAll, generateFiles, generatePages, generateTags };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -208,11 +208,15 @@ interface RenderContext {
|
|
|
208
208
|
*/
|
|
209
209
|
generateCodeSamples?: (endpoint: EndpointSample) => Awaitable<CodeSample[]>;
|
|
210
210
|
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
211
|
+
/**
|
|
212
|
+
* Show full response schema instead of only example response & Typescript definitions
|
|
213
|
+
*/
|
|
214
|
+
showResponseSchema?: boolean;
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
type DocumentInput = string | OpenAPIV3_1.Document | OpenAPIV3.Document;
|
|
214
218
|
|
|
215
|
-
type ApiPageContextProps = Pick<Partial<RenderContext>, 'shikiOptions' | 'generateTypeScriptSchema' | 'generateCodeSamples' | 'proxyUrl'>;
|
|
219
|
+
type ApiPageContextProps = Pick<Partial<RenderContext>, 'shikiOptions' | 'generateTypeScriptSchema' | 'generateCodeSamples' | 'proxyUrl' | 'showResponseSchema'>;
|
|
216
220
|
interface ApiPageProps extends ApiPageContextProps {
|
|
217
221
|
document: DocumentInput;
|
|
218
222
|
hasHead: boolean;
|
package/dist/server/index.js
CHANGED
|
@@ -796,6 +796,7 @@ function Operation({ type = 'operation', path, method, ctx, hasHead, headingLeve
|
|
|
796
796
|
const security = method.security ?? ctx.document.security;
|
|
797
797
|
let headNode = null;
|
|
798
798
|
let bodyNode = null;
|
|
799
|
+
let responseNode = null;
|
|
799
800
|
let callbacksNode = null;
|
|
800
801
|
if (hasHead) {
|
|
801
802
|
const title = method.summary ?? (method.operationId ? idToTitle(method.operationId) : path);
|
|
@@ -843,6 +844,38 @@ function Operation({ type = 'operation', path, method, ctx, hasHead, headingLeve
|
|
|
843
844
|
]
|
|
844
845
|
});
|
|
845
846
|
}
|
|
847
|
+
if (method.responses && ctx.showResponseSchema) {
|
|
848
|
+
responseNode = /*#__PURE__*/ jsxs(Fragment, {
|
|
849
|
+
children: [
|
|
850
|
+
heading(headingLevel, 'Response Body', ctx),
|
|
851
|
+
Object.entries(method.responses).map(([status, response])=>{
|
|
852
|
+
if (!response.content) return;
|
|
853
|
+
const mediaType = getPreferredType(response.content);
|
|
854
|
+
if (!mediaType) return null;
|
|
855
|
+
const content = response.content[mediaType];
|
|
856
|
+
if (!content.schema) return null;
|
|
857
|
+
return /*#__PURE__*/ jsxs(Fragment$1, {
|
|
858
|
+
children: [
|
|
859
|
+
heading(headingLevel + 1, status, ctx),
|
|
860
|
+
/*#__PURE__*/ jsx(Markdown, {
|
|
861
|
+
text: response.description
|
|
862
|
+
}),
|
|
863
|
+
/*#__PURE__*/ jsx(Schema, {
|
|
864
|
+
name: "response",
|
|
865
|
+
schema: content.schema,
|
|
866
|
+
ctx: {
|
|
867
|
+
render: ctx,
|
|
868
|
+
writeOnly: false,
|
|
869
|
+
readOnly: true,
|
|
870
|
+
required: true
|
|
871
|
+
}
|
|
872
|
+
})
|
|
873
|
+
]
|
|
874
|
+
}, status);
|
|
875
|
+
})
|
|
876
|
+
]
|
|
877
|
+
});
|
|
878
|
+
}
|
|
846
879
|
const parameterGroups = new Map();
|
|
847
880
|
const endpoint = generateSample(path, method, ctx);
|
|
848
881
|
for (const param of method.parameters ?? []){
|
|
@@ -877,28 +910,11 @@ function Operation({ type = 'operation', path, method, ctx, hasHead, headingLeve
|
|
|
877
910
|
callbacksNode = /*#__PURE__*/ jsxs(Fragment, {
|
|
878
911
|
children: [
|
|
879
912
|
heading(headingLevel, 'Webhooks', ctx),
|
|
880
|
-
Object.entries(method.callbacks).map(([name, callback])
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
return /*#__PURE__*/ jsx(Operation, {
|
|
886
|
-
type: "webhook",
|
|
887
|
-
hasHead: true,
|
|
888
|
-
path: path,
|
|
889
|
-
headingLevel: headingLevel + 1,
|
|
890
|
-
method: createMethod(method, pathItem, operation),
|
|
891
|
-
ctx: ctx
|
|
892
|
-
}, method);
|
|
893
|
-
});
|
|
894
|
-
return /*#__PURE__*/ jsx(Fragment$1, {
|
|
895
|
-
children: pathNodes
|
|
896
|
-
}, path);
|
|
897
|
-
});
|
|
898
|
-
return /*#__PURE__*/ jsx(Fragment$1, {
|
|
899
|
-
children: nodes
|
|
900
|
-
}, name);
|
|
901
|
-
})
|
|
913
|
+
Object.entries(method.callbacks).map(([name, callback])=>/*#__PURE__*/ jsx(WebhookCallback, {
|
|
914
|
+
callback: callback,
|
|
915
|
+
ctx: ctx,
|
|
916
|
+
headingLevel: headingLevel
|
|
917
|
+
}, name))
|
|
902
918
|
]
|
|
903
919
|
});
|
|
904
920
|
}
|
|
@@ -930,6 +946,7 @@ function Operation({ type = 'operation', path, method, ctx, hasHead, headingLeve
|
|
|
930
946
|
]
|
|
931
947
|
}, group);
|
|
932
948
|
}),
|
|
949
|
+
responseNode,
|
|
933
950
|
callbacksNode
|
|
934
951
|
]
|
|
935
952
|
});
|
|
@@ -1005,6 +1022,25 @@ async function APIExample({ method, endpoint, ctx }) {
|
|
|
1005
1022
|
children: children
|
|
1006
1023
|
});
|
|
1007
1024
|
}
|
|
1025
|
+
function WebhookCallback({ callback, ctx, headingLevel }) {
|
|
1026
|
+
return Object.entries(callback).map(([path, pathItem])=>{
|
|
1027
|
+
const pathNodes = methodKeys.map((method)=>{
|
|
1028
|
+
const operation = pathItem[method];
|
|
1029
|
+
if (!operation) return null;
|
|
1030
|
+
return /*#__PURE__*/ jsx(Operation, {
|
|
1031
|
+
type: "webhook",
|
|
1032
|
+
hasHead: true,
|
|
1033
|
+
path: path,
|
|
1034
|
+
headingLevel: headingLevel + 1,
|
|
1035
|
+
method: createMethod(method, pathItem, operation),
|
|
1036
|
+
ctx: ctx
|
|
1037
|
+
}, method);
|
|
1038
|
+
});
|
|
1039
|
+
return /*#__PURE__*/ jsx(Fragment$1, {
|
|
1040
|
+
children: pathNodes
|
|
1041
|
+
}, path);
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1008
1044
|
/**
|
|
1009
1045
|
* Remove duplicated labels
|
|
1010
1046
|
*/ function dedupe(samples) {
|
|
@@ -1031,28 +1067,7 @@ function AuthSection({ ctx: { document, renderer }, requirements }) {
|
|
|
1031
1067
|
})
|
|
1032
1068
|
]
|
|
1033
1069
|
}) : null;
|
|
1034
|
-
if (schema.type === 'http') {
|
|
1035
|
-
info.push(/*#__PURE__*/ jsxs(renderer.Property, {
|
|
1036
|
-
name: "Authorization",
|
|
1037
|
-
type: prefix ? `${prefix} <token>` : '<token>',
|
|
1038
|
-
required: true,
|
|
1039
|
-
children: [
|
|
1040
|
-
schema.description ? /*#__PURE__*/ jsx(Markdown, {
|
|
1041
|
-
text: schema.description
|
|
1042
|
-
}) : null,
|
|
1043
|
-
/*#__PURE__*/ jsxs("p", {
|
|
1044
|
-
children: [
|
|
1045
|
-
"In: ",
|
|
1046
|
-
/*#__PURE__*/ jsx("code", {
|
|
1047
|
-
children: "header"
|
|
1048
|
-
}),
|
|
1049
|
-
scopeElement
|
|
1050
|
-
]
|
|
1051
|
-
})
|
|
1052
|
-
]
|
|
1053
|
-
}, id++));
|
|
1054
|
-
}
|
|
1055
|
-
if (schema.type === 'oauth2') {
|
|
1070
|
+
if (schema.type === 'http' || schema.type === 'oauth2') {
|
|
1056
1071
|
info.push(/*#__PURE__*/ jsxs(renderer.Property, {
|
|
1057
1072
|
name: "Authorization",
|
|
1058
1073
|
type: prefix ? `${prefix} <token>` : '<token>',
|
|
@@ -1251,6 +1266,14 @@ const cache = new Map();
|
|
|
1251
1266
|
return processed;
|
|
1252
1267
|
}
|
|
1253
1268
|
|
|
1269
|
+
function getUrl(url, variables) {
|
|
1270
|
+
let out = url;
|
|
1271
|
+
for (const [key, value] of Object.entries(variables)){
|
|
1272
|
+
out = out.replaceAll(`{${key}}`, value);
|
|
1273
|
+
}
|
|
1274
|
+
return out;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1254
1277
|
async function APIPage(props) {
|
|
1255
1278
|
const { operations, hasHead = true, webhooks, disableCache = process.env.NODE_ENV === 'development' } = props;
|
|
1256
1279
|
const processed = await processDocument(props.document, disableCache);
|
|
@@ -1294,10 +1317,17 @@ async function APIPage(props) {
|
|
|
1294
1317
|
});
|
|
1295
1318
|
}
|
|
1296
1319
|
async function getContext({ document, dereferenceMap }, options = {}) {
|
|
1320
|
+
const servers = document.servers && document.servers.length > 0 ? document.servers : [
|
|
1321
|
+
{
|
|
1322
|
+
url: 'https://example.com'
|
|
1323
|
+
}
|
|
1324
|
+
];
|
|
1325
|
+
const server = servers[0];
|
|
1297
1326
|
return {
|
|
1298
1327
|
document: document,
|
|
1299
1328
|
dereferenceMap,
|
|
1300
1329
|
proxyUrl: options.proxyUrl,
|
|
1330
|
+
showResponseSchema: options.showResponseSchema,
|
|
1301
1331
|
renderer: {
|
|
1302
1332
|
...createRenders(options.shikiOptions),
|
|
1303
1333
|
...options.renderer
|
|
@@ -1305,8 +1335,11 @@ async function getContext({ document, dereferenceMap }, options = {}) {
|
|
|
1305
1335
|
shikiOptions: options.shikiOptions,
|
|
1306
1336
|
generateTypeScriptSchema: options.generateTypeScriptSchema,
|
|
1307
1337
|
generateCodeSamples: options.generateCodeSamples,
|
|
1308
|
-
baseUrl:
|
|
1309
|
-
|
|
1338
|
+
baseUrl: getUrl(server.url, server.variables ? Object.fromEntries(Object.entries(server.variables).map(([k, v])=>[
|
|
1339
|
+
k,
|
|
1340
|
+
v.default
|
|
1341
|
+
])) : {}),
|
|
1342
|
+
servers,
|
|
1310
1343
|
slugger: new Slugger()
|
|
1311
1344
|
};
|
|
1312
1345
|
}
|
|
@@ -314,14 +314,14 @@ const Select = SelectPrimitive.Root;
|
|
|
314
314
|
const SelectValue = SelectPrimitive.Value;
|
|
315
315
|
const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(SelectPrimitive.Trigger, {
|
|
316
316
|
ref: ref,
|
|
317
|
-
className: cn('flex h-10 items-center
|
|
317
|
+
className: cn('flex h-10 items-center rounded-md border px-3 py-2 text-start text-sm text-fd-foreground hover:bg-fd-accent focus:outline-none focus:ring-2 focus:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50', className),
|
|
318
318
|
...props,
|
|
319
319
|
children: [
|
|
320
320
|
children,
|
|
321
321
|
/*#__PURE__*/ jsx(SelectPrimitive.Icon, {
|
|
322
322
|
asChild: true,
|
|
323
323
|
children: /*#__PURE__*/ jsx(ChevronDown, {
|
|
324
|
-
className: "size-4 text-fd-muted-foreground"
|
|
324
|
+
className: "ms-auto size-4 text-fd-muted-foreground"
|
|
325
325
|
})
|
|
326
326
|
})
|
|
327
327
|
]
|
|
@@ -407,7 +407,7 @@ function useSchemaContext() {
|
|
|
407
407
|
return ctx;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
const APIPlayground = dynamic(()=>import('./index-client-
|
|
410
|
+
const APIPlayground = dynamic(()=>import('./index-client-cz-xNo9A.js').then(function (n) { return n.i; }).then((mod)=>mod.APIPlayground));
|
|
411
411
|
function Root({ children, baseUrl, className, shikiOptions, servers, ...props }) {
|
|
412
412
|
return /*#__PURE__*/ jsx("div", {
|
|
413
413
|
className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
|
|
@@ -450,11 +450,11 @@ function ServerSelect() {
|
|
|
450
450
|
className: "-m-2 mt-2",
|
|
451
451
|
children: [
|
|
452
452
|
/*#__PURE__*/ jsxs(CollapsibleTrigger, {
|
|
453
|
-
className: "flex w-full flex-row items-center justify-between p-2 text-xs font-medium",
|
|
453
|
+
className: "flex w-full flex-row items-center justify-between p-2 text-xs font-medium text-fd-muted-foreground",
|
|
454
454
|
children: [
|
|
455
455
|
"Configure Server",
|
|
456
456
|
/*#__PURE__*/ jsx(ChevronDown, {
|
|
457
|
-
className: "size-4
|
|
457
|
+
className: "size-4"
|
|
458
458
|
})
|
|
459
459
|
]
|
|
460
460
|
}),
|
|
@@ -467,7 +467,7 @@ function ServerSelect() {
|
|
|
467
467
|
onValueChange: setServer,
|
|
468
468
|
children: [
|
|
469
469
|
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
470
|
-
className: "h-auto",
|
|
470
|
+
className: "h-auto break-all",
|
|
471
471
|
children: /*#__PURE__*/ jsx(SelectValue, {})
|
|
472
472
|
}),
|
|
473
473
|
/*#__PURE__*/ jsx(SelectContent, {
|
|
@@ -535,4 +535,4 @@ function ServerSelect() {
|
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
-
export { APIPlayground as A, CircleCheck as C, Input as I, Plus as P, Root as R, Select as S, Trash2 as T, SelectTrigger as a, SelectValue as b, SelectContent as c, SelectItem as d, CircleX as e, useApiContext as f, SchemaContext as g,
|
|
538
|
+
export { APIPlayground as A, CircleCheck as C, Input as I, Plus as P, Root as R, Select as S, Trash2 as T, SelectTrigger as a, SelectValue as b, SelectContent as c, SelectItem as d, CircleX as e, useApiContext as f, SchemaContext as g, ChevronDown as h, getUrl as i, CopyRouteButton as j, ServerSelect as k, useSchemaContext as u };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useId, createContext, useContext, useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
|
4
4
|
import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWatch } from 'react-hook-form';
|
|
5
|
-
import {
|
|
5
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from 'fumadocs-ui/components/ui/collapsible';
|
|
6
6
|
import { cn, buttonVariants } from 'fumadocs-ui/components/api';
|
|
7
|
-
import { u as useSchemaContext, T as Trash2, I as Input, S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem, P as Plus, C as CircleCheck, e as CircleX, f as useApiContext, g as SchemaContext, h as getUrl } from './client-client-
|
|
7
|
+
import { u as useSchemaContext, T as Trash2, I as Input, S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem, P as Plus, C as CircleCheck, e as CircleX, f as useApiContext, g as SchemaContext, h as ChevronDown, i as getUrl } from './client-client-Co3JBILS.js';
|
|
8
8
|
import { Slot } from '@radix-ui/react-slot';
|
|
9
9
|
import { cva } from 'class-variance-authority';
|
|
10
10
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
@@ -645,7 +645,7 @@ function APIPlayground({ route, method = 'GET', authorization, path = [], header
|
|
|
645
645
|
}
|
|
646
646
|
});
|
|
647
647
|
const testQuery = useQuery(async (input)=>{
|
|
648
|
-
const fetcher = await import('./fetcher-
|
|
648
|
+
const fetcher = await import('./fetcher-DLRl_kVF.js').then((mod)=>mod.createBrowserFetcher(body, schemas));
|
|
649
649
|
const serverUrl = serverRef.current ? getUrl(serverRef.current.url, serverRef.current.variables) : window.location.origin;
|
|
650
650
|
let url = `${serverUrl}${createPathnameFromInput(route, input.path, input.query)}`;
|
|
651
651
|
if (proxyUrl) {
|
|
@@ -704,7 +704,6 @@ function APIPlayground({ route, method = 'GET', authorization, path = [], header
|
|
|
704
704
|
field: info
|
|
705
705
|
}, key);
|
|
706
706
|
}
|
|
707
|
-
const isParamEmpty = path.length === 0 && query.length === 0 && header.length === 0 && body === undefined;
|
|
708
707
|
return /*#__PURE__*/ jsx(Form, {
|
|
709
708
|
...form,
|
|
710
709
|
children: /*#__PURE__*/ jsx(SchemaContext.Provider, {
|
|
@@ -728,7 +727,7 @@ function APIPlayground({ route, method = 'GET', authorization, path = [], header
|
|
|
728
727
|
/*#__PURE__*/ jsx("button", {
|
|
729
728
|
type: "submit",
|
|
730
729
|
className: cn(buttonVariants({
|
|
731
|
-
color: '
|
|
730
|
+
color: 'secondary'
|
|
732
731
|
})),
|
|
733
732
|
disabled: testQuery.isLoading,
|
|
734
733
|
children: "Send"
|
|
@@ -736,39 +735,24 @@ function APIPlayground({ route, method = 'GET', authorization, path = [], header
|
|
|
736
735
|
]
|
|
737
736
|
}),
|
|
738
737
|
authorization ? renderCustomField('authorization', authorization, fields.auth) : null,
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
header.length > 0 ? /*#__PURE__*/ jsx(Accordion, {
|
|
758
|
-
title: "Headers",
|
|
759
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
760
|
-
className: "flex flex-col gap-4",
|
|
761
|
-
children: header.map((field)=>renderCustomField(`header.${field.name}`, field, fields.header, field.name))
|
|
762
|
-
})
|
|
763
|
-
}) : null,
|
|
764
|
-
body ? /*#__PURE__*/ jsx(Accordion, {
|
|
765
|
-
title: "Body",
|
|
766
|
-
children: body.type === 'object' && !fields.body ? /*#__PURE__*/ jsx(ObjectInput, {
|
|
767
|
-
field: body,
|
|
768
|
-
fieldName: "body"
|
|
769
|
-
}) : renderCustomField('body', body, fields.body)
|
|
770
|
-
}) : null
|
|
771
|
-
]
|
|
738
|
+
path.length > 0 ? /*#__PURE__*/ jsx(CollapsiblePanel, {
|
|
739
|
+
title: "Path",
|
|
740
|
+
children: path.map((field)=>renderCustomField(`path.${field.name}`, field, fields.path, field.name))
|
|
741
|
+
}) : null,
|
|
742
|
+
query.length > 0 ? /*#__PURE__*/ jsx(CollapsiblePanel, {
|
|
743
|
+
title: "Query",
|
|
744
|
+
children: query.map((field)=>renderCustomField(`query.${field.name}`, field, fields.query, field.name))
|
|
745
|
+
}) : null,
|
|
746
|
+
header.length > 0 ? /*#__PURE__*/ jsx(CollapsiblePanel, {
|
|
747
|
+
title: "Headers",
|
|
748
|
+
children: header.map((field)=>renderCustomField(`header.${field.name}`, field, fields.header, field.name))
|
|
749
|
+
}) : null,
|
|
750
|
+
body ? /*#__PURE__*/ jsx(CollapsiblePanel, {
|
|
751
|
+
title: "Body",
|
|
752
|
+
children: body.type === 'object' && !fields.body ? /*#__PURE__*/ jsx(ObjectInput, {
|
|
753
|
+
field: body,
|
|
754
|
+
fieldName: "body"
|
|
755
|
+
}) : renderCustomField('body', body, fields.body)
|
|
772
756
|
}) : null,
|
|
773
757
|
testQuery.data ? /*#__PURE__*/ jsx(ResultDisplay, {
|
|
774
758
|
data: testQuery.data
|
|
@@ -778,6 +762,28 @@ function APIPlayground({ route, method = 'GET', authorization, path = [], header
|
|
|
778
762
|
})
|
|
779
763
|
});
|
|
780
764
|
}
|
|
765
|
+
function CollapsiblePanel({ title, children }) {
|
|
766
|
+
return /*#__PURE__*/ jsxs(Collapsible, {
|
|
767
|
+
className: "-m-2",
|
|
768
|
+
children: [
|
|
769
|
+
/*#__PURE__*/ jsxs(CollapsibleTrigger, {
|
|
770
|
+
className: "group flex w-full flex-row items-center justify-between p-2 font-medium",
|
|
771
|
+
children: [
|
|
772
|
+
title,
|
|
773
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
774
|
+
className: "size-4 group-data-[state=open]:rotate-180"
|
|
775
|
+
})
|
|
776
|
+
]
|
|
777
|
+
}),
|
|
778
|
+
/*#__PURE__*/ jsx(CollapsibleContent, {
|
|
779
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
780
|
+
className: "flex flex-col gap-4 p-2",
|
|
781
|
+
children: children
|
|
782
|
+
})
|
|
783
|
+
})
|
|
784
|
+
]
|
|
785
|
+
});
|
|
786
|
+
}
|
|
781
787
|
function createPathnameFromInput(route, path, query) {
|
|
782
788
|
let pathname = route;
|
|
783
789
|
for (const key of Object.keys(path)){
|
|
@@ -804,7 +810,7 @@ function RouteDisplay({ route }) {
|
|
|
804
810
|
query
|
|
805
811
|
]);
|
|
806
812
|
return /*#__PURE__*/ jsx("code", {
|
|
807
|
-
className: "flex-1 overflow-auto text-nowrap rounded-lg border bg-fd-
|
|
813
|
+
className: "flex-1 overflow-auto text-nowrap rounded-lg border bg-fd-secondary px-2 py-1.5 text-sm text-fd-secondary-foreground",
|
|
808
814
|
children: pathname
|
|
809
815
|
});
|
|
810
816
|
}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ interface RenderContext {
|
|
|
82
82
|
*/
|
|
83
83
|
generateCodeSamples?: (endpoint: EndpointSample) => Awaitable<CodeSample[]>;
|
|
84
84
|
shikiOptions?: Omit<CodeToHastOptionsCommon, 'lang'> & CodeOptionsThemes<BuiltinTheme>;
|
|
85
|
+
/**
|
|
86
|
+
* Show full response schema instead of only example response & Typescript definitions
|
|
87
|
+
*/
|
|
88
|
+
showResponseSchema?: boolean;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
interface BaseRequestField {
|
package/dist/ui/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { cn } from 'fumadocs-ui/components/api';
|
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
import {
|
|
7
|
-
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-
|
|
6
|
+
import { j as CopyRouteButton, k as ServerSelect } from './client-client-Co3JBILS.js';
|
|
7
|
+
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-Co3JBILS.js';
|
|
8
8
|
|
|
9
9
|
const badgeVariants = cva('rounded-xl border px-1.5 py-1 text-xs font-medium leading-[12px]', {
|
|
10
10
|
variants: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.4",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@scalar/openapi-parser": "0.10.2",
|
|
38
38
|
"ajv-draft-04": "^1.0.0",
|
|
39
39
|
"class-variance-authority": "^0.7.1",
|
|
40
|
-
"fast-glob": "^3.3.
|
|
40
|
+
"fast-glob": "^3.3.3",
|
|
41
41
|
"github-slugger": "^2.0.0",
|
|
42
42
|
"hast-util-to-jsx-runtime": "^2.3.2",
|
|
43
43
|
"js-yaml": "^4.1.0",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"remark-rehype": "^11.1.1",
|
|
48
48
|
"shiki": "^1.26.1",
|
|
49
49
|
"xml-js": "^1.6.11",
|
|
50
|
-
"fumadocs-core": "14.7.
|
|
51
|
-
"fumadocs-ui": "14.7.
|
|
50
|
+
"fumadocs-core": "14.7.3",
|
|
51
|
+
"fumadocs-ui": "14.7.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/js-yaml": "^4.0.9",
|
|
55
55
|
"@types/node": "22.10.5",
|
|
56
56
|
"@types/openapi-sampler": "^1.0.3",
|
|
57
|
-
"@types/react": "^19.0.
|
|
57
|
+
"@types/react": "^19.0.4",
|
|
58
58
|
"bunchee": "^6.2.0",
|
|
59
59
|
"lucide-react": "^0.469.0",
|
|
60
|
-
"next": "15.1.
|
|
60
|
+
"next": "15.1.4",
|
|
61
61
|
"openapi-types": "^12.1.3",
|
|
62
62
|
"eslint-config-custom": "0.0.0",
|
|
63
63
|
"tsconfig": "0.0.0"
|