fumadocs-openapi 10.6.5 → 10.6.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.
Files changed (47) hide show
  1. package/css/generated/shared.css +59 -6
  2. package/dist/generate-file.js +3 -2
  3. package/dist/i18n.d.ts +3 -1
  4. package/dist/i18n.js +3 -1
  5. package/dist/playground/auth.js +92 -0
  6. package/dist/playground/client.d.ts +5 -12
  7. package/dist/playground/client.js +257 -217
  8. package/dist/playground/components/inputs.js +2 -2
  9. package/dist/playground/components/oauth-dialog.js +126 -163
  10. package/dist/playground/components/result-display.d.ts +16 -0
  11. package/dist/playground/components/result-display.js +141 -0
  12. package/dist/playground/components/server-select.js +1 -1
  13. package/dist/playground/components/spinner.js +14 -0
  14. package/dist/playground/fetcher.d.ts +9 -3
  15. package/dist/playground/fetcher.js +7 -18
  16. package/dist/playground/status-info.js +27 -23
  17. package/dist/requests/generators/csharp.js +2 -1
  18. package/dist/requests/generators/curl.js +5 -5
  19. package/dist/requests/generators/go.js +5 -5
  20. package/dist/requests/generators/java.js +4 -4
  21. package/dist/requests/generators/javascript.js +3 -3
  22. package/dist/requests/generators/python.js +5 -4
  23. package/dist/requests/media/adapter.js +7 -7
  24. package/dist/requests/string-utils.js +25 -4
  25. package/dist/requests/types.d.ts +3 -2
  26. package/dist/ui/api-page.js +3 -1
  27. package/dist/ui/base.d.ts +8 -4
  28. package/dist/ui/base.js +6 -1
  29. package/dist/ui/client/boundary.lazy.js +2 -1
  30. package/dist/ui/client/i18n.js +6 -4
  31. package/dist/ui/client/storage-key.js +1 -1
  32. package/dist/ui/components/dialog.js +1 -1
  33. package/dist/ui/contexts/api.d.ts +6 -3
  34. package/dist/ui/contexts/api.js +7 -2
  35. package/dist/ui/create-client.js +5 -0
  36. package/dist/ui/operation/client.js +1 -1
  37. package/dist/ui/operation/index.js +1 -1
  38. package/dist/ui/operation/request-tabs.d.ts +10 -0
  39. package/dist/ui/operation/request-tabs.js +44 -38
  40. package/dist/ui/operation/usage-tabs/client.js +1 -1
  41. package/dist/ui/schema/client.js +2 -2
  42. package/dist/ui/schema/index.js +1 -1
  43. package/dist/utils/pages/to-text.js +5 -4
  44. package/dist/utils/schema/index.d.ts +3 -4
  45. package/dist/utils/schema/index.js +4 -9
  46. package/dist/utils/use-query.js +2 -1
  47. package/package.json +11 -10
@@ -1,5 +1,6 @@
1
1
  import { removeUndefined } from "../remove-undefined.js";
2
2
  import { toStaticData } from "./to-static-data.js";
3
+ import { doubleQuote } from "../../requests/string-utils.js";
3
4
  import { dump } from "js-yaml";
4
5
  //#region src/utils/pages/to-text.ts
5
6
  function toText(entry, processed, options = {}) {
@@ -36,7 +37,7 @@ function generateDocument(frontmatter, content, options) {
36
37
  commentContent = commentContent.replaceAll("/", "\\/");
37
38
  out.push(`{/* ${commentContent} */}`);
38
39
  }
39
- if (imports) out.push(...imports.map((item) => `import { ${item.names.join(", ")} } from ${JSON.stringify(item.from)};`).join("\n"));
40
+ if (imports) out.push(...imports.map((item) => `import { ${item.names.join(", ")} } from ${doubleQuote(item.from)};`).join("\n"));
40
41
  out.push(content);
41
42
  return out.join("\n\n");
42
43
  }
@@ -70,7 +71,7 @@ function generatePage(schemaId, processed, pageProps, options, context) {
70
71
  }, content.join("\n\n"), options);
71
72
  }
72
73
  function pageContent({ showTitle, showDescription, document, webhooks, operations }) {
73
- const propStrs = [`document={${JSON.stringify(document)}}`];
74
+ const propStrs = [`document={${doubleQuote(document)}}`];
74
75
  if (webhooks) propStrs.push(`webhooks={${JSON.stringify(webhooks.map((item) => ({
75
76
  name: item.name,
76
77
  method: item.method
@@ -79,8 +80,8 @@ function pageContent({ showTitle, showDescription, document, webhooks, operation
79
80
  path: item.path,
80
81
  method: item.method
81
82
  })))}}`);
82
- if (showTitle) propStrs.push(`showTitle={${JSON.stringify(showTitle)}}`);
83
- if (showDescription) propStrs.push(`showDescription={${JSON.stringify(showDescription)}}`);
83
+ if (showTitle) propStrs.push(`showTitle`);
84
+ if (showDescription) propStrs.push(`showDescription`);
84
85
  return `<APIPage ${propStrs.join(" ")} />`;
85
86
  }
