fumadocs-openapi 10.1.1 → 10.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/operation/index.js +6 -6
- package/dist/ui/operation/request-tabs.d.ts.map +1 -1
- package/dist/ui/operation/request-tabs.js +2 -2
- package/dist/ui/operation/response-tabs.d.ts.map +1 -1
- package/dist/ui/operation/response-tabs.js +2 -2
- package/dist/utils/pages/builder.js +3 -3
- package/dist/utils/pages/to-text.js +1 -1
- package/package.json +7 -7
|
@@ -11,7 +11,7 @@ import { AccordionContent, AccordionHeader, AccordionItem, Accordions, Accordion
|
|
|
11
11
|
import { isMediaTypeSupported } from '../../requests/media/adapter.js';
|
|
12
12
|
import { cn } from 'fumadocs-ui/utils/cn';
|
|
13
13
|
import { APIPlayground } from '../../playground/index.js';
|
|
14
|
-
import {
|
|
14
|
+
import { getExampleRequests, RequestTabs } from './request-tabs.js';
|
|
15
15
|
import { UsageTabsProviderLazy } from './usage-tabs/lazy.js';
|
|
16
16
|
const ParamTypes = {
|
|
17
17
|
path: 'Path Parameters',
|
|
@@ -31,7 +31,7 @@ export async function Operation({ type = 'operation', path, method, ctx, showTit
|
|
|
31
31
|
let responseNode = null;
|
|
32
32
|
let callbacksNode = null;
|
|
33
33
|
if (showTitle) {
|
|
34
|
-
const title = method.summary
|
|
34
|
+
const title = method.summary ||
|
|
35
35
|
(method.operationId ? idToTitle(method.operationId) : path);
|
|
36
36
|
headNode = ctx.renderHeading(headingLevel, title);
|
|
37
37
|
headingLevel++;
|
|
@@ -42,7 +42,7 @@ export async function Operation({ type = 'operation', path, method, ctx, showTit
|
|
|
42
42
|
label: _jsx("code", { className: "text-xs", children: key }),
|
|
43
43
|
value: key,
|
|
44
44
|
}));
|
|
45
|
-
bodyNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex gap-2 items-center justify-between", children: [ctx.renderHeading(headingLevel, 'Request Body', {
|
|
45
|
+
bodyNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex gap-2 items-center justify-between mt-10", children: [ctx.renderHeading(headingLevel, 'Request Body', {
|
|
46
46
|
className: 'my-0!',
|
|
47
47
|
}), contentTypes.length > 1 ? (_jsx(SelectTabTrigger, { items: items, className: "font-medium" })) : (_jsx("p", { className: "text-fd-muted-foreground not-prose", children: items[0].label }))] }), body.description && ctx.renderMarkdown(body.description), contentTypes.map(([type, content]) => {
|
|
48
48
|
if (!isMediaTypeSupported(type, ctx.mediaAdapters)) {
|
|
@@ -82,7 +82,7 @@ export async function Operation({ type = 'operation', path, method, ctx, showTit
|
|
|
82
82
|
label: (_jsx("div", { className: "flex flex-col text-xs min-w-0", children: Object.entries(security).map(([key, scopes]) => (_jsxs("code", { className: "truncate", children: [_jsx("span", { className: "font-medium", children: key }), ' ', scopes.length > 0 && (_jsx("span", { className: "text-fd-muted-foreground", children: scopes.join(', ') }))] }, key))) })),
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
|
-
authNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex items-start justify-between gap-2 mt-10
|
|
85
|
+
authNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex items-start justify-between gap-2 mt-10", children: [ctx.renderHeading(headingLevel, 'Authorization', {
|
|
86
86
|
className: 'my-0!',
|
|
87
87
|
}), items.length > 1 ? (_jsx(SelectTabTrigger, { items: items })) : (_jsx("p", { className: "not-prose", children: items[0].label }))] }), securities.map((security, i) => (_jsx(SelectTab, { value: items[i].value, children: Object.entries(security).map(([key, scopes]) => {
|
|
88
88
|
const scheme = securitySchemes?.[key];
|
|
@@ -97,7 +97,7 @@ export async function Operation({ type = 'operation', path, method, ctx, showTit
|
|
|
97
97
|
label: _jsx("code", { className: "text-xs", children: key }),
|
|
98
98
|
value: key,
|
|
99
99
|
}));
|
|
100
|
-
callbacksNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex justify-between gap-2 items-end mt-10
|
|
100
|
+
callbacksNode = (_jsxs(SelectTabs, { defaultValue: items[0].value, children: [_jsxs("div", { className: "flex justify-between gap-2 items-end mt-10", children: [ctx.renderHeading(headingLevel, 'Callbacks', {
|
|
101
101
|
className: 'my-0!',
|
|
102
102
|
}), callbacks.length > 1 ? (_jsx(SelectTabTrigger, { items: items, className: "font-medium" })) : (_jsx("p", { className: "text-fd-muted-foreground not-prose", children: items[0].label }))] }), callbacks.map(([name, callback]) => (_jsx(SelectTab, { value: name, children: _jsx(WebhookCallback, { callback: callback, ctx: ctx, headingLevel: headingLevel }) }, name)))] }));
|
|
103
103
|
}
|
|
@@ -190,5 +190,5 @@ function AuthScheme({ scheme: schema, scopes, ctx, }) {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
function AuthProperty({ name, type, scopes = [], className, ...props }) {
|
|
193
|
-
return (_jsxs("div", { className: cn('text-sm border-t
|
|
193
|
+
return (_jsxs("div", { className: cn('text-sm border-t my-4 first:border-t-0', className), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-3 not-prose", children: [_jsx("span", { className: "font-medium font-mono text-fd-primary", children: name }), _jsx("span", { className: "text-sm font-mono text-fd-muted-foreground", children: type })] }), _jsxs("div", { className: "prose-no-margin pt-2.5 empty:hidden", children: [props.children, scopes.length > 0 && (_jsxs("p", { children: ["Scope: ", _jsx("code", { children: scopes.join(', ') })] }))] })] }));
|
|
194
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/operation/request-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"request-tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/operation/request-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AASpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAWpE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,WAAW,CAAC,iBAAiB,CAAC,EACzC,GAAG,EAAE,aAAa,GACjB,kBAAkB,EAAE,CA0CtB;AAkFD,wBAAsB,WAAW,CAAC,EAChC,IAAI,EACJ,SAAS,EACT,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC1C,GAAG,EAAE,aAAa,CAAC;CACpB,kIASA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getPreferredType } from '../../utils/schema.js';
|
|
3
|
-
import {
|
|
3
|
+
import { AccordionContent, AccordionHeader, AccordionItem, Accordions, AccordionTrigger, } from '../../ui/components/accordion.js';
|
|
4
4
|
import { sample } from 'openapi-sampler';
|
|
5
5
|
import { encodeRequestData } from '../../requests/media/encode.js';
|
|
6
6
|
import { Tabs, TabsContent, TabsList, TabsTrigger, } from 'fumadocs-ui/components/tabs';
|
|
@@ -17,7 +17,7 @@ export function getExampleRequests(path, operation, ctx) {
|
|
|
17
17
|
const data = getRequestData(path, operation, key, ctx);
|
|
18
18
|
result.push({
|
|
19
19
|
id: key,
|
|
20
|
-
name: value.summary
|
|
20
|
+
name: value.summary || key,
|
|
21
21
|
description: value.description,
|
|
22
22
|
data,
|
|
23
23
|
encoded: encodeRequestData(data, ctx.mediaAdapters, operation.parameters ?? []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/operation/response-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"response-tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/operation/response-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,UAAU,eAAe;IACvB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,GAAG,GACJ,EAAE;IACD,SAAS,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC1C,GAAG,EAAE,aAAa,CAAC;CACpB,kCAwCA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getPreferredType } from '../../utils/schema.js';
|
|
3
|
-
import {
|
|
3
|
+
import { AccordionContent, AccordionHeader, AccordionItem, Accordions, AccordionTrigger, } from '../../ui/components/accordion.js';
|
|
4
4
|
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
|
|
5
5
|
import { sample } from 'openapi-sampler';
|
|
6
6
|
export function ResponseTabs({ operation, ctx, }) {
|
|
@@ -18,7 +18,7 @@ export function ResponseTabs({ operation, ctx, }) {
|
|
|
18
18
|
if (responseOfType?.examples) {
|
|
19
19
|
tab.examples ?? (tab.examples = []);
|
|
20
20
|
for (const [key, sample] of Object.entries(responseOfType.examples)) {
|
|
21
|
-
const title = sample?.summary
|
|
21
|
+
const title = sample?.summary || `Example ${key}`;
|
|
22
22
|
tab.examples.push({
|
|
23
23
|
label: title,
|
|
24
24
|
sample: sample.value,
|
|
@@ -48,7 +48,7 @@ export function fromSchema(schemaId, processed, config) {
|
|
|
48
48
|
pathItem,
|
|
49
49
|
operation,
|
|
50
50
|
get displayName() {
|
|
51
|
-
return operation.summary
|
|
51
|
+
return operation.summary || pathItem.summary || idToTitle(item.name);
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
},
|
|
@@ -63,8 +63,8 @@ export function fromSchema(schemaId, processed, config) {
|
|
|
63
63
|
pathItem,
|
|
64
64
|
operation,
|
|
65
65
|
get displayName() {
|
|
66
|
-
return (operation.summary
|
|
67
|
-
pathItem.summary
|
|
66
|
+
return (operation.summary ||
|
|
67
|
+
pathItem.summary ||
|
|
68
68
|
(operation.operationId
|
|
69
69
|
? idToTitle(operation.operationId)
|
|
70
70
|
: item.path));
|
|
@@ -116,7 +116,7 @@ function generateStaticData(dereferenced, props) {
|
|
|
116
116
|
if (!operation)
|
|
117
117
|
continue;
|
|
118
118
|
if (props.showTitle && operation.operationId) {
|
|
119
|
-
const title = operation.summary
|
|
119
|
+
const title = operation.summary ||
|
|
120
120
|
(operation.operationId ? idToTitle(operation.operationId) : item.path);
|
|
121
121
|
const id = slugger.slug(title);
|
|
122
122
|
toc.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.2",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
55
55
|
"@radix-ui/react-select": "^2.2.6",
|
|
56
56
|
"@radix-ui/react-slot": "^1.2.4",
|
|
57
|
-
"@scalar/json-magic": "^0.8.
|
|
58
|
-
"@scalar/openapi-parser": "0.23.
|
|
57
|
+
"@scalar/json-magic": "^0.8.4",
|
|
58
|
+
"@scalar/openapi-parser": "0.23.5",
|
|
59
59
|
"ajv": "^8.17.1",
|
|
60
60
|
"class-variance-authority": "^0.7.1",
|
|
61
61
|
"github-slugger": "^2.0.0",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"xml-js": "^1.6.11"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@scalar/api-client-react": "^1.3.
|
|
72
|
+
"@scalar/api-client-react": "^1.3.53",
|
|
73
73
|
"@types/js-yaml": "^4.0.9",
|
|
74
|
-
"@types/node": "24.10.
|
|
74
|
+
"@types/node": "24.10.2",
|
|
75
75
|
"@types/openapi-sampler": "^1.0.3",
|
|
76
76
|
"@types/react": "^19.2.7",
|
|
77
77
|
"json-schema-typed": "^8.0.2",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"tailwindcss": "^4.1.17",
|
|
80
80
|
"tsc-alias": "^1.8.16",
|
|
81
81
|
"eslint-config-custom": "0.0.0",
|
|
82
|
-
"fumadocs-
|
|
83
|
-
"fumadocs-
|
|
82
|
+
"fumadocs-core": "16.2.4",
|
|
83
|
+
"fumadocs-ui": "16.2.4",
|
|
84
84
|
"tsconfig": "0.0.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|