fumadocs-openapi 7.0.5 → 7.0.7
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.
|
@@ -94,7 +94,9 @@ function FormBody({ authorization, parameters = [], body, fields = {}, }) {
|
|
|
94
94
|
return (_jsxs(_Fragment, { children: [servers.length > 1 ? (_jsx(CollapsiblePanel, { title: "Server URL", children: _jsx(ServerSelect, { server: server, onServerChanged: setServer, onVariablesChanged: setServerVariables }) })) : null, params.map((param, i) => {
|
|
95
95
|
const name = paramNames[i];
|
|
96
96
|
const type = paramTypes[i];
|
|
97
|
-
if (
|
|
97
|
+
if (type !== 'header' && param.length === 0)
|
|
98
|
+
return;
|
|
99
|
+
if (type === 'header' && !authorization && param.length === 0)
|
|
98
100
|
return;
|
|
99
101
|
return (_jsxs(CollapsiblePanel, { title: name, children: [type === 'header' && authorization ? (_jsx(AuthField, { authorization: authorization })) : null, param.map((field) => {
|
|
100
102
|
const fieldName = `${type}.${field.name}`;
|
package/dist/playground/index.js
CHANGED
|
@@ -39,12 +39,19 @@ function getAuthorizationField(method, { schema: { document } }) {
|
|
|
39
39
|
const security = method.security ?? document.security ?? [];
|
|
40
40
|
if (security.length === 0)
|
|
41
41
|
return;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
let item;
|
|
43
|
+
for (const requirements of security) {
|
|
44
|
+
const keys = Object.keys(requirements).length;
|
|
45
|
+
if (keys === 0)
|
|
46
|
+
return;
|
|
47
|
+
else if (keys === 1)
|
|
48
|
+
item = requirements;
|
|
49
|
+
}
|
|
50
|
+
if (!item) {
|
|
44
51
|
console.warn(`Cannot find suitable security schema for API Playground from ${JSON.stringify(security, null, 2)}. Only one requirement is allowed`);
|
|
45
52
|
return;
|
|
46
53
|
}
|
|
47
|
-
const scheme = getSecurities(
|
|
54
|
+
const scheme = getSecurities(item, document)[0];
|
|
48
55
|
if (scheme.type === 'oauth2') {
|
|
49
56
|
const flow = Object.keys(scheme.flows).at(0);
|
|
50
57
|
if (!flow)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/operation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAEV,iBAAiB,EAEjB,aAAa,EAEd,MAAM,SAAS,CAAC;AAgBjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC,GACxD,KAAK,CAAC;CACX;AASD,wBAAgB,SAAS,CAAC,EACxB,IAAkB,EAClB,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;IAEnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/operation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAEV,iBAAiB,EAEjB,aAAa,EAEd,MAAM,SAAS,CAAC;AAgBjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC,GACxD,KAAK,CAAC;CACX;AASD,wBAAgB,SAAS,CAAC,EACxB,IAAkB,EAClB,IAAI,EACJ,MAAM,EACN,GAAG,EACH,OAAO,EACP,YAAgB,GACjB,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;IAEnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,YAAY,CAuLf"}
|
|
@@ -18,7 +18,6 @@ const ParamTypes = {
|
|
|
18
18
|
};
|
|
19
19
|
export function Operation({ type = 'operation', path, method, ctx, hasHead, headingLevel = 2, }) {
|
|
20
20
|
const body = method.requestBody;
|
|
21
|
-
const security = method.security ?? ctx.schema.document.security;
|
|
22
21
|
let headNode = null;
|
|
23
22
|
let bodyNode = null;
|
|
24
23
|
let responseNode = null;
|
|
@@ -79,7 +78,10 @@ export function Operation({ type = 'operation', path, method, ctx, hasHead, head
|
|
|
79
78
|
if (method.callbacks) {
|
|
80
79
|
callbacksNode = (_jsxs(_Fragment, { children: [heading(headingLevel, 'Webhooks', ctx), Object.entries(method.callbacks).map(([name, callback]) => (_jsx(WebhookCallback, { callback: callback, ctx: ctx, headingLevel: headingLevel }, name)))] }));
|
|
81
80
|
}
|
|
82
|
-
const
|
|
81
|
+
const security = (method.security ??
|
|
82
|
+
ctx.schema.document.security ??
|
|
83
|
+
[]).filter((v) => Object.keys(v).length > 0);
|
|
84
|
+
const info = (_jsxs(ctx.renderer.APIInfo, { head: headNode, method: method.method, route: path, children: [type === 'operation' ? (ctx.disablePlayground ? (_jsxs("div", { className: "flex flex-row items-center gap-2.5 p-3 rounded-xl border bg-fd-card text-fd-card-foreground not-prose", children: [_jsx(MethodLabel, { className: "text-xs", children: method.method }), _jsx("code", { className: "flex-1 overflow-auto text-nowrap text-[13px] text-fd-muted-foreground", children: path })] })) : (_jsx(ctx.renderer.APIPlayground, { path: path, method: method, ctx: ctx }))) : null, security.length > 0 ? (_jsxs(_Fragment, { children: [heading(headingLevel, 'Authorization', ctx), _jsx(AuthSection, { requirements: security, ctx: ctx })] })) : null, bodyNode, parameterNode, responseNode, callbacksNode] }));
|
|
83
85
|
if (type === 'operation') {
|
|
84
86
|
const examples = getAPIExamples(path, method, ctx);
|
|
85
87
|
return (_jsx(ctx.renderer.API, { children: _jsxs(APIExampleProvider, { route: path, examples: examples, method: method, children: [info, _jsx(APIExample, { examples: examples, method: method, ctx: ctx })] }) }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.7",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -54,29 +54,29 @@
|
|
|
54
54
|
"github-slugger": "^2.0.0",
|
|
55
55
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
56
56
|
"js-yaml": "^4.1.0",
|
|
57
|
-
"lucide-react": "^0.
|
|
57
|
+
"lucide-react": "^0.485.0",
|
|
58
58
|
"next-themes": "^0.4.6",
|
|
59
59
|
"openapi-sampler": "^1.6.1",
|
|
60
|
-
"react-hook-form": "^7.
|
|
60
|
+
"react-hook-form": "^7.55.0",
|
|
61
61
|
"remark": "^15.0.1",
|
|
62
62
|
"remark-rehype": "^11.1.1",
|
|
63
63
|
"shiki": "^3.2.1",
|
|
64
64
|
"xml-js": "^1.6.11",
|
|
65
|
-
"fumadocs-core": "15.
|
|
66
|
-
"fumadocs-ui": "15.
|
|
65
|
+
"fumadocs-core": "15.2.0",
|
|
66
|
+
"fumadocs-ui": "15.2.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@scalar/api-client-react": "^1.2.
|
|
69
|
+
"@scalar/api-client-react": "^1.2.9",
|
|
70
70
|
"@types/js-yaml": "^4.0.9",
|
|
71
|
-
"@types/node": "22.13.
|
|
71
|
+
"@types/node": "22.13.14",
|
|
72
72
|
"@types/openapi-sampler": "^1.0.3",
|
|
73
73
|
"@types/react": "^19.0.12",
|
|
74
|
-
"next": "15.2.
|
|
74
|
+
"next": "15.2.4",
|
|
75
75
|
"openapi-types": "^12.1.3",
|
|
76
|
-
"tailwindcss": "^4.0.
|
|
77
|
-
"tsc-alias": "^1.8.
|
|
78
|
-
"
|
|
79
|
-
"
|
|
76
|
+
"tailwindcss": "^4.0.17",
|
|
77
|
+
"tsc-alias": "^1.8.12",
|
|
78
|
+
"eslint-config-custom": "0.0.0",
|
|
79
|
+
"tsconfig": "0.0.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@scalar/api-client-react": "*",
|