fumadocs-openapi 5.3.2 → 5.4.1
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 +9 -1
- package/dist/index.js +2 -1
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.js +1 -0
- package/dist/ui/{client-client-CgPBB3ii.js → client-client-BUlxkJAI.js} +1 -1
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +4 -4
- package/dist/ui/{playground-client-CthJtmMz.js → playground-client-CB0L6vUj.js} +16 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,9 @@ interface APIPlaygroundProps {
|
|
|
49
49
|
route: string;
|
|
50
50
|
method: string;
|
|
51
51
|
bodyType: 'json' | 'form-data';
|
|
52
|
-
authorization?: PrimitiveRequestField
|
|
52
|
+
authorization?: PrimitiveRequestField & {
|
|
53
|
+
authType: string;
|
|
54
|
+
};
|
|
53
55
|
path?: PrimitiveRequestField[];
|
|
54
56
|
query?: PrimitiveRequestField[];
|
|
55
57
|
header?: PrimitiveRequestField[];
|
|
@@ -221,6 +223,12 @@ interface GenerateOptions {
|
|
|
221
223
|
* A `full: true` property will be added by default.
|
|
222
224
|
*/
|
|
223
225
|
frontmatter?: (title: string, description: string | undefined, context: DocumentContext) => Record<string, unknown>;
|
|
226
|
+
/**
|
|
227
|
+
* Add description to document body
|
|
228
|
+
*
|
|
229
|
+
* @defaultValue false
|
|
230
|
+
*/
|
|
231
|
+
includeDescription?: boolean;
|
|
224
232
|
cwd?: string;
|
|
225
233
|
}
|
|
226
234
|
interface GenerateTagOutput {
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ function idToTitle(id) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function generateDocument(options) {
|
|
82
|
-
const { frontmatter } = options;
|
|
82
|
+
const { frontmatter, includeDescription = false } = options;
|
|
83
83
|
const out = [];
|
|
84
84
|
const extend = frontmatter?.(options.title, options.description, options.context);
|
|
85
85
|
let meta;
|
|
@@ -106,6 +106,7 @@ function generateDocument(options) {
|
|
|
106
106
|
if (imports) {
|
|
107
107
|
out.push(imports);
|
|
108
108
|
}
|
|
109
|
+
if (options.description && includeDescription) out.push(options.description);
|
|
109
110
|
out.push(pageContent(options.page));
|
|
110
111
|
return out.join('\n\n');
|
|
111
112
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -50,7 +50,9 @@ interface APIPlaygroundProps {
|
|
|
50
50
|
route: string;
|
|
51
51
|
method: string;
|
|
52
52
|
bodyType: 'json' | 'form-data';
|
|
53
|
-
authorization?: PrimitiveRequestField
|
|
53
|
+
authorization?: PrimitiveRequestField & {
|
|
54
|
+
authType: string;
|
|
55
|
+
};
|
|
54
56
|
path?: PrimitiveRequestField[];
|
|
55
57
|
query?: PrimitiveRequestField[];
|
|
56
58
|
header?: PrimitiveRequestField[];
|
package/dist/server/index.js
CHANGED
|
@@ -317,6 +317,7 @@ function getAuthorizationField(method, ctx) {
|
|
|
317
317
|
return {
|
|
318
318
|
type: 'string',
|
|
319
319
|
name: 'Authorization',
|
|
320
|
+
authType: scheme.type,
|
|
320
321
|
defaultValue: scheme.type === 'oauth2' || scheme.type === 'http' && scheme.scheme === 'bearer' ? 'Bearer' : 'Basic',
|
|
321
322
|
isRequired: security.every((requirements)=>Object.keys(requirements).length > 0),
|
|
322
323
|
description: 'The Authorization access token'
|
|
@@ -64,7 +64,7 @@ function useSchemaContext() {
|
|
|
64
64
|
return ctx;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const APIPlayground = dynamic(()=>import('./playground-client-
|
|
67
|
+
const APIPlayground = dynamic(()=>import('./playground-client-CB0L6vUj.js').then((mod)=>mod.APIPlayground));
|
|
68
68
|
function Root({ children, baseUrl, className, ...props }) {
|
|
69
69
|
return /*#__PURE__*/ jsx("div", {
|
|
70
70
|
className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -49,7 +49,9 @@ interface APIPlaygroundProps {
|
|
|
49
49
|
route: string;
|
|
50
50
|
method: string;
|
|
51
51
|
bodyType: 'json' | 'form-data';
|
|
52
|
-
authorization?: PrimitiveRequestField
|
|
52
|
+
authorization?: PrimitiveRequestField & {
|
|
53
|
+
authType: string;
|
|
54
|
+
};
|
|
53
55
|
path?: PrimitiveRequestField[];
|
|
54
56
|
query?: PrimitiveRequestField[];
|
|
55
57
|
header?: PrimitiveRequestField[];
|
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 { C as CopyRouteButton } from './client-client-
|
|
7
|
-
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-
|
|
6
|
+
import { C as CopyRouteButton } from './client-client-BUlxkJAI.js';
|
|
7
|
+
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-BUlxkJAI.js';
|
|
8
8
|
|
|
9
9
|
const badgeVariants = cva('rounded border px-1.5 py-1 text-xs font-medium leading-[12px]', {
|
|
10
10
|
variants: {
|
|
@@ -92,10 +92,10 @@ function API({ className, children, ...props }) {
|
|
|
92
92
|
}
|
|
93
93
|
function Property({ name, type, required, deprecated, children }) {
|
|
94
94
|
return /*#__PURE__*/ jsxs("div", {
|
|
95
|
-
className: "mb-4
|
|
95
|
+
className: "mb-4 rounded-lg border bg-fd-card p-3 prose-no-margin",
|
|
96
96
|
children: [
|
|
97
97
|
/*#__PURE__*/ jsxs("h4", {
|
|
98
|
-
className: "
|
|
98
|
+
className: "flex flex-row items-center gap-4",
|
|
99
99
|
children: [
|
|
100
100
|
/*#__PURE__*/ jsx("code", {
|
|
101
101
|
children: name
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { forwardRef, useId, createContext, useContext, useState, useCallback, useLayoutEffect, useRef, useMemo } from 'react';
|
|
4
|
+
import { forwardRef, useId, createContext, useContext, useState, useCallback, useLayoutEffect, useRef, useEffect, useMemo } from 'react';
|
|
5
5
|
import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWatch } from 'react-hook-form';
|
|
6
6
|
import useSWRImmutable from 'swr/immutable';
|
|
7
7
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
8
8
|
import { cn, buttonVariants } from 'fumadocs-ui/components/api';
|
|
9
|
-
import { u as useSchemaContext, a as useApiContext, S as SchemaContext } from './client-client-
|
|
9
|
+
import { u as useSchemaContext, a as useApiContext, S as SchemaContext } from './client-client-BUlxkJAI.js';
|
|
10
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import { CircleCheckIcon, CircleXIcon, ChevronDown, ChevronUp, Check, Trash2, Plus } from 'lucide-react';
|
|
@@ -905,6 +905,20 @@ function APIPlayground({ route, method = 'GET', bodyType, authorization, path =
|
|
|
905
905
|
}, {
|
|
906
906
|
shouldRetryOnError: false
|
|
907
907
|
});
|
|
908
|
+
useEffect(()=>{
|
|
909
|
+
if (!authorization) return;
|
|
910
|
+
const key = `__fumadocs_authorization_${authorization.authType}`;
|
|
911
|
+
const cached = localStorage.getItem(key);
|
|
912
|
+
if (cached) form.setValue('authorization', cached);
|
|
913
|
+
const subscription = form.watch((value, { name })=>{
|
|
914
|
+
if (name !== 'authorization' || !value.authorization) return;
|
|
915
|
+
localStorage.setItem(key, value.authorization);
|
|
916
|
+
});
|
|
917
|
+
return ()=>{
|
|
918
|
+
subscription.unsubscribe();
|
|
919
|
+
};
|
|
920
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- mounted only once
|
|
921
|
+
}, []);
|
|
908
922
|
const onSubmit = form.handleSubmit((value)=>{
|
|
909
923
|
setInput(value);
|
|
910
924
|
});
|