86
87
  //#endregion
@@ -1,4 +1,4 @@
1
- import { ReferenceObject, SecuritySchemeObject } from "../../types.js";
1
+ import { ReferenceObject } from "../../types.js";
2
2
  import { JSONSchema } from "json-schema-typed/draft-2020-12";
3
3
 
4
4
  //#region src/utils/schema/index.d.ts
@@ -6,10 +6,9 @@ type NoReference<T> = T extends (infer I)[] ? NoReference<I>[] : T extends Refer
6
6
  type ParsedSchema = (JSONSchema & {
7
7
  'x-playground-lazy'?: boolean;
8
8
  }) | boolean;
9
- /** parsed security scheme objects */
10
- type SecurityEntry = SecuritySchemeObject & {
9
+ interface SecurityEntry {
11
10
  scopes: string[];
12
11
  id: string;
13
- };
12
+ }
14
13
  //#endregion
15
14
  export { NoReference, ParsedSchema, SecurityEntry };
@@ -51,15 +51,10 @@ function parseSecurities(method, dereferenced) {
51
51
  if (security.length === 0) return result;
52
52
  for (const map of security) {
53
53
  const list = [];
54
- for (const [key, scopes] of Object.entries(map)) {
55
- const scheme = dereferenced.components?.securitySchemes?.[key];
56
- if (!scheme) continue;
57
- list.push({
58
- ...scheme,
59
- scopes,
60
- id: key
61
- });
62
- }
54
+ for (const [key, scopes] of Object.entries(map)) list.push({
55
+ id: key,
56
+ scopes
57
+ });
63
58
  if (list.length > 0) result.push(list);
64
59
  }
65
60
  return result;
@@ -12,9 +12,10 @@ function useQuery(fn) {
12
12
  error,
13
13
  start(...input) {
14
14
  setLoading(true);
15
- fnRef.current(...input).then((res) => {
15
+ return fnRef.current(...input).then((res) => {
16
16
  setData(res);
17
17
  setError(void 0);
18
+ return res;
18
19
  }).catch((err) => {
19
20
  setData(void 0);
20
21
  setError(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.6.5",
3
+ "version": "10.6.7",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -49,37 +49,38 @@
49
49
  "@radix-ui/react-dialog": "^1.1.15",
50
50
  "@radix-ui/react-select": "^2.2.6",
51
51
  "@radix-ui/react-slot": "^1.2.4",
52
- "@scalar/json-magic": "^0.12.4",
53
- "@scalar/openapi-upgrader": "^0.2.2",
52
+ "@scalar/json-magic": "^0.12.5",
53
+ "@scalar/openapi-upgrader": "^0.2.4",
54
54
  "ajv": "^8.18.0",
55
55
  "chokidar": "^5.0.0",
56
56
  "class-variance-authority": "^0.7.1",
57
+ "fast-content-type-parse": "^3.0.0",
57
58
  "github-slugger": "^2.0.0",
58
59
  "hast-util-to-jsx-runtime": "^2.3.6",
59
60
  "js-yaml": "^4.1.1",
60
61
  "lucide-react": "^1.7.0",
61
62
  "next-themes": "^0.4.6",
62
63
  "openapi-sampler": "^1.7.2",
63
- "react-hook-form": "^7.72.0",
64
+ "react-hook-form": "^7.72.1",
64
65
  "remark": "^15.0.1",
65
66
  "remark-rehype": "^11.1.2",
66
67
  "tailwind-merge": "^3.5.0",
67
68
  "xml-js": "^1.6.11",
68
- "@fumari/stf": "1.0.3"
69
+ "@fumari/stf": "1.0.4"
69
70
  },
70
71
  "devDependencies": {
71
- "@scalar/api-client-react": "^1.4.15",
72
+ "@scalar/api-client-react": "^1.4.20",
72
73
  "@types/js-yaml": "^4.0.9",
73
- "@types/node": "25.5.0",
74
+ "@types/node": "25.5.2",
74
75
  "@types/openapi-sampler": "^1.0.3",
75
76
  "@types/react": "^19.2.14",
76
77
  "json-schema-typed": "^8.0.2",
77
78
  "shiki": "^4.0.2",
78
79
  "tailwindcss": "^4.2.2",
79
- "tsdown": "0.21.6",
80
+ "tsdown": "0.21.7",
80
81
  "@fumadocs/tailwind": "0.0.3",
81
- "fumadocs-core": "16.7.10",
82
- "fumadocs-ui": "16.7.10",
82
+ "fumadocs-core": "16.7.11",
83
+ "fumadocs-ui": "16.7.11",
83
84
  "tsconfig": "0.0.0"
84
85
  },
85
86
  "peerDependencies": {