fumadocs-openapi 10.8.6 → 10.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/generated/shared.css +8 -8
- package/dist/i18n.d.ts +9 -4
- package/dist/i18n.js +14 -5
- package/dist/index.d.ts +2 -2
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/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.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.7 → @scalar_openapi-upgrader@0.2.8}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
- package/dist/playground/components/oauth-dialog.js +1 -1
- package/dist/playground/components/result-display.js +3 -2
- package/dist/playground/components/spinner.js +2 -1
- package/dist/scalar/client.js +2 -1
- package/dist/server/index.d.ts +2 -9
- package/dist/server/index.js +9 -9
- package/dist/ui/client/i18n.js +7 -10
- package/dist/utils/document/process.js +1 -1
- package/dist/utils/pages/builder.d.ts +1 -3
- package/dist/utils/pages/builder.js +1 -9
- package/dist/utils/schema/sample.js +1 -1
- package/package.json +11 -11
package/css/generated/shared.css
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
@source inline("all");
|
|
46
46
|
@source inline("allFlows");
|
|
47
47
|
@source inline("allOf");
|
|
48
|
+
@source inline("allow");
|
|
48
49
|
@source inline("already");
|
|
49
50
|
@source inline("alt");
|
|
50
51
|
@source inline("and");
|
|
@@ -120,6 +121,8 @@
|
|
|
120
121
|
@source inline("both");
|
|
121
122
|
@source inline("boundary");
|
|
122
123
|
@source inline("buffer");
|
|
124
|
+
@source inline("builderOptions");
|
|
125
|
+
@source inline("built-in");
|
|
123
126
|
@source inline("bundled");
|
|
124
127
|
@source inline("but");
|
|
125
128
|
@source inline("button");
|
|
@@ -221,7 +224,6 @@
|
|
|
221
224
|
@source inline("data-placeholder:text-fd-muted-foreground");
|
|
222
225
|
@source inline("data-type");
|
|
223
226
|
@source inline("dataEngine");
|
|
224
|
-
@source inline("declare");
|
|
225
227
|
@source inline("default");
|
|
226
228
|
@source inline("defaultAdapters");
|
|
227
229
|
@source inline("defaultColor");
|
|
@@ -328,7 +330,6 @@
|
|
|
328
330
|
@source inline("flex-col-reverse");
|
|
329
331
|
@source inline("flex-row");
|
|
330
332
|
@source inline("flex-wrap");
|
|
331
|
-
@source inline("flow");
|
|
332
333
|
@source inline("flows");
|
|
333
334
|
@source inline("focus-visible:outline-none");
|
|
334
335
|
@source inline("focus-visible:ring-1");
|
|
@@ -352,9 +353,10 @@
|
|
|
352
353
|
@source inline("forwardRef");
|
|
353
354
|
@source inline("found");
|
|
354
355
|
@source inline("from");
|
|
355
|
-
@source inline("
|
|
356
|
+
@source inline("fromSchema");
|
|
356
357
|
@source inline("fs");
|
|
357
358
|
@source inline("full");
|
|
359
|
+
@source inline("fumadocs-core/i18n");
|
|
358
360
|
@source inline("fumadocs-core/source");
|
|
359
361
|
@source inline("fumadocs-core/toc");
|
|
360
362
|
@source inline("fumadocs-ui/mdx");
|
|
@@ -547,7 +549,6 @@
|
|
|
547
549
|
@source inline("min-w-0");
|
|
548
550
|
@source inline("missing");
|
|
549
551
|
@source inline("modify");
|
|
550
|
-
@source inline("module");
|
|
551
552
|
@source inline("moon");
|
|
552
553
|
@source inline("mounted");
|
|
553
554
|
@source inline("ms-2");
|
|
@@ -675,7 +676,6 @@
|
|
|
675
676
|
@source inline("place");
|
|
676
677
|
@source inline("placeholder");
|
|
677
678
|
@source inline("placeholder:text-fd-muted-foreground");
|
|
678
|
-
@source inline("placeholders");
|
|
679
679
|
@source inline("playground");
|
|
680
680
|
@source inline("playgroundEnabled");
|
|
681
681
|
@source inline("playgrounds");
|
|
@@ -761,6 +761,7 @@
|
|
|
761
761
|
@source inline("renderRequestTabsDefault");
|
|
762
762
|
@source inline("renderResponseTabs");
|
|
763
763
|
@source inline("renderResponseTabsDefault");
|
|
764
|
+
@source inline("renderTranslation");
|
|
764
765
|
@source inline("renderTrigger");
|
|
765
766
|
@source inline("renderWebhookLayout");
|
|
766
767
|
@source inline("rendered");
|
|
@@ -961,6 +962,7 @@
|
|
|
961
962
|
@source inline("tab");
|
|
962
963
|
@source inline("tabs");
|
|
963
964
|
@source inline("tag");
|
|
965
|
+
@source inline("test");
|
|
964
966
|
@source inline("testQuery");
|
|
965
967
|
@source inline("text");
|
|
966
968
|
@source inline("text-[0.8125rem]");
|
|
@@ -1027,7 +1029,6 @@
|
|
|
1027
1029
|
@source inline("transition-colors");
|
|
1028
1030
|
@source inline("transition-transform");
|
|
1029
1031
|
@source inline("translated");
|
|
1030
|
-
@source inline("translation");
|
|
1031
1032
|
@source inline("tree");
|
|
1032
1033
|
@source inline("trigger");
|
|
1033
1034
|
@source inline("true");
|
|
@@ -1064,7 +1065,6 @@
|
|
|
1064
1065
|
@source inline("useAuth");
|
|
1065
1066
|
@source inline("useCopyButton");
|
|
1066
1067
|
@source inline("useFieldValue");
|
|
1067
|
-
@source inline("useI18n");
|
|
1068
1068
|
@source inline("useMemo");
|
|
1069
1069
|
@source inline("useNamespace");
|
|
1070
1070
|
@source inline("useObject");
|
|
@@ -1080,6 +1080,7 @@
|
|
|
1080
1080
|
@source inline("useStorageKey");
|
|
1081
1081
|
@source inline("useTheme");
|
|
1082
1082
|
@source inline("useTranslations");
|
|
1083
|
+
@source inline("useTranslationsBase");
|
|
1083
1084
|
@source inline("useTypeText");
|
|
1084
1085
|
@source inline("used");
|
|
1085
1086
|
@source inline("username");
|
|
@@ -1114,7 +1115,6 @@
|
|
|
1114
1115
|
@source inline("will");
|
|
1115
1116
|
@source inline("with");
|
|
1116
1117
|
@source inline("withBase");
|
|
1117
|
-
@source inline("withReplacements");
|
|
1118
1118
|
@source inline("without");
|
|
1119
1119
|
@source inline("wrap");
|
|
1120
1120
|
@source inline("wrap-break-word");
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TranslationValue, TranslationsAPIExtension } from "fumadocs-core/i18n";
|
|
1
2
|
import { I18nUIConfig } from "fumadocs-ui/i18n";
|
|
2
3
|
|
|
3
4
|
//#region src/i18n.d.ts
|
|
@@ -14,6 +15,7 @@ declare const defaultTranslations: {
|
|
|
14
15
|
body: string;
|
|
15
16
|
deprecated: string;
|
|
16
17
|
submit: string;
|
|
18
|
+
test: string;
|
|
17
19
|
unsupported: string;
|
|
18
20
|
close: string;
|
|
19
21
|
inputPlaceholder: string;
|
|
@@ -32,7 +34,7 @@ declare const defaultTranslations: {
|
|
|
32
34
|
authTokenIn: string;
|
|
33
35
|
authScope: string;
|
|
34
36
|
typeScriptDefinitions: string;
|
|
35
|
-
useTypeInTypeScript:
|
|
37
|
+
useTypeInTypeScript: TranslationValue<"name">;
|
|
36
38
|
schemaDefault: string;
|
|
37
39
|
schemaMatch: string;
|
|
38
40
|
schemaFormat: string;
|
|
@@ -43,7 +45,7 @@ declare const defaultTranslations: {
|
|
|
43
45
|
schemaItems: string;
|
|
44
46
|
schemaValueIn: string;
|
|
45
47
|
schemaExample: string;
|
|
46
|
-
responseTabName:
|
|
48
|
+
responseTabName: TranslationValue<"key">;
|
|
47
49
|
responseTabNameDefault: string;
|
|
48
50
|
closeJsonEditor: string;
|
|
49
51
|
openJsonEditor: string;
|
|
@@ -58,7 +60,8 @@ declare const defaultTranslations: {
|
|
|
58
60
|
statusSuccessful: string;
|
|
59
61
|
statusError: string;
|
|
60
62
|
statusClientError: string;
|
|
61
|
-
statusBinaryBody:
|
|
63
|
+
statusBinaryBody: TranslationValue<"length">;
|
|
64
|
+
oauthFlowPlaceholder: string;
|
|
62
65
|
obtainAccessToken: string;
|
|
63
66
|
resourceOwnerPassword: string;
|
|
64
67
|
resourceOwnerPasswordDesc: string;
|
|
@@ -96,6 +99,8 @@ declare const defaultTranslations: {
|
|
|
96
99
|
playgroundInputUnset: string;
|
|
97
100
|
};
|
|
98
101
|
type Translations = typeof defaultTranslations;
|
|
102
|
+
declare function openapiTranslations(): TranslationsAPIExtension<'openapi', Translations>;
|
|
103
|
+
/** @deprecated use `i18n.translations()` & `openapiTranslations()` instead */
|
|
99
104
|
declare function defineI18nOpenAPI<Languages extends string>(config: I18nUIConfig<Languages>, translations: Partial<Record<NoInfer<Languages>, Partial<Translations>>>): I18nUIConfig<Languages>;
|
|
100
105
|
//#endregion
|
|
101
|
-
export { Translations, defaultTranslations, defineI18nOpenAPI };
|
|
106
|
+
export { Translations, defaultTranslations, defineI18nOpenAPI, openapiTranslations };
|
package/dist/i18n.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { require_deepmerge } from "./node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
|
|
2
1
|
//#region src/i18n.ts
|
|
3
|
-
var import_deepmerge = require_deepmerge();
|
|
4
2
|
const defaultTranslations = {
|
|
5
3
|
loading: "loading...",
|
|
6
4
|
empty: "Empty",
|
|
@@ -14,6 +12,7 @@ const defaultTranslations = {
|
|
|
14
12
|
body: "Body",
|
|
15
13
|
deprecated: "Deprecated",
|
|
16
14
|
submit: "Submit",
|
|
15
|
+
test: "Test",
|
|
17
16
|
unsupported: "Unsupported",
|
|
18
17
|
close: "Close",
|
|
19
18
|
inputPlaceholder: "Enter value",
|
|
@@ -59,6 +58,7 @@ const defaultTranslations = {
|
|
|
59
58
|
statusError: "Error",
|
|
60
59
|
statusClientError: "Client Error",
|
|
61
60
|
statusBinaryBody: "Binary response body, {length} bytes",
|
|
61
|
+
oauthFlowPlaceholder: "Select a flow",
|
|
62
62
|
obtainAccessToken: "Obtain the access token for API.",
|
|
63
63
|
resourceOwnerPassword: "Resource Owner Password Flow",
|
|
64
64
|
resourceOwnerPasswordDesc: "Authenticate using username and password.",
|
|
@@ -95,8 +95,14 @@ const defaultTranslations = {
|
|
|
95
95
|
playgroundInputUpload: "Upload",
|
|
96
96
|
playgroundInputUnset: "Unset"
|
|
97
97
|
};
|
|
98
|
+
function openapiTranslations() {
|
|
99
|
+
return {
|
|
100
|
+
namespace: "openapi",
|
|
101
|
+
defaultValue: defaultTranslations
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** @deprecated use `i18n.translations()` & `openapiTranslations()` instead */
|
|
98
105
|
function defineI18nOpenAPI(config, translations) {
|
|
99
|
-
const dm = (0, import_deepmerge.deepmerge)();
|
|
100
106
|
return {
|
|
101
107
|
...config,
|
|
102
108
|
provider(locale = config.defaultLanguage) {
|
|
@@ -104,11 +110,14 @@ function defineI18nOpenAPI(config, translations) {
|
|
|
104
110
|
const data = translations[locale];
|
|
105
111
|
if (data) {
|
|
106
112
|
out.translations ??= {};
|
|
107
|
-
out.translations.openapi =
|
|
113
|
+
out.translations.openapi = {
|
|
114
|
+
...defaultTranslations,
|
|
115
|
+
...data
|
|
116
|
+
};
|
|
108
117
|
}
|
|
109
118
|
return out;
|
|
110
119
|
}
|
|
111
120
|
};
|
|
112
121
|
}
|
|
113
122
|
//#endregion
|
|
114
|
-
export { defaultTranslations, defineI18nOpenAPI };
|
|
123
|
+
export { defaultTranslations, defineI18nOpenAPI, openapiTranslations };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MediaAdapter } from "./requests/media/adapter.js";
|
|
2
|
-
import { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema,
|
|
2
|
+
import { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, getPageProps } from "./utils/pages/builder.js";
|
|
3
3
|
import { SchemaToPagesOptions, createAutoPreset } from "./utils/pages/preset-auto.js";
|
|
4
4
|
import { Awaitable, CallbackObject, DistributiveOmit, Document, ExampleObject, HttpMethods, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject } from "./types.js";
|
|
5
5
|
import { Config, OutputFile, generateFiles, generateFilesOnly } from "./generate-file.js";
|
|
6
|
-
export { Awaitable, CallbackObject, Config, DistributiveOmit, Document, ExampleObject, HttpMethods, type MediaAdapter, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, OperationOutput, OutputEntry, OutputFile, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SchemaToPagesOptions, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject, WebhookOutput, createAutoPreset, fromSchema,
|
|
6
|
+
export { Awaitable, CallbackObject, Config, DistributiveOmit, Document, ExampleObject, HttpMethods, type MediaAdapter, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, OperationOutput, OutputEntry, OutputFile, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SchemaToPagesOptions, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject, WebhookOutput, createAutoPreset, fromSchema, generateFiles, generateFilesOnly, getPageProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { traverse } from "../helpers/traverse.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.
|
|
2
|
+
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js
|
|
3
3
|
const DEFAULT_MEDIA_TYPE = "application/json";
|
|
4
4
|
/** Extracts and removes x-example and x-examples extensions from an object */
|
|
5
5
|
function extractXExampleExtensions(obj) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { traverse } from "../helpers/traverse.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.
|
|
2
|
+
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
|
|
3
3
|
const SCHEMA_SEGMENTS = new Set([
|
|
4
4
|
"properties",
|
|
5
5
|
"items",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js
|
|
2
2
|
/**
|
|
3
3
|
* Recursively migrate XML object properties from 3.1 to 3.2 format
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js
|
|
2
2
|
/**
|
|
3
3
|
* Recursively traverses the content and applies the transform function to each node.
|
|
4
4
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { upgradeFromThreeOneToThreeTwo } from "./3.1-to-3.2/upgrade-from-three-one-to-three-two.js";
|
|
2
2
|
import { upgradeFromTwoToThree } from "./2.0-to-3.0/upgrade-from-two-to-three.js";
|
|
3
3
|
import { upgradeFromThreeToThreeOne } from "./3.0-to-3.1/upgrade-from-three-to-three-one.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.
|
|
4
|
+
//#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/upgrade.js
|
|
5
5
|
function upgrade(value, targetVersion) {
|
|
6
6
|
const openapi30 = upgradeFromTwoToThree(value);
|
|
7
7
|
if (targetVersion === "3.0") return openapi30;
|
|
@@ -138,7 +138,7 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
|
|
|
138
138
|
/* @__PURE__ */ jsxs(Select, {
|
|
139
139
|
value: type ?? "",
|
|
140
140
|
onValueChange: setType,
|
|
141
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder:
|
|
141
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t.oauthFlowPlaceholder }) }), /* @__PURE__ */ jsx(SelectContent, { children: Object.keys(scheme.flows).map((key) => {
|
|
142
142
|
const { name, description } = allFlows[key];
|
|
143
143
|
return /* @__PURE__ */ jsxs(SelectItem, {
|
|
144
144
|
value: key,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useTranslations
|
|
2
|
+
import { useTranslations } from "../../ui/client/i18n.js";
|
|
3
3
|
import { useStatusInfo } from "../status-info.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { ClientCodeBlock } from "../../ui/components/codeblock.js";
|
|
@@ -7,6 +7,7 @@ import { require_fast_content_type_parse } from "../../node_modules/.pnpm/fast-c
|
|
|
7
7
|
import { useEffect, useMemo, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { CircleX } from "lucide-react";
|
|
10
|
+
import { renderTranslation } from "fumadocs-core/i18n";
|
|
10
11
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
11
12
|
import { cva } from "class-variance-authority";
|
|
12
13
|
//#region src/playground/components/result-display.tsx
|
|
@@ -76,7 +77,7 @@ function ResponseResult({ data, reset, ...rest }) {
|
|
|
76
77
|
});
|
|
77
78
|
else content = /* @__PURE__ */ jsx("p", {
|
|
78
79
|
className: "p-2 border rounded-lg bg-fd-card text-fd-card-foreground",
|
|
79
|
-
children:
|
|
80
|
+
children: renderTranslation(t.statusBinaryBody, { length: String(data.body.byteLength) })
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTranslations } from "../../ui/client/i18n.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Loader2Icon } from "lucide-react";
|
|
@@ -5,7 +6,7 @@ import { Loader2Icon } from "lucide-react";
|
|
|
5
6
|
function Spinner({ className, ...props }) {
|
|
6
7
|
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
7
8
|
role: "status",
|
|
8
|
-
"aria-label":
|
|
9
|
+
"aria-label": useTranslations().loading,
|
|
9
10
|
className: cn("size-4 animate-spin", className),
|
|
10
11
|
...props
|
|
11
12
|
});
|
package/dist/scalar/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { I18nLabel } from "../ui/client/i18n.js";
|
|
2
3
|
import { cn } from "../utils/cn.js";
|
|
3
4
|
import { MethodLabel } from "../ui/components/method-label.js";
|
|
4
5
|
import { useEffect, useState } from "react";
|
|
@@ -39,7 +40,7 @@ function ScalarPlayground({ path, method, spec }) {
|
|
|
39
40
|
path,
|
|
40
41
|
method
|
|
41
42
|
}),
|
|
42
|
-
children: "
|
|
43
|
+
children: /* @__PURE__ */ jsx(I18nLabel, { label: "test" })
|
|
43
44
|
})
|
|
44
45
|
]
|
|
45
46
|
});
|
package/dist/server/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ interface OpenAPIServer {
|
|
|
43
43
|
pageData: OpenAPIPageData;
|
|
44
44
|
}>>;
|
|
45
45
|
/**
|
|
46
|
-
* Generate virtual pages for Fumadocs Source API
|
|
46
|
+
* Generate virtual pages for Fumadocs Source API (note: please disable cache to allow built-in revalidation)
|
|
47
47
|
*/
|
|
48
48
|
dynamicSource: (options?: OpenAPISourceOptions) => DynamicSource<{
|
|
49
49
|
metaData: MetaData;
|
|
@@ -64,6 +64,7 @@ interface OpenAPIPageData extends PageData {
|
|
|
64
64
|
getClientAPIPageProps: () => Promise<ClientApiPageProps>;
|
|
65
65
|
structuredData: StructuredData;
|
|
66
66
|
toc: TOCItemType[];
|
|
67
|
+
_openapi?: InternalOpenAPIMeta;
|
|
67
68
|
}
|
|
68
69
|
type OpenAPISourceOptions = SchemaToPagesOptions & {
|
|
69
70
|
baseDir?: string; /** Generate `meta.json` files */
|
|
@@ -76,14 +77,6 @@ declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
|
|
|
76
77
|
* @deprecated
|
|
77
78
|
*/
|
|
78
79
|
declare function createCodeSample<T>(options: InlineCodeUsageGenerator<T>): InlineCodeUsageGenerator<T>;
|
|
79
|
-
declare module 'fumadocs-core/source' {
|
|
80
|
-
interface PageData {
|
|
81
|
-
/**
|
|
82
|
-
* Added by Fumadocs OpenAPI
|
|
83
|
-
*/
|
|
84
|
-
_openapi?: InternalOpenAPIMeta;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
80
|
interface InternalOpenAPIMeta {
|
|
88
81
|
method?: string;
|
|
89
82
|
webhook?: boolean;
|
package/dist/server/index.js
CHANGED
|
@@ -23,11 +23,12 @@ function createOpenAPI(options = {}) {
|
|
|
23
23
|
async function getVirtualFiles(server, options) {
|
|
24
24
|
const { baseDir = "", meta = false } = options;
|
|
25
25
|
const { createAutoPreset } = await import("../utils/pages/preset-auto.js");
|
|
26
|
-
const {
|
|
26
|
+
const { fromSchema } = await import("../utils/pages/builder.js");
|
|
27
27
|
const files = [];
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const schemas = await server.getSchemas();
|
|
29
|
+
const builderOptions = createAutoPreset(options);
|
|
30
|
+
for (const [id, schema] of Object.entries(schemas)) {
|
|
31
|
+
onEntries(fromSchema(id, schema, builderOptions));
|
|
31
32
|
function onEntry(entry) {
|
|
32
33
|
const props = getPageProps(entry);
|
|
33
34
|
files.push({
|
|
@@ -41,7 +42,7 @@ function createOpenAPI(options = {}) {
|
|
|
41
42
|
async getClientAPIPageProps() {
|
|
42
43
|
return {
|
|
43
44
|
payload: {
|
|
44
|
-
bundled:
|
|
45
|
+
bundled: schema.bundled,
|
|
45
46
|
proxyUrl: server.options.proxyUrl
|
|
46
47
|
},
|
|
47
48
|
...props
|
|
@@ -49,11 +50,11 @@ function createOpenAPI(options = {}) {
|
|
|
49
50
|
},
|
|
50
51
|
getSchema() {
|
|
51
52
|
return {
|
|
52
|
-
id
|
|
53
|
-
...
|
|
53
|
+
id,
|
|
54
|
+
...schema
|
|
54
55
|
};
|
|
55
56
|
},
|
|
56
|
-
...toStaticData(props,
|
|
57
|
+
...toStaticData(props, schema.dereferenced),
|
|
57
58
|
_openapi: {
|
|
58
59
|
method: entry.type === "operation" || entry.type === "webhook" ? entry.item.method : void 0,
|
|
59
60
|
webhook: entry.type === "webhook",
|
|
@@ -92,7 +93,6 @@ function createOpenAPI(options = {}) {
|
|
|
92
93
|
}
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
|
-
onEntries(list);
|
|
96
96
|
}
|
|
97
97
|
return files;
|
|
98
98
|
}
|
package/dist/ui/client/i18n.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defaultTranslations } from "../../i18n.js";
|
|
3
|
-
import {
|
|
3
|
+
import { renderTranslation } from "fumadocs-core/i18n";
|
|
4
|
+
import { useTranslations } from "fumadocs-ui/contexts/i18n";
|
|
4
5
|
//#region src/ui/client/i18n.ts
|
|
5
|
-
function useTranslations() {
|
|
6
|
-
return
|
|
6
|
+
function useTranslations$1() {
|
|
7
|
+
return useTranslations("openapi") ?? defaultTranslations;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Renders a translated string. Use in server components so the label is resolved on the client from the current locale.
|
|
10
11
|
*/
|
|
11
|
-
function I18nLabel({ label, replacements
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
function withReplacements(t, replacements) {
|
|
15
|
-
for (const [k, v] of Object.entries(replacements)) t = t.replaceAll(`{${k}}`, v);
|
|
16
|
-
return t;
|
|
12
|
+
function I18nLabel({ label, replacements }) {
|
|
13
|
+
return renderTranslation(useTranslations$1()[label], replacements);
|
|
17
14
|
}
|
|
18
15
|
//#endregion
|
|
19
|
-
export { I18nLabel, useTranslations
|
|
16
|
+
export { I18nLabel, useTranslations$1 as useTranslations };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bundle } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js";
|
|
2
|
-
import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.
|
|
2
|
+
import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.8/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
|
|
3
3
|
import { fetchUrls } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js";
|
|
4
4
|
import { readFiles } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js";
|
|
5
5
|
import "../../node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ApiPageProps, OperationItem, WebhookItem } from "../../ui/api-page.js";
|
|
2
|
-
import { OpenAPIServer } from "../../server/index.js";
|
|
3
2
|
import { OperationObject, PathItemObject, TagObject } from "../../types.js";
|
|
4
3
|
import { NoReference } from "../schema/index.js";
|
|
5
4
|
import { DereferencedDocument } from "../document/dereference.js";
|
|
@@ -83,8 +82,7 @@ interface ExtractedInfo {
|
|
|
83
82
|
tags?: string[];
|
|
84
83
|
})[];
|
|
85
84
|
}
|
|
86
|
-
declare function fromServer(server: OpenAPIServer, config: PagesBuilderConfig): Promise<Record<string, OutputEntry[]>>;
|
|
87
85
|
declare function fromSchema(schemaId: string, processed: DereferencedDocument, config: PagesBuilderConfig): OutputEntry[];
|
|
88
86
|
declare function getPageProps(entry: PageOutput | OperationOutput | WebhookOutput): ApiPageProps;
|
|
89
87
|
//#endregion
|
|
90
|
-
export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema,
|
|
88
|
+
export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, getPageProps };
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { idToTitle } from "../id-to-title.js";
|
|
2
2
|
import { getTagDisplayName, methodKeys } from "../schema/index.js";
|
|
3
3
|
//#region src/utils/pages/builder.ts
|
|
4
|
-
async function fromServer(server, config) {
|
|
5
|
-
const schemas = await server.getSchemas();
|
|
6
|
-
const generated = {};
|
|
7
|
-
const entries = Object.entries(schemas);
|
|
8
|
-
if (entries.length === 0) throw new Error("No input files found.");
|
|
9
|
-
for (const [id, schema] of entries) generated[id] = fromSchema(id, schema, config);
|
|
10
|
-
return generated;
|
|
11
|
-
}
|
|
12
4
|
function fromSchema(schemaId, processed, config) {
|
|
13
5
|
const files = [];
|
|
14
6
|
const { toPages } = config;
|
|
@@ -117,4 +109,4 @@ function getPageProps(entry) {
|
|
|
117
109
|
};
|
|
118
110
|
}
|
|
119
111
|
//#endregion
|
|
120
|
-
export { fromSchema,
|
|
112
|
+
export { fromSchema, getPageProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { require_deepmerge } from "../../node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
|
|
2
1
|
import { isPlainObject } from "../is-plain-object.js";
|
|
2
|
+
import { require_deepmerge } from "../../node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
|
|
3
3
|
import { resolveRefSync } from "./resolve-ref.js";
|
|
4
4
|
const mergeDeep = (0, require_deepmerge().deepmerge)({
|
|
5
5
|
all: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.9.1",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -53,34 +53,34 @@
|
|
|
53
53
|
"lucide-react": "^1.16.0",
|
|
54
54
|
"remark": "^15.0.1",
|
|
55
55
|
"remark-rehype": "^11.1.2",
|
|
56
|
-
"shiki": "^4.0
|
|
56
|
+
"shiki": "^4.1.0",
|
|
57
57
|
"tailwind-merge": "^3.6.0",
|
|
58
58
|
"@fumari/stf": "1.0.5"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@fastify/deepmerge": "^3.2.1",
|
|
62
|
-
"@scalar/api-client-react": "2.0.
|
|
62
|
+
"@scalar/api-client-react": "2.0.20",
|
|
63
63
|
"@scalar/json-magic": "^0.12.14",
|
|
64
|
-
"@scalar/openapi-upgrader": "^0.2.
|
|
64
|
+
"@scalar/openapi-upgrader": "^0.2.8",
|
|
65
65
|
"@tailwindcss/oxide": "^4.3.0",
|
|
66
66
|
"@types/js-yaml": "^4.0.9",
|
|
67
|
-
"@types/node": "25.
|
|
68
|
-
"@types/react": "^19.2.
|
|
67
|
+
"@types/node": "25.9.1",
|
|
68
|
+
"@types/react": "^19.2.15",
|
|
69
69
|
"ajv": "^8.20.0",
|
|
70
70
|
"fast-content-type-parse": "^3.0.0",
|
|
71
71
|
"json-schema-typed": "^8.0.2",
|
|
72
72
|
"tailwindcss": "^4.3.0",
|
|
73
73
|
"tsdown": "0.22.0",
|
|
74
74
|
"xml-js": "^1.6.11",
|
|
75
|
-
"fumadocs-core": "16.
|
|
76
|
-
"fumadocs-ui": "16.
|
|
75
|
+
"fumadocs-core": "16.9.2",
|
|
76
|
+
"fumadocs-ui": "16.9.2",
|
|
77
77
|
"tsconfig": "0.0.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@scalar/api-client-react": "2.0.1",
|
|
81
81
|
"@types/react": "*",
|
|
82
|
-
"fumadocs-core": "^16.
|
|
83
|
-
"fumadocs-ui": "^16.
|
|
82
|
+
"fumadocs-core": "^16.9.0",
|
|
83
|
+
"fumadocs-ui": "^16.9.0",
|
|
84
84
|
"json-schema-typed": "*",
|
|
85
85
|
"react": "^19.2.0",
|
|
86
86
|
"react-dom": "^19.2.0"
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@fastify/deepmerge": "3.2.1",
|
|
101
101
|
"@scalar/helpers": "0.8.0",
|
|
102
102
|
"@scalar/json-magic": "0.12.14",
|
|
103
|
-
"@scalar/openapi-upgrader": "0.2.
|
|
103
|
+
"@scalar/openapi-upgrader": "0.2.8",
|
|
104
104
|
"ajv": "8.20.0",
|
|
105
105
|
"fast-content-type-parse": "3.0.0",
|
|
106
106
|
"fast-deep-equal": "3.1.3",
|