fumadocs-openapi 5.7.5 → 5.8.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/index.d.ts +59 -27
- package/dist/index.js +182 -141
- package/dist/server/index.d.ts +39 -12
- package/dist/server/index.js +321 -172
- package/dist/ui/{client-client-Ddkf37Pm.js → client-client-D9KEBAUd.js} +7 -7
- package/dist/ui/index.d.ts +27 -10
- package/dist/ui/index.js +6 -5
- package/dist/ui/{playground-client-DPxpLHKJ.js → playground-client-C0GkAwm2.js} +2 -2
- package/package.json +10 -9
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { forwardRef, createElement, useContext, createContext, useState, useEffect, useMemo } from 'react';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
4
|
+
import { cn, useCopyButton, buttonVariants } from 'fumadocs-ui/components/api';
|
|
5
5
|
import dynamic from 'next/dynamic';
|
|
6
6
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @license lucide-react v0.
|
|
9
|
+
* @license lucide-react v0.462.0 - ISC
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -16,7 +16,7 @@ const mergeClasses = (...classes)=>classes.filter((className, index, array)=>{
|
|
|
16
16
|
}).join(" ").trim();
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @license lucide-react v0.
|
|
19
|
+
* @license lucide-react v0.462.0 - ISC
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the ISC license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -253,7 +253,7 @@ function useSchemaContext() {
|
|
|
253
253
|
return ctx;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const APIPlayground = dynamic(()=>import('./playground-client-
|
|
256
|
+
const APIPlayground = dynamic(()=>import('./playground-client-C0GkAwm2.js').then((mod)=>mod.APIPlayground));
|
|
257
257
|
function Root({ children, baseUrl, className, shikiOptions, ...props }) {
|
|
258
258
|
return /*#__PURE__*/ jsx("div", {
|
|
259
259
|
className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
|
|
@@ -290,7 +290,7 @@ function BaseUrlSelect({ baseUrls }) {
|
|
|
290
290
|
const { baseUrl, setBaseUrl } = useApiContext();
|
|
291
291
|
if (baseUrls.length <= 1) return null;
|
|
292
292
|
return /*#__PURE__*/ jsxs("div", {
|
|
293
|
-
className: "flex flex-row items-center gap-1 px-1
|
|
293
|
+
className: "mt-2 flex flex-row items-center gap-1 px-1",
|
|
294
294
|
children: [
|
|
295
295
|
/*#__PURE__*/ jsx("span", {
|
|
296
296
|
className: "p-0.5 text-xs font-medium text-fd-muted-foreground",
|
|
@@ -299,7 +299,7 @@ function BaseUrlSelect({ baseUrls }) {
|
|
|
299
299
|
/*#__PURE__*/ jsx("select", {
|
|
300
300
|
value: baseUrl,
|
|
301
301
|
onChange: (e)=>setBaseUrl(e.target.value),
|
|
302
|
-
className: "min-w-0 flex-1 bg-transparent
|
|
302
|
+
className: "min-w-0 flex-1 bg-transparent text-xs text-fd-foreground outline-none",
|
|
303
303
|
children: baseUrls.map((url)=>/*#__PURE__*/ jsx("option", {
|
|
304
304
|
value: url,
|
|
305
305
|
children: url
|
|
@@ -309,4 +309,4 @@ function BaseUrlSelect({ baseUrls }) {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
export { APIPlayground as A, BaseUrlSelect as B,
|
|
312
|
+
export { APIPlayground as A, BaseUrlSelect as B, CircleCheck as C, Plus as P, Root as R, SchemaContext as S, Trash2 as T, CircleX as a, ChevronDown as b, ChevronUp as c, Check as d, useApiContext as e, CopyRouteButton as f, useSchemaContext as u };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -2,10 +2,15 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, ComponentType, ReactElement, MutableRefObject, HTMLAttributes } from 'react';
|
|
4
4
|
import { FieldPath, ControllerRenderProps, ControllerFieldState, UseFormStateReturn } from 'react-hook-form';
|
|
5
|
-
import {
|
|
5
|
+
import { OpenAPIV3_1 } from 'openapi-types';
|
|
6
6
|
import Slugger from 'github-slugger';
|
|
7
7
|
import { CodeToHastOptionsCommon, CodeOptionsThemes, BuiltinTheme } from 'shiki';
|
|
8
8
|
|
|
9
|
+
type NoReference<T> = T extends (infer I)[] ? NoReference<I>[] : T extends ReferenceObject ? Exclude<T, ReferenceObject> : T extends object ? {
|
|
10
|
+
[K in keyof T]: NoReference<T[K]>;
|
|
11
|
+
} : T;
|
|
12
|
+
type ParsedSchema = OpenAPIV3_1.SchemaObject;
|
|
13
|
+
|
|
9
14
|
/**
|
|
10
15
|
* Sample info of endpoint
|
|
11
16
|
*/
|
|
@@ -16,7 +21,7 @@ interface EndpointSample {
|
|
|
16
21
|
url: string;
|
|
17
22
|
method: string;
|
|
18
23
|
body?: {
|
|
19
|
-
schema:
|
|
24
|
+
schema: ParsedSchema;
|
|
20
25
|
mediaType: string;
|
|
21
26
|
sample: unknown;
|
|
22
27
|
};
|
|
@@ -26,12 +31,12 @@ interface EndpointSample {
|
|
|
26
31
|
interface ResponseSample {
|
|
27
32
|
mediaType: string;
|
|
28
33
|
sample: unknown;
|
|
29
|
-
schema:
|
|
34
|
+
schema: ParsedSchema;
|
|
30
35
|
}
|
|
31
36
|
interface ParameterSample {
|
|
32
37
|
name: string;
|
|
33
38
|
in: string;
|
|
34
|
-
schema:
|
|
39
|
+
schema: ParsedSchema;
|
|
35
40
|
sample: unknown;
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -41,12 +46,23 @@ interface CodeSample {
|
|
|
41
46
|
source: string | ((endpoint: EndpointSample) => string | undefined) | false;
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
type Document = OpenAPIV3_1.Document;
|
|
50
|
+
type ReferenceObject = OpenAPIV3_1.ReferenceObject;
|
|
44
51
|
type Awaitable<T> = T | Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Dereferenced value and its original `$ref` value
|
|
54
|
+
*/
|
|
55
|
+
type DereferenceMap = Map<unknown, string>;
|
|
45
56
|
interface RenderContext {
|
|
46
57
|
renderer: Renderer;
|
|
47
|
-
|
|
58
|
+
/**
|
|
59
|
+
* dereferenced schema
|
|
60
|
+
*/
|
|
61
|
+
document: NoReference<Document>;
|
|
48
62
|
baseUrl: string;
|
|
63
|
+
baseUrls: string[];
|
|
49
64
|
slugger: Slugger;
|
|
65
|
+
dereferenceMap: DereferenceMap;
|
|
50
66
|
/**
|
|
51
67
|
* Generate TypeScript definitions from response schema.
|
|
52
68
|
*
|
|
@@ -132,6 +148,7 @@ interface APIInfoProps {
|
|
|
132
148
|
method: string;
|
|
133
149
|
route: string;
|
|
134
150
|
baseUrls: string[];
|
|
151
|
+
head: ReactNode;
|
|
135
152
|
children: ReactNode;
|
|
136
153
|
}
|
|
137
154
|
interface PropertyProps {
|
|
@@ -232,15 +249,15 @@ declare function Root({ children, baseUrl, className, shikiOptions, ...props }:
|
|
|
232
249
|
shikiOptions: RenderContext['shikiOptions'];
|
|
233
250
|
} & HTMLAttributes<HTMLDivElement>): ReactNode;
|
|
234
251
|
|
|
235
|
-
declare function APIInfo({
|
|
252
|
+
declare function APIInfo({ className, route, badgeClassname, baseUrls, method, head, ...props }: APIInfoProps & HTMLAttributes<HTMLDivElement> & {
|
|
236
253
|
badgeClassname?: string;
|
|
237
254
|
}): react_jsx_runtime.JSX.Element;
|
|
238
|
-
declare function API({ children, ...props }: HTMLAttributes<HTMLDivElement>):
|
|
239
|
-
declare function Property({ name, type, required, deprecated, children, }: PropertyProps):
|
|
240
|
-
declare function APIExample(props: HTMLAttributes<HTMLDivElement>):
|
|
255
|
+
declare function API({ children, ...props }: HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
256
|
+
declare function Property({ name, type, required, deprecated, children, }: PropertyProps): react_jsx_runtime.JSX.Element;
|
|
257
|
+
declare function APIExample(props: HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
241
258
|
declare function ObjectCollapsible(props: {
|
|
242
259
|
name: string;
|
|
243
260
|
children: ReactNode;
|
|
244
|
-
}):
|
|
261
|
+
}): react_jsx_runtime.JSX.Element;
|
|
245
262
|
|
|
246
263
|
export { API, APIExample, APIInfo, APIPlayground, ObjectCollapsible, Property, Root, useSchemaContext };
|
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 { f as CopyRouteButton, B as BaseUrlSelect } from './client-client-
|
|
7
|
-
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-
|
|
6
|
+
import { f as CopyRouteButton, B as BaseUrlSelect } from './client-client-D9KEBAUd.js';
|
|
7
|
+
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-D9KEBAUd.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: {
|
|
@@ -35,7 +35,7 @@ function getBadgeColor(method) {
|
|
|
35
35
|
function Route({ route }) {
|
|
36
36
|
const segments = route.split('/').filter((part)=>part.length > 0);
|
|
37
37
|
return /*#__PURE__*/ jsx("div", {
|
|
38
|
-
className: "not-prose flex flex-row items-center gap-
|
|
38
|
+
className: "not-prose flex flex-row items-center gap-0.5 overflow-auto text-nowrap text-xs",
|
|
39
39
|
children: segments.map((part, index)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
40
40
|
children: [
|
|
41
41
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -53,11 +53,12 @@ function Route({ route }) {
|
|
|
53
53
|
}, index))
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
function APIInfo({
|
|
56
|
+
function APIInfo({ className, route, badgeClassname, baseUrls, method = 'GET', head, ...props }) {
|
|
57
57
|
return /*#__PURE__*/ jsxs("div", {
|
|
58
58
|
className: cn('min-w-0 flex-1', className),
|
|
59
59
|
...props,
|
|
60
60
|
children: [
|
|
61
|
+
head,
|
|
61
62
|
/*#__PURE__*/ jsxs("div", {
|
|
62
63
|
className: "sticky top-[var(--fd-api-info-top)] z-[4] mb-4 border-b border-fd-foreground/10 bg-fd-card/50 px-4 py-1.5 shadow-lg backdrop-blur-lg max-lg:-mx-3 max-md:-mx-4 md:rounded-xl md:border md:px-1.5",
|
|
63
64
|
children: [
|
|
@@ -86,7 +87,7 @@ function APIInfo({ children, className, route, badgeClassname, baseUrls, method
|
|
|
86
87
|
}),
|
|
87
88
|
/*#__PURE__*/ jsx("div", {
|
|
88
89
|
className: "prose-no-margin",
|
|
89
|
-
children: children
|
|
90
|
+
children: props.children
|
|
90
91
|
})
|
|
91
92
|
]
|
|
92
93
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { forwardRef, useId, createContext, useContext, useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
|
5
5
|
import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWatch } from 'react-hook-form';
|
|
6
6
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
7
7
|
import { cn, buttonVariants } from 'fumadocs-ui/components/api';
|
|
8
|
-
import { C as
|
|
8
|
+
import { C as CircleCheck, a as CircleX, b as ChevronDown, c as ChevronUp, d as Check, u as useSchemaContext, T as Trash2, P as Plus, e as useApiContext, S as SchemaContext } from './client-client-D9KEBAUd.js';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@apidevtools/json-schema-ref-parser": "^11.7.2",
|
|
35
|
-
"@fumari/json-schema-to-typescript": "^1.1.
|
|
35
|
+
"@fumari/json-schema-to-typescript": "^1.1.2",
|
|
36
36
|
"@radix-ui/react-select": "^2.1.2",
|
|
37
37
|
"@radix-ui/react-slot": "^1.1.0",
|
|
38
|
-
"
|
|
38
|
+
"@scalar/openapi-parser": "^0.8.10",
|
|
39
|
+
"class-variance-authority": "^0.7.1",
|
|
39
40
|
"fast-glob": "^3.3.1",
|
|
40
41
|
"github-slugger": "^2.0.0",
|
|
41
42
|
"hast-util-to-jsx-runtime": "^2.3.2",
|
|
@@ -44,17 +45,17 @@
|
|
|
44
45
|
"react-hook-form": "^7.53.2",
|
|
45
46
|
"remark": "^15.0.1",
|
|
46
47
|
"remark-rehype": "^11.1.1",
|
|
47
|
-
"shiki": "^1.
|
|
48
|
-
"fumadocs-core": "14.5.
|
|
49
|
-
"fumadocs-ui": "14.5.
|
|
48
|
+
"shiki": "^1.24.0",
|
|
49
|
+
"fumadocs-core": "14.5.5",
|
|
50
|
+
"fumadocs-ui": "14.5.5"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/js-yaml": "^4.0.9",
|
|
53
|
-
"@types/node": "22.
|
|
54
|
+
"@types/node": "22.10.1",
|
|
54
55
|
"@types/openapi-sampler": "^1.0.3",
|
|
55
56
|
"@types/react": "^18.3.12",
|
|
56
|
-
"bunchee": "^
|
|
57
|
-
"lucide-react": "^0.
|
|
57
|
+
"bunchee": "^6.0.0",
|
|
58
|
+
"lucide-react": "^0.462.0",
|
|
58
59
|
"next": "15.0.3",
|
|
59
60
|
"openapi-types": "^12.1.3",
|
|
60
61
|
"eslint-config-custom": "0.0.0",
|