fumadocs-openapi 7.0.5 → 7.0.6

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 ((param.length === 0 && type !== 'header') || !authorization)
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}`;
@@ -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
- const singular = security.find((requirements) => Object.keys(requirements).length === 1);
43
- if (!singular) {
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(singular, document)[0];
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -62,8 +62,8 @@
62
62
  "remark-rehype": "^11.1.1",
63
63
  "shiki": "^3.2.1",
64
64
  "xml-js": "^1.6.11",
65
- "fumadocs-core": "15.1.2",
66
- "fumadocs-ui": "15.1.2"
65
+ "fumadocs-core": "15.1.3",
66
+ "fumadocs-ui": "15.1.3"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@scalar/api-client-react": "^1.2.7",
@@ -75,8 +75,8 @@
75
75
  "openapi-types": "^12.1.3",
76
76
  "tailwindcss": "^4.0.15",
77
77
  "tsc-alias": "^1.8.11",
78
- "tsconfig": "0.0.0",
79
- "eslint-config-custom": "0.0.0"
78
+ "eslint-config-custom": "0.0.0",
79
+ "tsconfig": "0.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@scalar/api-client-react": "*",