fumadocs-openapi 11.0.5 → 11.1.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/css/generated/shared.css +1 -1
- package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.9/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
- package/dist/node_modules/.pnpm/@scalar_openapi-upgrader@0.2.9/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +2 -2
- package/dist/playground/client.d.ts +1 -1
- package/dist/playground/client.js +7 -3
- package/dist/playground/components/oauth-dialog.js +2 -1
- package/dist/playground/components/server-select.js +2 -2
- package/dist/playground/fetcher.d.ts +1 -1
- package/dist/requests/generators/all.js +2 -0
- package/dist/requests/generators/csharp.js +1 -1
- package/dist/requests/generators/java.js +1 -1
- package/dist/requests/generators/rust.d.ts +6 -0
- package/dist/requests/generators/rust.js +39 -0
- package/dist/requests/media/adapter.d.ts +1 -1
- package/dist/requests/media/adapter.js +4 -3
- package/dist/requests/string-utils.js +10 -1
- package/dist/server/proxy.js +1 -1
- package/dist/types/openapi.d.ts +1 -1
- package/dist/ui/components/method-label.js +1 -1
- package/dist/ui/operation/index.js +1 -1
- package/dist/ui/operation/response-tabs.d.ts +1 -1
- package/dist/ui/operation/usage-tabs.js +11 -7
- package/dist/utils/cn.js +1 -1
- package/dist/utils/pages/to-text.d.ts +1 -1
- package/package.json +14 -14
package/css/generated/shared.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@source inline("--- --fd-docs-row-1 -mode -ms-2 @4xl:flex-row @4xl:items-start @4xl:sticky @4xl:top-[calc(var(--fd-docs-row-1,2rem)+1rem)] @4xl:w-[400px] @container @default @defaultValue @deprecated @fuma-translate/react @fumari/json-schema-ts @fumari/stf @param @private @scalar/api-client-react @see @typescript-eslint/no-explicit-any a access access_token active adapter adapters addListener all allFlows allow already alt an anchorSegments and animate-spin apiExample apiKey apiPlayground application/javascript application/json application/x-javascript application/x-www-form-urlencoded application/xml apply array as assume async at auth-specific authCodeQuery authCtx authNode authSchemes authorization authorizationCode authorization_code authorize autoComplete avoid await backward badgeVariants base baseDir basic be because before between bg-fd-card bg-fd-muted bg-fd-primary/10 bg-fd-secondary binary blob blue body bodyMediaType bodyNode boolean border border-b border-current border-fd-border border-s border-t border-y buffer builderOptions built-in bundled but button buttonVariants by byteLength bytes cache cached call callback callbacks callbacksNode can cannot case catch changes charset check children class-variance-authority className client clientCredentials clientId clientSecret client_credentials client_error client_id client_secret cloned cn code codeProps codeUsages codegen codegens collapsible color com compatibility compile compiler component components conditions configuration const content contentTypes context cookie cookies core could createAutoPreset createClientAPIPage createCodeUsageGeneratorRegistry createContext createOpenAPIPageBase createProxy credentials css csv ctx current currentValue custom customization cva dark dark:text-blue-400 dark:text-green-400 dark:text-orange-400 dark:text-red-400 dark:text-yellow-400 data data-[
|
|
1
|
+
@source inline("--- --fd-docs-row-1 -mode -ms-2 @4xl:flex-row @4xl:items-start @4xl:sticky @4xl:top-[calc(var(--fd-docs-row-1,2rem)+1rem)] @4xl:w-[400px] @container @default @defaultValue @deprecated @fuma-translate/react @fumari/json-schema-ts @fumari/stf @param @private @scalar/api-client-react @see @typescript-eslint/no-explicit-any a access access_token active adapter adapters addListener all allFlows allow already alt an anchorSegments and animate-spin apiExample apiKey apiPlayground application/javascript application/json application/x-javascript application/x-www-form-urlencoded application/xml apply array as assume async at auth-specific authCodeQuery authCtx authNode authSchemes authorization authorizationCode authorization_code authorize autoComplete avoid await backward badgeVariants base baseDir basic be because before between bg-fd-card bg-fd-muted bg-fd-primary/10 bg-fd-secondary binary blob blue body bodyMediaType bodyNode boolean border border-b border-current border-fd-border border-s border-t border-y buffer builderOptions built-in bundled but button buttonVariants by byteLength bytes cache cached call callback callbacks callbacksNode can cannot case catch changes charset check children class-variance-authority className client clientCredentials clientId clientSecret client_credentials client_error client_id client_secret cloned cn code codeProps codeUsages codegen codegens collapsible color com compatibility compile compiler component components conditions configuration const content contentTypes context cookie cookies core could createAutoPreset createClientAPIPage createCodeUsageGeneratorRegistry createContext createOpenAPIPageBase createProxy credentials css csv ctx current currentValue custom customization cva dark dark:text-blue-400 dark:text-green-400 dark:text-orange-400 dark:text-red-400 dark:text-yellow-400 data data-[open]:border-b-0 data-type default defaultAdapters defaultExampleId defaultItem defaultMdxComponents defaultOpen defaultShikiFactory defaultValue defaultValues default_processMarkdown definitions deprecated depth dereferenceBundledDocument dereferenceShallow dereferenced description descriptionNode development deviceAuthorization dialog didn disable disableCache disabled display displayNames div do doc docRoot docs document documents domain downloaded dynamicSource e each else empty:hidden enabled encodeRequestData encoded endpoint enforce engine ensure entire entries entry error eslint-disable eslint-disable-next-line example exampleId exampleRequests examples export exported extends fall fallback false fast-content-type-parse fd-page-tree-item-name fetch fetchOptions fetcher field fieldName fields file filePath files fine first first:border-t-0 flex flex-1 flex-col flex-col-reverse flex-row flex-wrap flow flows folder folderStyle font-medium font-mono font-semibold for form formData format found from fromSchema fs full fumadocs-core/source fumadocs-core/toc fumadocs-openapi/ui fumadocs-ui/mdx fumadocs:openapi fumadocs_openapi_requests fumadocs_openapi_responses function gap-0.5 gap-1 gap-1.5 gap-2 gap-2.5 gap-24 gap-3 gap-4 gap-6 gap-x-6 gap-y-4 gen generate generateTypeScriptDefinitions generated generated/defined generators get getAPIPageProps getClientAPIPageProps getExampleRequests getOpenAPIPageProps getPreferredType getSchema getSchemaId getSchemas getWatchPaths github-dark github-light given grant_type green group group-data-[panel-open]:rotate-180 groupId h1 handling hasHead hash hast-util-to-jsx-runtime headNode header headers headingLevel highlighter hook hover:bg-fd-accent hover:text-fd-accent-foreground href html htmlFor http icon id idToTitle idx if ignore img implicit import imports in info initAuthInputs initial inline-flex input inputs instanceof instances instead insteawd interface internal invalid is isLoading isMediaTypeSupported isRequired issues it item items items-center items-start js json json-schema-typed justify-between kept key keyof label labelVariants lang last:border-b-0 last:mb-0 latest layout lazy length let light line-through list listed listener listeners load loadDocument loaderPlugin localStorage lucide-react make map max-age max-w-[600px] may mb-1 mb-2 md mdxComponents me-auto media mediaAdapters mediaType message meta metaData method methodKeys mime min-w-0 modify mounted ms-auto mt-0! mt-10 mt-2 mt-3 multipart/form-data multiple must my-0! my-1.5 my-4 name name! named necessary need never new newKey no-cache node:fs node:path not not-last:pb-0 not-prose note null number oauth2 obj object of off omit on onChange onClick onCopy onOpenChange onSubmit onValueChange one only open openApiData openIdConnect openapi openapiMeta openid operation operationDescription operationId operations options or orange origin other out outline output overflow-auto overflow-hidden p p-2 p-3 packages page page-level pageData pages panelVariants param paramTypeKeys parameter parameterLabel parameterNode parameters params parent parsed parsedState parts party pass password path pathItem pathnameFromRequest payload pb-2 pe-3 persist persisted persistent place placeholder playground playgrounds please plugins pre prefix preloadOpenAPIPage preloaded prevent primary processed processor prop properties props prose-no-margin provider proxy proxyForwardCookie proxyUrl ps-2 ps-4.5 pt-1 pt-2 pt-2.5 px-1 px-2 px-3 py-0.5 py-1 py-1.5 py-2 query race raw react react-hooks/exhaustive-deps react/jsx-runtime readOnly readonly record red redirect_uri ref reference registerDefault registry rehype-react relativePath remark remark-rehype remarkGfm remarkRehype removeListener render renderAPIExampleLayout renderAPIExampleUsageTabs renderOperationLayout renderPageLayout renderParameterField renderRequestTabs renderRequestTabsDefault renderResponseTabs renderResponseTabsDefault renderWebhookLayout renderer replace request request-body requestData requestInit requestTimeout requestUrl requests required requirement requirementId requirements res reset resolveMediaAdapter resolveServerUrl resolvedInput resolvedTheme response response-body responseNode responseOfType responseTabs response_type responses rest result return returned returning root rounded-2xl rounded-lg rounded-md rounded-xl route s safeParse same sample satisfies scalar scan schema schemaId schemaMap schemaUI schemaUIShared schemas scheme schemeId schemes scope scopes search secondary seconds secret securities security securityEntries securityId securitySchemes segments segs select selector separator server server-to-server server-url serverSchema servers services set setData setExample setExampleData setIsJson setIsMounted setMounted setObjectUrl setOpen setRequirementId setSecurityId setServer setServerVariables setStore setToken setType setValue shadow-md shadow-sm shiki shikiOptions showDescription showExample showResponseSchema showTitle shrink-0 side signal single size size-3.5 size-4 slot slots sm source spec specify src state staticSource status statusInfo statuses stf stfSync still storageKey storageKeys store stored string stringifyFieldKey structuredData styles submit summary supported sure switch t tab tabs testQuery text text-[0.8125rem] text-blue-600 text-fd-card-foreground text-fd-foreground text-fd-muted-foreground text-fd-primary text-fd-secondary-foreground text-green-500 text-green-600 text-nowrap text-orange-600 text-red-400 text-red-500 text-red-600 text-sm text-start text-xs text-yellow-600 text/css text/csv text/html text/plain the their them themes this through throw timeout timerRef tips title to toJsxRuntime toStaticData toc token tokenInfo token_type transform transformAuthInputs transformPageTree transition-colors tree true truncate try ts type typeof types typescript unchanged under unexpected unknown unlisted update updated updatedSchemeId updating url usage usageTabs usages use useAnchorId useApiClient useAuth useCopyButton useMemo useOnChange useOperationContext useQuery useRef useRenderContext useServerContext useState useStatusInfo useStf useStorageKey useTheme useTranslations used username using utf-8 v value values variable variables variant variants via virtual void w-14 w-fit w-full warn we webhook webhookCallbacks webhooks when whitespace-pre-wrap will with without won wrapping writeOnly x-codeSamples x-exclusiveCodeSample x-selectedCodeSample xml yellow you your");
|
|
@@ -71,7 +71,7 @@ function removeEmptySchemaOnlyContentEntries(content) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
/** The allowed properties for an OpenAPI 3.x ExampleObject */
|
|
74
|
-
const EXAMPLE_OBJECT_PROPERTIES = new Set([
|
|
74
|
+
const EXAMPLE_OBJECT_PROPERTIES = /* @__PURE__ */ new Set([
|
|
75
75
|
"summary",
|
|
76
76
|
"description",
|
|
77
77
|
"value",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { traverse } from "../helpers/traverse.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.9/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
|
|
3
|
-
const SCHEMA_SEGMENTS = new Set([
|
|
3
|
+
const SCHEMA_SEGMENTS = /* @__PURE__ */ new Set([
|
|
4
4
|
"properties",
|
|
5
5
|
"items",
|
|
6
6
|
"allOf",
|
|
@@ -92,4 +92,4 @@ const applyChangesToDocument = (schema, path) => {
|
|
|
92
92
|
return schema;
|
|
93
93
|
};
|
|
94
94
|
//#endregion
|
|
95
|
-
export { upgradeFromThreeToThreeOne };
|
|
95
|
+
export { isSchemaPath, upgradeFromThreeToThreeOne };
|
|
@@ -3,7 +3,7 @@ import { DefaultResultDisplay, ResultDisplayProps } from "./components/result-di
|
|
|
3
3
|
import { ParsedSchema } from "../utils/schema.js";
|
|
4
4
|
import { HttpMethods, OperationObject, ParameterObject, PathItemObject } from "../types.js";
|
|
5
5
|
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
|
-
import { Collapsible } from "fumadocs-
|
|
6
|
+
import { Collapsible } from "@fumadocs/api-docs/components/collapsible";
|
|
7
7
|
import { FieldKey } from "@fumari/stf";
|
|
8
8
|
import { NoReference } from "@fumadocs/api-docs/schema";
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
import { ChevronDown, LoaderCircle } from "lucide-react";
|
|
19
19
|
import { useTranslations } from "@fuma-translate/react";
|
|
20
20
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
21
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-
|
|
21
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@fumadocs/api-docs/components/collapsible";
|
|
22
22
|
import { SchemaProvider, anyFields, useResolvedSchema } from "@fumadocs/api-docs/components/playground/schema";
|
|
23
23
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@fumadocs/api-docs/components/select";
|
|
24
24
|
import { labelVariants } from "@fumadocs/api-docs/components/input";
|
|
@@ -212,9 +212,13 @@ function SecurityRequirements({ securities, setSecurityId, securityId, children
|
|
|
212
212
|
}), /* @__PURE__ */ jsx("p", { children: String(error) })]
|
|
213
213
|
}),
|
|
214
214
|
/* @__PURE__ */ jsxs(Select, {
|
|
215
|
+
items: securities.map((security, i) => ({
|
|
216
|
+
value: i.toString(),
|
|
217
|
+
label: /* @__PURE__ */ jsx(SecurityRequirement, { requirement: security })
|
|
218
|
+
})),
|
|
215
219
|
value: securityId.toString(),
|
|
216
220
|
onValueChange: (v) => setSecurityId(Number(v)),
|
|
217
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {
|
|
221
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsx(SelectContent, { children: securities.map((security, i) => /* @__PURE__ */ jsx(SelectItem, {
|
|
218
222
|
value: i.toString(),
|
|
219
223
|
children: /* @__PURE__ */ jsx(SecurityRequirement, { requirement: security })
|
|
220
224
|
}, i)) })]
|
|
@@ -542,7 +546,7 @@ function DefaultCollapsiblePanel({ title, children, ...props }) {
|
|
|
542
546
|
className: cn("border-b last:border-b-0", props.className),
|
|
543
547
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
544
548
|
className: "group w-full flex items-center gap-2 p-3 text-sm font-medium",
|
|
545
|
-
children: [title, /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground group-data-[
|
|
549
|
+
children: [title, /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground group-data-[panel-open]:rotate-180" })]
|
|
546
550
|
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
|
|
547
551
|
className: "flex flex-col gap-3 p-3 pt-1",
|
|
548
552
|
children
|
|
@@ -136,7 +136,8 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
|
|
|
136
136
|
},
|
|
137
137
|
children: [
|
|
138
138
|
/* @__PURE__ */ jsxs(Select, {
|
|
139
|
-
|
|
139
|
+
items: Object.fromEntries(Object.keys(scheme.flows).map((key) => [key, allFlows[key].name])),
|
|
140
|
+
value: type,
|
|
140
141
|
onValueChange: setType,
|
|
141
142
|
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Select a flow") }) }), /* @__PURE__ */ jsx(SelectContent, { children: Object.keys(scheme.flows).map((key) => {
|
|
142
143
|
const { name, description } = allFlows[key];
|
|
@@ -41,8 +41,8 @@ function ServerSelect(props) {
|
|
|
41
41
|
}), /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
42
42
|
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("Server URL") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("The base URL of your API endpoint.") })] }),
|
|
43
43
|
/* @__PURE__ */ jsxs(Select, {
|
|
44
|
-
value: server?.url,
|
|
45
|
-
onValueChange: setServer,
|
|
44
|
+
value: server?.url ?? null,
|
|
45
|
+
onValueChange: (v) => v !== null && setServer(v),
|
|
46
46
|
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsx(SelectContent, { children: servers.map((item) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
47
47
|
value: item.url,
|
|
48
48
|
children: [/* @__PURE__ */ jsx("code", {
|
|
@@ -4,6 +4,7 @@ import { go } from "./go.js";
|
|
|
4
4
|
import { java } from "./java.js";
|
|
5
5
|
import { javascript } from "./javascript.js";
|
|
6
6
|
import { python } from "./python.js";
|
|
7
|
+
import { rust } from "./rust.js";
|
|
7
8
|
//#region src/requests/generators/all.ts
|
|
8
9
|
function registerDefault(registry) {
|
|
9
10
|
registry.add("curl", curl);
|
|
@@ -12,6 +13,7 @@ function registerDefault(registry) {
|
|
|
12
13
|
registry.add("python", python);
|
|
13
14
|
registry.add("java", java);
|
|
14
15
|
registry.add("csharp", csharp);
|
|
16
|
+
registry.add("rust", rust);
|
|
15
17
|
return registry;
|
|
16
18
|
}
|
|
17
19
|
//#endregion
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { doubleQuote, indent } from "../string-utils.js";
|
|
2
|
+
import { resolveMediaAdapter } from "../media/resolve-adapter.js";
|
|
3
|
+
import "../media/adapter.js";
|
|
4
|
+
//#region src/requests/generators/rust.ts
|
|
5
|
+
const rust = {
|
|
6
|
+
label: "Rust",
|
|
7
|
+
lang: "rust",
|
|
8
|
+
generate(data, { mediaAdapters }) {
|
|
9
|
+
const headers = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const header in data.header) headers.set(header, doubleQuote(data.header[header].value));
|
|
11
|
+
const cookies = Object.entries(data.cookie);
|
|
12
|
+
if (cookies.length > 0) headers.set("Cookie", doubleQuote(cookies.map(([k, param]) => `${k}=${param.value}`).join("; ")));
|
|
13
|
+
let body;
|
|
14
|
+
if (data.body && data.bodyMediaType) {
|
|
15
|
+
const adapter = resolveMediaAdapter(data.bodyMediaType, mediaAdapters);
|
|
16
|
+
headers.set("Content-Type", `"${data.bodyMediaType}"`);
|
|
17
|
+
body = adapter?.generateExample(data, { lang: "rust" });
|
|
18
|
+
}
|
|
19
|
+
return `use reqwest::{Result, Client};
|
|
20
|
+
|
|
21
|
+
async fn main() -> Result<()> {
|
|
22
|
+
let client = Client::new();
|
|
23
|
+
|
|
24
|
+
let url = "${data.url}";
|
|
25
|
+
${body ? indent(body) + "\n" : ""}
|
|
26
|
+
let res = client
|
|
27
|
+
.${data.method.toLowerCase()}(url)
|
|
28
|
+
${headers.size <= 0 ? "" : indent(Array.from(headers.entries()).map(([key, value]) => ` .header("${key}", ${value})`).join("\n")) + "\n"}${body ? " .body(body)\n" : ""} .send()
|
|
29
|
+
.await?
|
|
30
|
+
.text()
|
|
31
|
+
.await?;
|
|
32
|
+
|
|
33
|
+
println!("{}", res);
|
|
34
|
+
Ok(())
|
|
35
|
+
}`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { rust };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __toESM } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { require_js2xml } from "../../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
|
|
3
|
-
import { backtickQuote, inputToString, tripleDoubleQuote } from "../string-utils.js";
|
|
4
|
-
import "./resolve-adapter.js";
|
|
3
|
+
import { backtickQuote, inputToString, rustRawStringLiteral, tripleDoubleQuote } from "../string-utils.js";
|
|
4
|
+
import { isMediaTypeSupported, resolveMediaAdapter } from "./resolve-adapter.js";
|
|
5
5
|
//#region src/requests/media/adapter.ts
|
|
6
6
|
var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
|
|
7
7
|
const defaultAdapters = {
|
|
@@ -119,6 +119,7 @@ function str(init, mediaType, ctx) {
|
|
|
119
119
|
return `var body = BodyPublishers.ofString(${tripleDoubleQuote(inputToString(init, mediaType))});`;
|
|
120
120
|
}
|
|
121
121
|
if (ctx.lang === "csharp") return `var body = new StringContent(${tripleDoubleQuote(`\n${inputToString(init, mediaType)}\n`)}, Encoding.UTF8, "${mediaType}");`;
|
|
122
|
+
if (ctx.lang === "rust") return `let body = ${rustRawStringLiteral(inputToString(init, mediaType))};`;
|
|
122
123
|
}
|
|
123
124
|
//#endregion
|
|
124
|
-
export { defaultAdapters };
|
|
125
|
+
export { defaultAdapters, isMediaTypeSupported, resolveMediaAdapter };
|
|
@@ -45,9 +45,18 @@ function tripleDoubleQuote(str) {
|
|
|
45
45
|
function backtickQuote(str) {
|
|
46
46
|
return `\`${str.replace(/\\/g, "\\\\").replace(/`/g, "\\`")}\``;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the input string wrapped inside a Rust string literal,
|
|
50
|
+
* with increasing number of # to escape `"#`
|
|
51
|
+
*/
|
|
52
|
+
function rustRawStringLiteral(str) {
|
|
53
|
+
let hashes = "#";
|
|
54
|
+
while (str.includes(`"${hashes}`)) hashes += "#";
|
|
55
|
+
return `r${hashes}"${str}"${hashes}`;
|
|
56
|
+
}
|
|
48
57
|
function indent(code, tab = 1) {
|
|
49
58
|
const p = " ".repeat(tab);
|
|
50
59
|
return code.split("\n").map((v) => v.length === 0 ? v : p + v).join("\n");
|
|
51
60
|
}
|
|
52
61
|
//#endregion
|
|
53
|
-
export { backtickQuote, doubleQuote, indent, inputToString, singleQuote, tripleDoubleQuote };
|
|
62
|
+
export { backtickQuote, doubleQuote, indent, inputToString, rustRawStringLiteral, singleQuote, tripleDoubleQuote };
|
package/dist/server/proxy.js
CHANGED
package/dist/types/openapi.d.ts
CHANGED
|
@@ -419,7 +419,7 @@ function ResponseAccordion({ status, operation }) {
|
|
|
419
419
|
return /* @__PURE__ */ jsx(AccordionItem, {
|
|
420
420
|
value: status,
|
|
421
421
|
anchorSegments: ["response", status],
|
|
422
|
-
className: "data-[
|
|
422
|
+
className: "data-[open]:border-b-0",
|
|
423
423
|
children: /* @__PURE__ */ jsxs(SelectTabs, {
|
|
424
424
|
defaultValue: items[0]?.value,
|
|
425
425
|
children: [/* @__PURE__ */ jsxs(AccordionHeader, { children: [/* @__PURE__ */ jsx(AccordionTrigger, {
|
|
@@ -84,17 +84,21 @@ function UsageTabsSelector() {
|
|
|
84
84
|
})] });
|
|
85
85
|
}
|
|
86
86
|
if (examples.length === 1) return null;
|
|
87
|
-
const
|
|
87
|
+
const items = examples.map((item) => ({
|
|
88
|
+
value: item.id,
|
|
89
|
+
label: renderItem(item)
|
|
90
|
+
}));
|
|
88
91
|
return /* @__PURE__ */ jsxs(Select, {
|
|
92
|
+
items,
|
|
89
93
|
value: key,
|
|
90
|
-
onValueChange: setKey,
|
|
94
|
+
onValueChange: (v) => v !== null && setKey(v),
|
|
91
95
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
92
96
|
className: "not-prose mb-2",
|
|
93
|
-
children:
|
|
94
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children:
|
|
95
|
-
value: item.
|
|
96
|
-
children:
|
|
97
|
-
}, item.
|
|
97
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
98
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
99
|
+
value: item.value,
|
|
100
|
+
children: item.label
|
|
101
|
+
}, item.value)) })]
|
|
98
102
|
});
|
|
99
103
|
}
|
|
100
104
|
function UsageTab({ id, lang }) {
|
package/dist/utils/cn.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from "cnfast";
|
|
2
2
|
export { cn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"./requests/generators/java": "./dist/requests/generators/java.js",
|
|
31
31
|
"./requests/generators/javascript": "./dist/requests/generators/javascript.js",
|
|
32
32
|
"./requests/generators/python": "./dist/requests/generators/python.js",
|
|
33
|
+
"./requests/generators/rust": "./dist/requests/generators/rust.js",
|
|
33
34
|
"./scalar": "./dist/scalar/index.js",
|
|
34
35
|
"./server": "./dist/server/index.js",
|
|
35
36
|
"./ui": "./dist/ui/index.js",
|
|
@@ -46,31 +47,30 @@
|
|
|
46
47
|
"@fumari/json-schema-ts": "^0.0.2",
|
|
47
48
|
"chokidar": "^5.0.0",
|
|
48
49
|
"class-variance-authority": "^0.7.1",
|
|
50
|
+
"cnfast": "^0.0.8",
|
|
49
51
|
"github-slugger": "^2.0.0",
|
|
50
52
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
51
|
-
"js-yaml": "^
|
|
52
|
-
"lucide-react": "^1.
|
|
53
|
+
"js-yaml": "^5.2.1",
|
|
54
|
+
"lucide-react": "^1.23.0",
|
|
53
55
|
"remark": "^15.0.1",
|
|
54
56
|
"remark-rehype": "^11.1.2",
|
|
55
|
-
"shiki": "^4.
|
|
56
|
-
"
|
|
57
|
-
"@
|
|
58
|
-
"@fumari/stf": "1.0.5"
|
|
57
|
+
"shiki": "^4.3.1",
|
|
58
|
+
"@fumadocs/api-docs": "0.1.0",
|
|
59
|
+
"@fumari/stf": "1.1.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@scalar/api-client-react": "^2.0.
|
|
62
|
+
"@scalar/api-client-react": "^2.0.31",
|
|
62
63
|
"@scalar/openapi-upgrader": "^0.2.9",
|
|
63
|
-
"@tailwindcss/oxide": "^4.3.
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/node": "25.9.3",
|
|
64
|
+
"@tailwindcss/oxide": "^4.3.2",
|
|
65
|
+
"@types/node": "26.1.0",
|
|
66
66
|
"@types/react": "^19.2.17",
|
|
67
67
|
"fast-content-type-parse": "^3.0.0",
|
|
68
68
|
"json-schema-typed": "^8.0.2",
|
|
69
69
|
"tsdown": "0.22.3",
|
|
70
70
|
"xml-js": "^1.6.11",
|
|
71
|
-
"fumadocs-core": "16.
|
|
72
|
-
"
|
|
73
|
-
"
|
|
71
|
+
"fumadocs-core": "16.11.0",
|
|
72
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@16.11.0",
|
|
73
|
+
"tsconfig": "0.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@scalar/api-client-react": "^2.0.20",
|