fumadocs-openapi 10.8.2 → 10.8.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/css/generated/shared.css +3 -1
- package/dist/_virtual/_rolldown/runtime.js +20 -1
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.12/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +1 -1
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.12/node_modules/@scalar/json-magic/dist/helpers/normalize.js +2 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/array-helper.js +11 -0
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js +256 -0
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/options-helper.js +31 -0
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/compose-collection.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/compose-doc.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/compose-node.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/compose-scalar.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/composer.js +3 -3
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-block-map.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-end.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/resolve-props.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/util-contains-newline.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/compose/util-map-includes.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/doc/Document.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/doc/anchors.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/doc/applyReviver.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/doc/createNode.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/doc/directives.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/errors.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/log.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/Alias.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/Collection.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/Node.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/Pair.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/Scalar.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/YAMLMap.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/identity.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/nodes/toJS.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/cst-visit.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/lexer.js +27 -15
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/line-counter.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/parser.js +9 -5
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/public-api.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/Schema.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/common/map.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/common/null.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/common/seq.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/common/string.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/core/bool.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/core/float.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/core/int.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/core/schema.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/json/schema.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/tags.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringify.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyComment.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyPair.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/stringify/stringifyString.js +1 -1
- package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/visit.js +1 -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/requests/media/adapter.js +4 -2
- package/dist/requests/string-utils.js +4 -2
- 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 +9 -8
- /package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/index.js +0 -0
- /package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -0
- /package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/parse/cst.js +0 -0
- /package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/index.js +0 -0
|
@@ -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";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { __toESM } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_js2xml } from "../../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
|
|
1
3
|
import { backtickQuote, inputToString, tripleDoubleQuote } from "../string-utils.js";
|
|
2
4
|
import "./resolve-adapter.js";
|
|
3
|
-
import js2xml from "xml-js/lib/js2xml.js";
|
|
4
5
|
//#region src/requests/media/adapter.ts
|
|
6
|
+
var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
|
|
5
7
|
const defaultAdapters = {
|
|
6
8
|
"application/json": {
|
|
7
9
|
encode(data) {
|
|
@@ -13,7 +15,7 @@ const defaultAdapters = {
|
|
|
13
15
|
},
|
|
14
16
|
"application/xml": {
|
|
15
17
|
encode(data) {
|
|
16
|
-
return
|
|
18
|
+
return (0, import_js2xml.default)(data.body, {
|
|
17
19
|
compact: true,
|
|
18
20
|
spaces: 2
|
|
19
21
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { __toESM } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_js2xml } from "../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
|
|
2
3
|
//#region src/requests/string-utils.ts
|
|
4
|
+
var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
|
|
3
5
|
/**
|
|
4
6
|
* Convert input value to hardcoded string (with quotes)
|
|
5
7
|
*/
|
|
@@ -13,7 +15,7 @@ function inputToString(value, format = "application/json") {
|
|
|
13
15
|
for (const key in value) if (value[key]) params.set(key, String(value[key]));
|
|
14
16
|
return params.toString();
|
|
15
17
|
}
|
|
16
|
-
return
|
|
18
|
+
return (0, import_js2xml.default)(value, {
|
|
17
19
|
compact: true,
|
|
18
20
|
spaces: 2
|
|
19
21
|
});
|
|
@@ -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.4",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -51,12 +51,11 @@
|
|
|
51
51
|
"github-slugger": "^2.0.0",
|
|
52
52
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
53
53
|
"js-yaml": "^4.1.1",
|
|
54
|
-
"lucide-react": "^1.
|
|
54
|
+
"lucide-react": "^1.16.0",
|
|
55
55
|
"remark": "^15.0.1",
|
|
56
56
|
"remark-rehype": "^11.1.2",
|
|
57
57
|
"shiki": "^4.0.2",
|
|
58
|
-
"tailwind-merge": "^3.
|
|
59
|
-
"xml-js": "^1.6.11",
|
|
58
|
+
"tailwind-merge": "^3.6.0",
|
|
60
59
|
"@fumari/stf": "1.0.5"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
@@ -66,14 +65,15 @@
|
|
|
66
65
|
"@scalar/openapi-upgrader": "^0.2.7",
|
|
67
66
|
"@tailwindcss/oxide": "^4.3.0",
|
|
68
67
|
"@types/js-yaml": "^4.0.9",
|
|
69
|
-
"@types/node": "25.
|
|
68
|
+
"@types/node": "25.7.0",
|
|
70
69
|
"@types/react": "^19.2.14",
|
|
71
70
|
"fast-content-type-parse": "^3.0.0",
|
|
72
71
|
"json-schema-typed": "^8.0.2",
|
|
73
72
|
"tailwindcss": "^4.3.0",
|
|
74
73
|
"tsdown": "0.22.0",
|
|
75
|
-
"
|
|
76
|
-
"fumadocs-ui": "16.8.
|
|
74
|
+
"xml-js": "^1.6.11",
|
|
75
|
+
"fumadocs-ui": "16.8.11",
|
|
76
|
+
"fumadocs-core": "16.8.11",
|
|
77
77
|
"tsconfig": "0.0.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
"@scalar/openapi-upgrader": "0.2.7",
|
|
104
104
|
"fast-content-type-parse": "3.0.0",
|
|
105
105
|
"pathe": "2.0.3",
|
|
106
|
-
"
|
|
106
|
+
"xml-js": "1.6.11",
|
|
107
|
+
"yaml": "2.9.0"
|
|
107
108
|
},
|
|
108
109
|
"scripts": {
|
|
109
110
|
"build": "tsdown",
|
/package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/dist/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/node_modules/.pnpm/{yaml@2.8.4 → yaml@2.9.0}/node_modules/yaml/browser/index.js
RENAMED
|
File without changes
|