fumadocs-openapi 10.8.2 → 10.8.3
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/css/generated/shared.css +3 -1
- package/dist/playground/client.d.ts +2 -0
- package/dist/playground/client.js +5 -5
- package/dist/playground/components/inputs.js +2 -2
- package/dist/playground/components/oauth-dialog.js +1 -1
- package/dist/playground/components/result-display.js +2 -2
- package/dist/playground/components/server-select.js +1 -1
- package/dist/playground/schema.js +1 -1
- package/dist/server/source-api.d.ts +1 -0
- package/dist/server/source-api.js +6 -1
- package/dist/ui/base.js +3 -2
- package/dist/ui/components/dialog.js +1 -1
- package/dist/ui/create-client.js +3 -2
- package/dist/ui/operation/client.js +1 -1
- package/dist/ui/operation/index.js +17 -5
- package/dist/ui/operation/request-tabs.js +1 -1
- package/dist/ui/operation/usage-tabs/client.js +4 -1
- package/dist/ui/schema/client.js +2 -2
- package/dist/utils/pages/builder.d.ts +1 -0
- package/dist/utils/pages/preset-auto.js +4 -2
- package/dist/utils/pages/to-text.d.ts +1 -1
- package/dist/utils/pages/to-text.js +17 -22
- package/package.json +4 -4
package/css/generated/shared.css
CHANGED
|
@@ -294,6 +294,7 @@
|
|
|
294
294
|
@source inline("fallback");
|
|
295
295
|
@source inline("false");
|
|
296
296
|
@source inline("fast-content-type-parse");
|
|
297
|
+
@source inline("fd-page-tree-item-name");
|
|
297
298
|
@source inline("fetch");
|
|
298
299
|
@source inline("fetchOptions");
|
|
299
300
|
@source inline("fetcher");
|
|
@@ -536,6 +537,7 @@
|
|
|
536
537
|
@source inline("mounted");
|
|
537
538
|
@source inline("ms-2");
|
|
538
539
|
@source inline("ms-auto");
|
|
540
|
+
@source inline("mt-0!");
|
|
539
541
|
@source inline("mt-10");
|
|
540
542
|
@source inline("mt-2");
|
|
541
543
|
@source inline("mt-4");
|
|
@@ -1081,6 +1083,7 @@
|
|
|
1081
1083
|
@source inline("w-[600px]");
|
|
1082
1084
|
@source inline("w-fit");
|
|
1083
1085
|
@source inline("w-full");
|
|
1086
|
+
@source inline("warn");
|
|
1084
1087
|
@source inline("we");
|
|
1085
1088
|
@source inline("webhook");
|
|
1086
1089
|
@source inline("webhooks");
|
|
@@ -1088,7 +1091,6 @@
|
|
|
1088
1091
|
@source inline("whitespace-pre-wrap");
|
|
1089
1092
|
@source inline("width");
|
|
1090
1093
|
@source inline("will");
|
|
1091
|
-
@source inline("window");
|
|
1092
1094
|
@source inline("with");
|
|
1093
1095
|
@source inline("withBase");
|
|
1094
1096
|
@source inline("withReplacements");
|
|
@@ -23,6 +23,7 @@ interface PlaygroundClientProps extends ComponentProps<'form'>, SchemaScope {
|
|
|
23
23
|
/** the OpenAPI document (not dereferenced) */
|
|
24
24
|
doc: Document;
|
|
25
25
|
proxyUrl?: string;
|
|
26
|
+
deprecated?: boolean;
|
|
26
27
|
}
|
|
27
28
|
interface CollapsiblePanelProps extends Omit<ComponentProps<typeof Collapsible>, 'title'> {
|
|
28
29
|
'data-type': 'authorization' | 'body' | ParamType;
|
|
@@ -71,6 +72,7 @@ declare function PlaygroundClient({
|
|
|
71
72
|
proxyUrl,
|
|
72
73
|
writeOnly,
|
|
73
74
|
readOnly,
|
|
75
|
+
deprecated,
|
|
74
76
|
...rest
|
|
75
77
|
}: PlaygroundClientProps): _$react_jsx_runtime0.JSX.Element;
|
|
76
78
|
declare const ParamTypes: readonly ["path", "header", "cookie", "query"];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../utils/url.js";
|
|
3
3
|
import { getPreferredType } from "../utils/schema/index.js";
|
|
4
|
-
import { dereferenceSwallow } from "../utils/schema/dereference.js";
|
|
5
|
-
import { cn } from "../utils/cn.js";
|
|
6
|
-
import { MethodLabel } from "../ui/components/method-label.js";
|
|
7
4
|
import { useStorageKey } from "../ui/client/storage-key.js";
|
|
8
5
|
import { useApiContext, useServerContext } from "../ui/contexts/api.js";
|
|
9
6
|
import { useTranslations } from "../ui/client/i18n.js";
|
|
7
|
+
import { cn } from "../utils/cn.js";
|
|
10
8
|
import { DefaultResultDisplay } from "./components/result-display.js";
|
|
9
|
+
import { MethodLabel } from "../ui/components/method-label.js";
|
|
11
10
|
import { useQuery } from "../utils/use-query.js";
|
|
12
11
|
import { encodeRequestData } from "../requests/media/encode.js";
|
|
12
|
+
import { dereferenceSwallow } from "../utils/schema/dereference.js";
|
|
13
13
|
import { SchemaProvider, anyFields, useResolvedSchema } from "./schema.js";
|
|
14
14
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/components/select.js";
|
|
15
15
|
import { labelVariants } from "../ui/components/input.js";
|
|
@@ -28,7 +28,7 @@ import { StfProvider, useDataEngine, useFieldValue, useListener, useStf } from "
|
|
|
28
28
|
import { arrayStartsWith, objectGet, objectSet, stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
29
29
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
30
30
|
//#region src/playground/client.tsx
|
|
31
|
-
function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly, readOnly, ...rest }) {
|
|
31
|
+
function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly, readOnly, deprecated, ...rest }) {
|
|
32
32
|
const t = useTranslations();
|
|
33
33
|
const { parameters, body } = useMemo(() => {
|
|
34
34
|
const operation = doc.paths[route][method];
|
|
@@ -130,7 +130,7 @@ function PlaygroundClient({ route, method, securities, doc, proxyUrl, writeOnly,
|
|
|
130
130
|
/* @__PURE__ */ jsx(MethodLabel, { children: method }),
|
|
131
131
|
/* @__PURE__ */ jsx(Route, {
|
|
132
132
|
route,
|
|
133
|
-
className: "flex-1"
|
|
133
|
+
className: cn("flex-1", deprecated && "line-through")
|
|
134
134
|
}),
|
|
135
135
|
/* @__PURE__ */ jsx("button", {
|
|
136
136
|
type: "submit",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
2
|
import { useTranslations } from "../../ui/client/i18n.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { anyFields, useFieldInfo, useResolvedSchema, useSchemaScope, useSchemaUtils } from "../schema.js";
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
|
|
6
6
|
import { Input, labelVariants } from "../../ui/components/input.js";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { cva } from "class-variance-authority";
|
|
10
9
|
import { ChevronRight, Plus, Trash2, X } from "lucide-react";
|
|
11
10
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
12
|
import { useArray, useDataEngine, useFieldValue, useObject } from "@fumari/stf";
|
|
13
13
|
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
14
14
|
//#region src/playground/components/inputs.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../../utils/cn.js";
|
|
2
1
|
import { useApiContext } from "../../ui/contexts/api.js";
|
|
3
2
|
import { useTranslations } from "../../ui/client/i18n.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { useQuery } from "../../utils/use-query.js";
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
|
|
6
6
|
import { Input, labelVariants } from "../../ui/components/input.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
2
|
import { useTranslations, withReplacements } from "../../ui/client/i18n.js";
|
|
4
3
|
import { useStatusInfo } from "../status-info.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { ClientCodeBlock } from "../../ui/components/codeblock.js";
|
|
6
6
|
import { require_fast_content_type_parse } from "../../node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js";
|
|
7
7
|
import { useEffect, useMemo, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { cva } from "class-variance-authority";
|
|
10
9
|
import { CircleX } from "lucide-react";
|
|
11
10
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
12
|
//#region src/playground/components/result-display.tsx
|
|
13
13
|
var import_fast_content_type_parse = require_fast_content_type_parse();
|
|
14
14
|
const panelVariants = cva("flex flex-col gap-2 mt-2 px-3 py-2 border-y bg-fd-secondary text-fd-secondary-foreground");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveServerUrl, withBase } from "../../utils/url.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
3
|
import { useServerContext } from "../../ui/contexts/api.js";
|
|
5
4
|
import { useTranslations } from "../../ui/client/i18n.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
6
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
|
|
7
7
|
import { Input, labelVariants } from "../../ui/components/input.js";
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "../../ui/components/dialog.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { dereferenceSwallow } from "../utils/schema/dereference.js";
|
|
2
1
|
import { mergeAllOf } from "../utils/schema/merge.js";
|
|
3
2
|
import { sample } from "../utils/schema/sample.js";
|
|
4
3
|
import { schemaToString } from "../utils/schema/to-string.js";
|
|
4
|
+
import { dereferenceSwallow } from "../utils/schema/dereference.js";
|
|
5
5
|
import { createContext, use, useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
@@ -17,6 +17,10 @@ function openapiPlugin() {
|
|
|
17
17
|
if (!file || file.format !== "page") return node;
|
|
18
18
|
const openApiData = file.data._openapi;
|
|
19
19
|
if (!openApiData || typeof openApiData !== "object") return node;
|
|
20
|
+
if (openApiData.deprecated) node.name = /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "fd-page-tree-item-name line-through",
|
|
22
|
+
children: node.name
|
|
23
|
+
});
|
|
20
24
|
if (openApiData.webhook) node.name = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
25
|
node.name,
|
|
22
26
|
" ",
|
|
@@ -76,7 +80,8 @@ async function openapiSource(server, options = {}) {
|
|
|
76
80
|
...toStaticData(props, processed.dereferenced),
|
|
77
81
|
_openapi: {
|
|
78
82
|
method: entry.type === "operation" || entry.type === "webhook" ? entry.item.method : void 0,
|
|
79
|
-
webhook: entry.type === "webhook"
|
|
83
|
+
webhook: entry.type === "webhook",
|
|
84
|
+
deprecated: entry.info.deprecated
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
});
|
package/dist/ui/base.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseSecurities } from "../utils/schema/index.js";
|
|
2
|
-
import { encodeInternalRef } from "../utils/schema/ref.js";
|
|
3
2
|
import { defaultAdapters } from "../requests/media/adapter.js";
|
|
4
3
|
import { ClientCodeBlockProvider } from "./components/codeblock.js";
|
|
4
|
+
import { encodeInternalRef } from "../utils/schema/ref.js";
|
|
5
5
|
import { APIPage } from "./api-page.js";
|
|
6
6
|
import { pickSchema } from "../utils/schema/pick.js";
|
|
7
7
|
import { PlaygroundAuthProvider } from "./client/boundary.lazy.js";
|
|
@@ -54,7 +54,8 @@ function createAPIPage(server, options) {
|
|
|
54
54
|
])),
|
|
55
55
|
proxyUrl: ctx.proxyUrl,
|
|
56
56
|
writeOnly: true,
|
|
57
|
-
readOnly: false
|
|
57
|
+
readOnly: false,
|
|
58
|
+
deprecated: method.deprecated
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
return async function APIPageWrapper({ document, ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
2
|
import { useTranslations } from "../client/i18n.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { X } from "lucide-react";
|
package/dist/ui/create-client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseSecurities } from "../utils/schema/index.js";
|
|
2
|
-
import { dereferenceDocument } from "../utils/document/dereference.js";
|
|
3
2
|
import { defaultAdapters } from "../requests/media/adapter.js";
|
|
4
3
|
import { ClientCodeBlock, ClientCodeBlockProvider } from "./components/codeblock.js";
|
|
5
4
|
import { AuthProvider } from "../playground/auth.js";
|
|
5
|
+
import { dereferenceDocument } from "../utils/document/dereference.js";
|
|
6
6
|
import { APIPage } from "./api-page.js";
|
|
7
7
|
import { boundary_exports } from "./client/boundary.js";
|
|
8
8
|
import { slug } from "github-slugger";
|
|
@@ -64,7 +64,8 @@ function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { the
|
|
|
64
64
|
doc: ctx.schema.bundled,
|
|
65
65
|
proxyUrl: ctx.proxyUrl,
|
|
66
66
|
writeOnly: true,
|
|
67
|
-
readOnly: false
|
|
67
|
+
readOnly: false,
|
|
68
|
+
deprecated: method.deprecated
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
function renderPlaygroundProviderDefault({ children }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../../utils/cn.js";
|
|
3
2
|
import { useTranslations } from "../client/i18n.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Check, Copy } from "lucide-react";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { idToTitle } from "../../utils/id-to-title.js";
|
|
2
2
|
import { createMethod, methodKeys } from "../../utils/schema/index.js";
|
|
3
|
-
import { cn } from "../../utils/cn.js";
|
|
4
|
-
import { Badge, MethodLabel } from "../components/method-label.js";
|
|
5
3
|
import { isMediaTypeSupported } from "../../requests/media/resolve-adapter.js";
|
|
6
4
|
import "../../requests/media/adapter.js";
|
|
7
5
|
import { I18nLabel } from "../client/i18n.js";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { Badge, MethodLabel } from "../components/method-label.js";
|
|
8
8
|
import { CopyTypeScriptPanel, OperationProvider } from "./client.js";
|
|
9
9
|
import { Schema } from "../schema/index.js";
|
|
10
10
|
import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions } from "../components/accordion.js";
|
|
@@ -14,6 +14,7 @@ import { getExampleRequests } from "./get-example-requests.js";
|
|
|
14
14
|
import { SelectTab, SelectTabTrigger, SelectTabs } from "../components/select-tab.js";
|
|
15
15
|
import { Fragment, use, useMemo } from "react";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { Callout } from "fumadocs-ui/components/callout";
|
|
17
18
|
//#region src/ui/operation/index.tsx
|
|
18
19
|
const paramTypeKeys = [
|
|
19
20
|
"path",
|
|
@@ -37,9 +38,20 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
|
|
|
37
38
|
]);
|
|
38
39
|
if (showTitle) {
|
|
39
40
|
const title = method.summary || (method.operationId ? idToTitle(method.operationId) : path);
|
|
40
|
-
headNode =
|
|
41
|
+
headNode = /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "flex gap-2 items-center justify-between",
|
|
43
|
+
children: [ctx.renderHeading(headingLevel, title, { className: "my-0!" }), method.deprecated && /* @__PURE__ */ jsx(Badge, {
|
|
44
|
+
color: "yellow",
|
|
45
|
+
className: "text-xs not-prose",
|
|
46
|
+
children: /* @__PURE__ */ jsx(I18nLabel, { label: "deprecated" })
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
41
49
|
headingLevel++;
|
|
42
|
-
}
|
|
50
|
+
} else if (method.deprecated) headNode = /* @__PURE__ */ jsx(Callout, {
|
|
51
|
+
type: "warn",
|
|
52
|
+
title: /* @__PURE__ */ jsx(I18nLabel, { label: "deprecated" }),
|
|
53
|
+
className: "mt-0!"
|
|
54
|
+
});
|
|
43
55
|
const contentTypes = body?.content ? Object.entries(body.content) : null;
|
|
44
56
|
if (body && contentTypes && contentTypes.length > 0) {
|
|
45
57
|
const items = contentTypes.map(([key]) => ({
|
|
@@ -237,7 +249,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
|
|
|
237
249
|
className: "text-xs",
|
|
238
250
|
children: method.method
|
|
239
251
|
}), /* @__PURE__ */ jsx("code", {
|
|
240
|
-
className: "flex-1 overflow-auto text-nowrap text-[0.8125rem] text-fd-muted-foreground",
|
|
252
|
+
className: cn("flex-1 overflow-auto text-nowrap text-[0.8125rem] text-fd-muted-foreground", method.deprecated && "line-through"),
|
|
241
253
|
children: path
|
|
242
254
|
})]
|
|
243
255
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveRequestData } from "../../utils/url.js";
|
|
2
|
-
import { MethodLabel } from "../components/method-label.js";
|
|
3
2
|
import { I18nLabel } from "../client/i18n.js";
|
|
3
|
+
import { MethodLabel } from "../components/method-label.js";
|
|
4
4
|
import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions } from "../components/accordion.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "fumadocs-ui/components/tabs";
|
|
@@ -46,17 +46,19 @@ function UsageTab({ id, lang, _client }) {
|
|
|
46
46
|
const { examples, example: selectedExampleId, route, addListener, removeListener } = useOperationContext();
|
|
47
47
|
const { server } = useServerContext();
|
|
48
48
|
const codegen = codeUsages.get(id);
|
|
49
|
+
const [mounted, setMounted] = useState(false);
|
|
49
50
|
const [data, setData] = useState(() => examples.find((example) => example.id === selectedExampleId)?.encoded);
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
const listener = (_, encoded) => setData(encoded);
|
|
52
53
|
addListener(listener);
|
|
54
|
+
setMounted(true);
|
|
53
55
|
return () => {
|
|
54
56
|
removeListener(listener);
|
|
55
57
|
};
|
|
56
58
|
}, [addListener, removeListener]);
|
|
57
59
|
const code = useMemo(() => {
|
|
58
60
|
if (!data) return;
|
|
59
|
-
const url = joinURL(server &&
|
|
61
|
+
const url = joinURL(server && mounted ? withBase(resolveServerUrl(server.url, server.variables), window.location.origin) : "https://example.com", resolveRequestData(route, data));
|
|
60
62
|
if (_client) {
|
|
61
63
|
const { generate, serverContext } = _client;
|
|
62
64
|
if (typeof generate === "string") return generate;
|
|
@@ -74,6 +76,7 @@ function UsageTab({ id, lang, _client }) {
|
|
|
74
76
|
data,
|
|
75
77
|
server,
|
|
76
78
|
route,
|
|
79
|
+
mounted,
|
|
77
80
|
_client,
|
|
78
81
|
codegen,
|
|
79
82
|
mediaAdapters
|
package/dist/ui/schema/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useTranslations } from "../client/i18n.js";
|
|
2
3
|
import { cn } from "../../utils/cn.js";
|
|
3
4
|
import { Badge } from "../components/method-label.js";
|
|
4
|
-
import { useTranslations } from "../client/i18n.js";
|
|
5
5
|
import { Fragment, Suspense, createContext, use, useCallback, useDeferredValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { cva } from "class-variance-authority";
|
|
8
7
|
import { ChevronDown, FilterIcon } from "lucide-react";
|
|
9
8
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
10
10
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
|
|
11
11
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "fumadocs-ui/components/tabs";
|
|
12
12
|
import { Popover, PopoverContent, PopoverTrigger } from "fumadocs-ui/components/ui/popover";
|
|
@@ -162,7 +162,8 @@ function createAutoPreset(options) {
|
|
|
162
162
|
item: op,
|
|
163
163
|
info: {
|
|
164
164
|
title: displayName,
|
|
165
|
-
description: operation.description ?? pathItem.description
|
|
165
|
+
description: operation.description ?? pathItem.description,
|
|
166
|
+
deprecated: operation.deprecated
|
|
166
167
|
}
|
|
167
168
|
});
|
|
168
169
|
}
|
|
@@ -173,7 +174,8 @@ function createAutoPreset(options) {
|
|
|
173
174
|
schemaId: builder.id,
|
|
174
175
|
info: {
|
|
175
176
|
title: displayName,
|
|
176
|
-
description: operation.description ?? pathItem.description
|
|
177
|
+
description: operation.description ?? pathItem.description,
|
|
178
|
+
deprecated: operation.deprecated
|
|
177
179
|
},
|
|
178
180
|
item: webhook
|
|
179
181
|
});
|
|
@@ -5,25 +5,13 @@ import { dump } from "js-yaml";
|
|
|
5
5
|
//#region src/utils/pages/to-text.ts
|
|
6
6
|
function toText(entry, processed, options = {}) {
|
|
7
7
|
switch (entry.type) {
|
|
8
|
-
case "operation": return generatePage(entry.schemaId, processed, { operations: [entry.item] },
|
|
9
|
-
...options,
|
|
10
|
-
...entry.info
|
|
11
|
-
}, { type: "operation" });
|
|
8
|
+
case "operation": return generatePage(entry.schemaId, processed, { operations: [entry.item] }, options, entry);
|
|
12
9
|
case "page": return generatePage(entry.schemaId, processed, {
|
|
13
10
|
operations: entry.operations,
|
|
14
11
|
webhooks: entry.webhooks,
|
|
15
12
|
showTitle: true
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
...entry.info
|
|
19
|
-
}, entry.tag ? {
|
|
20
|
-
type: "tag",
|
|
21
|
-
tag: entry.tag
|
|
22
|
-
} : { type: "file" });
|
|
23
|
-
case "webhook": return generatePage(entry.schemaId, processed, { webhooks: [entry.item] }, {
|
|
24
|
-
...options,
|
|
25
|
-
...entry.info
|
|
26
|
-
}, { type: "operation" });
|
|
13
|
+
}, options, entry);
|
|
14
|
+
case "webhook": return generatePage(entry.schemaId, processed, { webhooks: [entry.item] }, options, entry);
|
|
27
15
|
}
|
|
28
16
|
}
|
|
29
17
|
function generateDocument(frontmatter, content, options) {
|
|
@@ -41,26 +29,33 @@ function generateDocument(frontmatter, content, options) {
|
|
|
41
29
|
out.push(content);
|
|
42
30
|
return out.join("\n\n");
|
|
43
31
|
}
|
|
44
|
-
function generatePage(schemaId, processed, pageProps, options,
|
|
32
|
+
function generatePage(schemaId, processed, pageProps, options, entry) {
|
|
45
33
|
const { frontmatter, includeDescription = false } = options;
|
|
46
|
-
const extend = frontmatter?.(
|
|
34
|
+
const extend = frontmatter?.(entry.info.title, entry.info.description, entry.type === "page" ? entry.tag ? {
|
|
35
|
+
type: "tag",
|
|
36
|
+
tag: entry.tag
|
|
37
|
+
} : { type: "file" } : { type: "operation" });
|
|
47
38
|
const page = {
|
|
48
39
|
...pageProps,
|
|
49
40
|
document: schemaId
|
|
50
41
|
};
|
|
51
42
|
let meta;
|
|
52
|
-
if (page.operations?.length === 1) meta = {
|
|
43
|
+
if (page.operations?.length === 1) meta = {
|
|
44
|
+
method: page.operations[0].method.toUpperCase(),
|
|
45
|
+
deprecated: entry.info.deprecated
|
|
46
|
+
};
|
|
53
47
|
else if (page.webhooks?.length === 1) meta = {
|
|
54
48
|
method: page.webhooks[0].method.toUpperCase(),
|
|
55
|
-
webhook: true
|
|
49
|
+
webhook: true,
|
|
50
|
+
deprecated: entry.info.deprecated
|
|
56
51
|
};
|
|
57
52
|
const data = toStaticData(page, processed.dereferenced);
|
|
58
53
|
const content = [];
|
|
59
|
-
if (
|
|
54
|
+
if (entry.info.description && includeDescription) content.push(entry.info.description);
|
|
60
55
|
content.push(pageContent(page));
|
|
61
56
|
return generateDocument({
|
|
62
|
-
title:
|
|
63
|
-
description: !includeDescription ?
|
|
57
|
+
title: entry.info.title,
|
|
58
|
+
description: !includeDescription ? entry.info.description : void 0,
|
|
64
59
|
full: true,
|
|
65
60
|
...extend,
|
|
66
61
|
_openapi: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "10.8.
|
|
3
|
+
"version": "10.8.3",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"remark": "^15.0.1",
|
|
56
56
|
"remark-rehype": "^11.1.2",
|
|
57
57
|
"shiki": "^4.0.2",
|
|
58
|
-
"tailwind-merge": "^3.
|
|
58
|
+
"tailwind-merge": "^3.6.0",
|
|
59
59
|
"xml-js": "^1.6.11",
|
|
60
60
|
"@fumari/stf": "1.0.5"
|
|
61
61
|
},
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"json-schema-typed": "^8.0.2",
|
|
73
73
|
"tailwindcss": "^4.3.0",
|
|
74
74
|
"tsdown": "0.22.0",
|
|
75
|
-
"fumadocs-core": "16.8.
|
|
76
|
-
"fumadocs-ui": "16.8.
|
|
75
|
+
"fumadocs-core": "16.8.11",
|
|
76
|
+
"fumadocs-ui": "16.8.11",
|
|
77
77
|
"tsconfig": "0.0.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|