fumadocs-openapi 10.6.4 → 10.6.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.
Files changed (231) hide show
  1. package/css/generated/shared.css +34 -7
  2. package/dist/_openapi/types.d.ts +1 -2
  3. package/dist/generate-file.d.ts +1 -2
  4. package/dist/generate-file.js +3 -4
  5. package/dist/i18n.d.ts +2 -2
  6. package/dist/i18n.js +1 -2
  7. package/dist/playground/auth.js +92 -0
  8. package/dist/playground/client.d.ts +5 -10
  9. package/dist/playground/client.js +280 -199
  10. package/dist/playground/components/inputs.js +0 -2
  11. package/dist/playground/components/oauth-dialog.js +125 -164
  12. package/dist/playground/components/server-select.js +0 -2
  13. package/dist/playground/components/spinner.js +14 -0
  14. package/dist/playground/fetcher.d.ts +1 -2
  15. package/dist/playground/fetcher.js +0 -2
  16. package/dist/playground/schema.d.ts +1 -2
  17. package/dist/playground/schema.js +24 -15
  18. package/dist/playground/status-info.js +0 -2
  19. package/dist/requests/generators/all.d.ts +1 -2
  20. package/dist/requests/generators/all.js +0 -2
  21. package/dist/requests/generators/csharp.d.ts +1 -2
  22. package/dist/requests/generators/csharp.js +2 -3
  23. package/dist/requests/generators/curl.d.ts +1 -2
  24. package/dist/requests/generators/curl.js +5 -7
  25. package/dist/requests/generators/go.d.ts +1 -2
  26. package/dist/requests/generators/go.js +5 -7
  27. package/dist/requests/generators/index.d.ts +1 -2
  28. package/dist/requests/generators/index.js +0 -2
  29. package/dist/requests/generators/java.d.ts +1 -2
  30. package/dist/requests/generators/java.js +4 -6
  31. package/dist/requests/generators/javascript.d.ts +1 -2
  32. package/dist/requests/generators/javascript.js +3 -5
  33. package/dist/requests/generators/python.d.ts +1 -2
  34. package/dist/requests/generators/python.js +5 -6
  35. package/dist/requests/media/adapter.d.ts +1 -2
  36. package/dist/requests/media/adapter.js +7 -9
  37. package/dist/requests/media/encode.d.ts +1 -2
  38. package/dist/requests/media/encode.js +0 -2
  39. package/dist/requests/media/resolve-adapter.js +0 -2
  40. package/dist/requests/string-utils.js +25 -6
  41. package/dist/requests/types.d.ts +4 -4
  42. package/dist/scalar/client.js +0 -2
  43. package/dist/scalar/index.d.ts +1 -2
  44. package/dist/scalar/index.js +0 -2
  45. package/dist/server/create.d.ts +2 -3
  46. package/dist/server/create.js +0 -2
  47. package/dist/server/proxy.d.ts +1 -2
  48. package/dist/server/proxy.js +0 -2
  49. package/dist/server/source-api.d.ts +1 -2
  50. package/dist/server/source-api.js +0 -2
  51. package/dist/types.d.ts +1 -2
  52. package/dist/ui/api-page.d.ts +1 -2
  53. package/dist/ui/api-page.js +3 -3
  54. package/dist/ui/base.d.ts +9 -6
  55. package/dist/ui/base.js +8 -5
  56. package/dist/ui/client/boundary.d.ts +1 -2
  57. package/dist/ui/client/boundary.js +0 -2
  58. package/dist/ui/client/boundary.lazy.js +2 -3
  59. package/dist/ui/client/full.js +0 -2
  60. package/dist/ui/client/i18n.js +0 -2
  61. package/dist/ui/client/index.d.ts +1 -2
  62. package/dist/ui/client/index.js +0 -2
  63. package/dist/ui/client/storage-key.js +1 -3
  64. package/dist/ui/components/accordion.js +0 -2
  65. package/dist/ui/components/codeblock.d.ts +1 -2
  66. package/dist/ui/components/codeblock.js +0 -2
  67. package/dist/ui/components/dialog.js +0 -2
  68. package/dist/ui/components/input.js +0 -2
  69. package/dist/ui/components/method-label.js +0 -2
  70. package/dist/ui/components/select-tab.js +0 -2
  71. package/dist/ui/components/select.js +0 -2
  72. package/dist/ui/contexts/api.d.ts +7 -5
  73. package/dist/ui/contexts/api.js +7 -4
  74. package/dist/ui/create-client.d.ts +1 -2
  75. package/dist/ui/create-client.js +6 -3
  76. package/dist/ui/index.d.ts +1 -2
  77. package/dist/ui/index.js +0 -2
  78. package/dist/ui/operation/client.js +0 -2
  79. package/dist/ui/operation/get-example-requests.d.ts +1 -2
  80. package/dist/ui/operation/get-example-requests.js +0 -2
  81. package/dist/ui/operation/index.js +0 -2
  82. package/dist/ui/operation/request-tabs.d.ts +10 -0
  83. package/dist/ui/operation/request-tabs.js +43 -39
  84. package/dist/ui/operation/response-tabs.d.ts +1 -2
  85. package/dist/ui/operation/response-tabs.js +0 -2
  86. package/dist/ui/operation/usage-tabs/client.d.ts +1 -2
  87. package/dist/ui/operation/usage-tabs/client.js +0 -2
  88. package/dist/ui/operation/usage-tabs/index.js +0 -2
  89. package/dist/ui/schema/client.d.ts +1 -2
  90. package/dist/ui/schema/client.js +0 -2
  91. package/dist/ui/schema/index.d.ts +3 -4
  92. package/dist/ui/schema/index.js +1 -3
  93. package/dist/utils/deep-equal.js +0 -2
  94. package/dist/utils/document/dereference.d.ts +1 -2
  95. package/dist/utils/document/dereference.js +0 -2
  96. package/dist/utils/document/process.d.ts +1 -2
  97. package/dist/utils/document/process.js +0 -2
  98. package/dist/utils/id-to-title.js +0 -2
  99. package/dist/utils/is-plain-object.js +0 -2
  100. package/dist/utils/pages/builder.d.ts +1 -2
  101. package/dist/utils/pages/builder.js +0 -2
  102. package/dist/utils/pages/preset-auto.d.ts +1 -2
  103. package/dist/utils/pages/preset-auto.js +0 -2
  104. package/dist/utils/pages/to-static-data.js +0 -2
  105. package/dist/utils/pages/to-text.d.ts +1 -2
  106. package/dist/utils/pages/to-text.js +5 -6
  107. package/dist/utils/remove-undefined.js +0 -2
  108. package/dist/utils/schema/dereference.js +22 -14
  109. package/dist/utils/schema/index.d.ts +4 -10
  110. package/dist/utils/schema/index.js +4 -11
  111. package/dist/utils/{merge-schema.js → schema/merge.js} +2 -4
  112. package/dist/utils/schema/pick.js +0 -2
  113. package/dist/utils/schema/ref.js +0 -2
  114. package/dist/utils/schema/resolve-ref.js +0 -2
  115. package/dist/utils/schema/to-string.js +4 -7
  116. package/dist/utils/url.js +0 -2
  117. package/dist/utils/use-query.js +2 -3
  118. package/package.json +2 -2
  119. package/dist/_openapi/types.d.ts.map +0 -1
  120. package/dist/generate-file.d.ts.map +0 -1
  121. package/dist/generate-file.js.map +0 -1
  122. package/dist/i18n.d.ts.map +0 -1
  123. package/dist/i18n.js.map +0 -1
  124. package/dist/playground/client.d.ts.map +0 -1
  125. package/dist/playground/client.js.map +0 -1
  126. package/dist/playground/components/inputs.js.map +0 -1
  127. package/dist/playground/components/oauth-dialog.js.map +0 -1
  128. package/dist/playground/components/server-select.js.map +0 -1
  129. package/dist/playground/fetcher.d.ts.map +0 -1
  130. package/dist/playground/fetcher.js.map +0 -1
  131. package/dist/playground/schema.d.ts.map +0 -1
  132. package/dist/playground/schema.js.map +0 -1
  133. package/dist/playground/status-info.js.map +0 -1
  134. package/dist/requests/generators/all.d.ts.map +0 -1
  135. package/dist/requests/generators/all.js.map +0 -1
  136. package/dist/requests/generators/csharp.d.ts.map +0 -1
  137. package/dist/requests/generators/csharp.js.map +0 -1
  138. package/dist/requests/generators/curl.d.ts.map +0 -1
  139. package/dist/requests/generators/curl.js.map +0 -1
  140. package/dist/requests/generators/go.d.ts.map +0 -1
  141. package/dist/requests/generators/go.js.map +0 -1
  142. package/dist/requests/generators/index.d.ts.map +0 -1
  143. package/dist/requests/generators/index.js.map +0 -1
  144. package/dist/requests/generators/java.d.ts.map +0 -1
  145. package/dist/requests/generators/java.js.map +0 -1
  146. package/dist/requests/generators/javascript.d.ts.map +0 -1
  147. package/dist/requests/generators/javascript.js.map +0 -1
  148. package/dist/requests/generators/python.d.ts.map +0 -1
  149. package/dist/requests/generators/python.js.map +0 -1
  150. package/dist/requests/media/adapter.d.ts.map +0 -1
  151. package/dist/requests/media/adapter.js.map +0 -1
  152. package/dist/requests/media/encode.d.ts.map +0 -1
  153. package/dist/requests/media/encode.js.map +0 -1
  154. package/dist/requests/media/resolve-adapter.js.map +0 -1
  155. package/dist/requests/string-utils.js.map +0 -1
  156. package/dist/requests/types.d.ts.map +0 -1
  157. package/dist/scalar/client.js.map +0 -1
  158. package/dist/scalar/index.d.ts.map +0 -1
  159. package/dist/scalar/index.js.map +0 -1
  160. package/dist/server/create.d.ts.map +0 -1
  161. package/dist/server/create.js.map +0 -1
  162. package/dist/server/proxy.d.ts.map +0 -1
  163. package/dist/server/proxy.js.map +0 -1
  164. package/dist/server/source-api.d.ts.map +0 -1
  165. package/dist/server/source-api.js.map +0 -1
  166. package/dist/types.d.ts.map +0 -1
  167. package/dist/ui/api-page.d.ts.map +0 -1
  168. package/dist/ui/api-page.js.map +0 -1
  169. package/dist/ui/base.d.ts.map +0 -1
  170. package/dist/ui/base.js.map +0 -1
  171. package/dist/ui/client/boundary.d.ts.map +0 -1
  172. package/dist/ui/client/boundary.js.map +0 -1
  173. package/dist/ui/client/boundary.lazy.js.map +0 -1
  174. package/dist/ui/client/full.js.map +0 -1
  175. package/dist/ui/client/i18n.js.map +0 -1
  176. package/dist/ui/client/index.d.ts.map +0 -1
  177. package/dist/ui/client/index.js.map +0 -1
  178. package/dist/ui/client/storage-key.js.map +0 -1
  179. package/dist/ui/components/accordion.js.map +0 -1
  180. package/dist/ui/components/codeblock.d.ts.map +0 -1
  181. package/dist/ui/components/codeblock.js.map +0 -1
  182. package/dist/ui/components/dialog.js.map +0 -1
  183. package/dist/ui/components/input.js.map +0 -1
  184. package/dist/ui/components/method-label.js.map +0 -1
  185. package/dist/ui/components/select-tab.js.map +0 -1
  186. package/dist/ui/components/select.js.map +0 -1
  187. package/dist/ui/contexts/api.d.ts.map +0 -1
  188. package/dist/ui/contexts/api.js.map +0 -1
  189. package/dist/ui/create-client.d.ts.map +0 -1
  190. package/dist/ui/create-client.js.map +0 -1
  191. package/dist/ui/index.d.ts.map +0 -1
  192. package/dist/ui/index.js.map +0 -1
  193. package/dist/ui/operation/client.js.map +0 -1
  194. package/dist/ui/operation/get-example-requests.d.ts.map +0 -1
  195. package/dist/ui/operation/get-example-requests.js.map +0 -1
  196. package/dist/ui/operation/index.js.map +0 -1
  197. package/dist/ui/operation/request-tabs.js.map +0 -1
  198. package/dist/ui/operation/response-tabs.d.ts.map +0 -1
  199. package/dist/ui/operation/response-tabs.js.map +0 -1
  200. package/dist/ui/operation/usage-tabs/client.d.ts.map +0 -1
  201. package/dist/ui/operation/usage-tabs/client.js.map +0 -1
  202. package/dist/ui/operation/usage-tabs/index.js.map +0 -1
  203. package/dist/ui/schema/client.d.ts.map +0 -1
  204. package/dist/ui/schema/client.js.map +0 -1
  205. package/dist/ui/schema/index.d.ts.map +0 -1
  206. package/dist/ui/schema/index.js.map +0 -1
  207. package/dist/utils/deep-equal.js.map +0 -1
  208. package/dist/utils/document/dereference.d.ts.map +0 -1
  209. package/dist/utils/document/dereference.js.map +0 -1
  210. package/dist/utils/document/process.d.ts.map +0 -1
  211. package/dist/utils/document/process.js.map +0 -1
  212. package/dist/utils/id-to-title.js.map +0 -1
  213. package/dist/utils/is-plain-object.js.map +0 -1
  214. package/dist/utils/merge-schema.js.map +0 -1
  215. package/dist/utils/pages/builder.d.ts.map +0 -1
  216. package/dist/utils/pages/builder.js.map +0 -1
  217. package/dist/utils/pages/preset-auto.d.ts.map +0 -1
  218. package/dist/utils/pages/preset-auto.js.map +0 -1
  219. package/dist/utils/pages/to-static-data.js.map +0 -1
  220. package/dist/utils/pages/to-text.d.ts.map +0 -1
  221. package/dist/utils/pages/to-text.js.map +0 -1
  222. package/dist/utils/remove-undefined.js.map +0 -1
  223. package/dist/utils/schema/dereference.js.map +0 -1
  224. package/dist/utils/schema/index.d.ts.map +0 -1
  225. package/dist/utils/schema/index.js.map +0 -1
  226. package/dist/utils/schema/pick.js.map +0 -1
  227. package/dist/utils/schema/ref.js.map +0 -1
  228. package/dist/utils/schema/resolve-ref.js.map +0 -1
  229. package/dist/utils/schema/to-string.js.map +0 -1
  230. package/dist/utils/url.js.map +0 -1
  231. package/dist/utils/use-query.js.map +0 -1
@@ -18,7 +18,7 @@ function useServerContext() {
18
18
  if (!ctx) throw new Error("Component must be used under <ApiProvider />");
19
19
  return ctx;
20
20
  }
21
- function ApiProvider({ children, shikiOptions, client }) {
21
+ function ApiProvider({ children, shikiOptions, client, schemes }) {
22
22
  return /* @__PURE__ */ jsx(ApiContext, {
23
23
  value: useMemo(() => {
24
24
  let codeUsages;
@@ -31,12 +31,17 @@ function ApiProvider({ children, shikiOptions, client }) {
31
31
  shikiOptions,
32
32
  client,
33
33
  codeUsages,
34
+ schemes,
34
35
  mediaAdapters: {
35
36
  ...defaultAdapters,
36
37
  ...client.mediaAdapters
37
38
  }
38
39
  };
39
- }, [client, shikiOptions]),
40
+ }, [
41
+ client,
42
+ schemes,
43
+ shikiOptions
44
+ ]),
40
45
  children
41
46
  });
42
47
  }
@@ -101,5 +106,3 @@ function getDefaultValues(server) {
101
106
  }
102
107
  //#endregion
103
108
  export { ApiProvider, ServerProvider, useApiContext, useServerContext };
104
-
105
- //# sourceMappingURL=api.js.map
@@ -22,5 +22,4 @@ declare function createClientAPIPage({
22
22
  ...options
23
23
  }?: CreateClientAPIPageOptions): FC<ClientApiPageProps>;
24
24
  //#endregion
25
- export { ClientApiPagePayload, ClientApiPageProps, CreateClientAPIPageOptions, createClientAPIPage };
26
- //# sourceMappingURL=create-client.d.ts.map
25
+ export { ClientApiPagePayload, ClientApiPageProps, CreateClientAPIPageOptions, createClientAPIPage };
@@ -1,6 +1,7 @@
1
1
  import { parseSecurities } from "../utils/schema/index.js";
2
2
  import { defaultAdapters } from "../requests/media/adapter.js";
3
3
  import { ClientCodeBlock, ClientCodeBlockProvider } from "./components/codeblock.js";
4
+ import { AuthProvider } from "../playground/auth.js";
4
5
  import { dereferenceDocument } from "../utils/document/dereference.js";
5
6
  import { APIPage } from "./api-page.js";
6
7
  import { boundary_exports } from "./client/boundary.js";
@@ -60,12 +61,15 @@ function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { the
60
61
  route: path,
61
62
  securities: parseSecurities(method, ctx.schema.dereferenced),
62
63
  method: method.method,
63
- doc: { processed: ctx.schema },
64
+ doc: ctx.schema.bundled,
64
65
  proxyUrl: ctx.proxyUrl,
65
66
  writeOnly: true,
66
67
  readOnly: false
67
68
  });
68
69
  }
70
+ function renderPlaygroundProviderDefault({ children }) {
71
+ return /* @__PURE__ */ jsx(AuthProvider, { children });
72
+ }
69
73
  return function ClientAPIPage({ payload, ...props }) {
70
74
  const processed = useMemo(() => dereferenceDocument(payload.bundled), [payload.bundled]);
71
75
  const ctx = useMemo(() => ({
@@ -82,6 +86,7 @@ function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { the
82
86
  },
83
87
  playground: {
84
88
  ...options.playground,
89
+ provider: options.playground?.provider ?? renderPlaygroundProviderDefault,
85
90
  render: options.playground?.render ?? renderPlaygroundDefault
86
91
  },
87
92
  renderHeading(depth, text, props) {
@@ -135,5 +140,3 @@ function MarkdownPre(props) {
135
140
  }
136
141
  //#endregion
137
142
  export { createClientAPIPage };
138
-
139
- //# sourceMappingURL=create-client.js.map
@@ -7,5 +7,4 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
7
  type CreateAPIPageOptions = Partial<CreateAPIPageOptions$1>;
8
8
  declare function createAPIPage(server: OpenAPIServer, options?: CreateAPIPageOptions): (props: ServerApiPageProps) => _$react_jsx_runtime0.JSX.Element;
9
9
  //#endregion
10
- export { type ApiPageProps, CreateAPIPageOptions, type OperationItem, type WebhookItem, createAPIPage };
11
- //# sourceMappingURL=index.d.ts.map
10
+ export { type ApiPageProps, CreateAPIPageOptions, type OperationItem, type WebhookItem, createAPIPage };
package/dist/ui/index.js CHANGED
@@ -18,5 +18,3 @@ function createAPIPage(server, options = {}) {
18
18
  }
19
19
  //#endregion
20
20
  export { createAPIPage };
21
-
22
- //# sourceMappingURL=index.js.map
@@ -76,5 +76,3 @@ function CopyTypeScriptPanel({ name, code, className }) {
76
76
  }
77
77
  //#endregion
78
78
  export { CopyTypeScriptPanel, OperationProvider, useOperationContext };
79
-
80
- //# sourceMappingURL=client.js.map
@@ -8,5 +8,4 @@ interface ExampleRequestItem {
8
8
  encoded: RequestData;
9
9
  }
10
10
  //#endregion
11
- export { ExampleRequestItem };
12
- //# sourceMappingURL=get-example-requests.d.ts.map
11
+ export { ExampleRequestItem };
@@ -79,5 +79,3 @@ function getRequestData(path, method, sampleKey, _ctx) {
79
79
  }
80
80
  //#endregion
81
81
  export { getExampleRequests };
82
-
83
- //# sourceMappingURL=get-example-requests.js.map
@@ -499,5 +499,3 @@ function AuthProperty({ name, type, deprecated = false, scopes = [], className,
499
499
  }
500
500
  //#endregion
501
501
  export { Operation };
502
-
503
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import { MethodInformation, RenderContext } from "../../types.js";
2
+ import { NoReference } from "../../utils/schema/index.js";
3
+ import { ReactNode } from "react";
4
+ //#region src/ui/operation/request-tabs.d.ts
5
+ interface RequestTabsRenderContext extends RenderContext {
6
+ route: string;
7
+ operation: NoReference<MethodInformation>;
8
+ }
9
+ //#endregion
10
+ export { RequestTabsRenderContext };
@@ -15,41 +15,6 @@ function RequestTabs({ path, operation, examples, ctx }) {
15
15
  });
16
16
  }
17
17
  function renderRequestTabsDefault(items, ctx) {
18
- function renderItem(item) {
19
- const requestData = item.data;
20
- const displayNames = {
21
- body: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(I18nLabel, { label: "titleRequestBody" }), /* @__PURE__ */ jsx("code", {
22
- className: "text-xs text-fd-muted-foreground ms-auto",
23
- children: requestData.bodyMediaType
24
- })] }),
25
- cookie: /* @__PURE__ */ jsx(I18nLabel, { label: "cookieParameters" }),
26
- header: /* @__PURE__ */ jsx(I18nLabel, { label: "headerParameters" }),
27
- query: /* @__PURE__ */ jsx(I18nLabel, { label: "queryParameters" }),
28
- path: /* @__PURE__ */ jsx(I18nLabel, { label: "pathParameters" })
29
- };
30
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31
- item.description && ctx.renderMarkdown(item.description),
32
- /* @__PURE__ */ jsxs("div", {
33
- className: "flex flex-row gap-2 items-center justify-between",
34
- children: [/* @__PURE__ */ jsx(MethodLabel, { children: requestData.method }), /* @__PURE__ */ jsx("code", { children: resolveRequestData(ctx.route, item.encoded) })]
35
- }),
36
- /* @__PURE__ */ jsx(Accordions, {
37
- type: "multiple",
38
- className: "mt-2",
39
- children: Object.entries(displayNames).map(([k, v]) => {
40
- const data = requestData[k];
41
- if (!data || Object.keys(data).length === 0) return;
42
- return /* @__PURE__ */ jsxs(AccordionItem, {
43
- value: k,
44
- children: [/* @__PURE__ */ jsx(AccordionHeader, { children: /* @__PURE__ */ jsx(AccordionTrigger, { children: v }) }), /* @__PURE__ */ jsx(AccordionContent, {
45
- className: "prose-no-margin",
46
- children: ctx.renderCodeBlock("json", JSON.stringify(data, null, 2))
47
- })]
48
- }, k);
49
- })
50
- })
51
- ] });
52
- }
53
18
  let children;
54
19
  if (items.length > 1) children = /* @__PURE__ */ jsxs(Tabs, {
55
20
  defaultValue: items[0].id,
@@ -58,10 +23,16 @@ function renderRequestTabsDefault(items, ctx) {
58
23
  children: item.id === "_default" ? /* @__PURE__ */ jsx(I18nLabel, { label: "requestTabNameDefault" }) : item.name
59
24
  }, item.id)) }), items.map((item) => /* @__PURE__ */ jsx(TabsContent, {
60
25
  value: item.id,
61
- children: renderItem(item)
26
+ children: /* @__PURE__ */ jsx(RequestTabsItem, {
27
+ item,
28
+ ctx
29
+ })
62
30
  }, item.id))]
63
31
  });
64
- else if (items.length === 1) children = renderItem(items[0]);
32
+ else if (items.length === 1) children = /* @__PURE__ */ jsx(RequestTabsItem, {
33
+ item: items[0],
34
+ ctx
35
+ });
65
36
  else children = /* @__PURE__ */ jsx("p", {
66
37
  className: "text-fd-muted-foreground text-xs",
67
38
  children: /* @__PURE__ */ jsx(I18nLabel, { label: "empty" })
@@ -74,7 +45,40 @@ function renderRequestTabsDefault(items, ctx) {
74
45
  }), children]
75
46
  });
76
47
  }
48
+ function RequestTabsItem({ item, ctx }) {
49
+ const requestData = item.data;
50
+ const displayNames = {
51
+ body: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(I18nLabel, { label: "titleRequestBody" }), /* @__PURE__ */ jsx("code", {
52
+ className: "text-xs text-fd-muted-foreground ms-auto",
53
+ children: requestData.bodyMediaType
54
+ })] }),
55
+ cookie: /* @__PURE__ */ jsx(I18nLabel, { label: "cookieParameters" }),
56
+ header: /* @__PURE__ */ jsx(I18nLabel, { label: "headerParameters" }),
57
+ query: /* @__PURE__ */ jsx(I18nLabel, { label: "queryParameters" }),
58
+ path: /* @__PURE__ */ jsx(I18nLabel, { label: "pathParameters" })
59
+ };
60
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ item.description && ctx.renderMarkdown(item.description),
62
+ /* @__PURE__ */ jsxs("div", {
63
+ className: "flex flex-row gap-2 items-center justify-between",
64
+ children: [/* @__PURE__ */ jsx(MethodLabel, { children: requestData.method }), /* @__PURE__ */ jsx("code", { children: resolveRequestData(ctx.route, item.encoded) })]
65
+ }),
66
+ /* @__PURE__ */ jsx(Accordions, {
67
+ type: "multiple",
68
+ className: "mt-2",
69
+ children: Object.entries(displayNames).map(([k, v]) => {
70
+ const data = requestData[k];
71
+ if (!data || Object.keys(data).length === 0) return;
72
+ return /* @__PURE__ */ jsxs(AccordionItem, {
73
+ value: k,
74
+ children: [/* @__PURE__ */ jsx(AccordionHeader, { children: /* @__PURE__ */ jsx(AccordionTrigger, { children: v }) }), /* @__PURE__ */ jsx(AccordionContent, {
75
+ className: "prose-no-margin",
76
+ children: ctx.renderCodeBlock("json", JSON.stringify(data, null, 2))
77
+ })]
78
+ }, k);
79
+ })
80
+ })
81
+ ] });
82
+ }
77
83
  //#endregion
78
84
  export { RequestTabs };
79
-
80
- //# sourceMappingURL=request-tabs.js.map
@@ -27,5 +27,4 @@ interface ResponseExample {
27
27
  description?: string;
28
28
  }
29
29
  //#endregion
30
- export { ResponseTab };
31
- //# sourceMappingURL=response-tabs.d.ts.map
30
+ export { ResponseTab };
@@ -75,5 +75,3 @@ function renderResponseTabsDefault(tabs, ctx) {
75
75
  }
76
76
  //#endregion
77
77
  export { ResponseTabs };
78
-
79
- //# sourceMappingURL=response-tabs.js.map
@@ -11,5 +11,4 @@ declare function UsageTab({
11
11
  id: string;
12
12
  }): _$react_jsx_runtime0.JSX.Element | null;
13
13
  //#endregion
14
- export { UsageTab, UsageTabsSelector };
15
- //# sourceMappingURL=client.d.ts.map
14
+ export { UsageTab, UsageTabsSelector };
@@ -86,5 +86,3 @@ function UsageTab({ id, lang, _client }) {
86
86
  }
87
87
  //#endregion
88
88
  export { UsageTab, UsageTabsSelector };
89
-
90
- //# sourceMappingURL=client.js.map
@@ -58,5 +58,3 @@ function UsageTabs({ method, ctx }) {
58
58
  }
59
59
  //#endregion
60
60
  export { UsageTabs };
61
-
62
- //# sourceMappingURL=index.js.map
@@ -15,5 +15,4 @@ declare function SchemaUI({
15
15
  generated
16
16
  }: SchemaUIProps): _$react_jsx_runtime0.JSX.Element;
17
17
  //#endregion
18
- export { SchemaUI, SchemaUIProps };
19
- //# sourceMappingURL=client.d.ts.map
18
+ export { SchemaUI, SchemaUIProps };
@@ -357,5 +357,3 @@ function isExpandable(data) {
357
357
  }
358
358
  //#endregion
359
359
  export { SchemaUI };
360
-
361
- //# sourceMappingURL=client.js.map
@@ -1,5 +1,5 @@
1
1
  import { SchemaUIProps } from "./client.js";
2
- import { ResolvedSchema } from "../../utils/schema/index.js";
2
+ import { ParsedSchema } from "../../utils/schema/index.js";
3
3
  import { ReactNode } from "react";
4
4
  //#region src/ui/schema/index.d.ts
5
5
  interface FieldBase {
@@ -42,7 +42,7 @@ type SchemaData = FieldBase & ({
42
42
  }[];
43
43
  });
44
44
  interface SchemaUIOptions {
45
- root: ResolvedSchema;
45
+ root: ParsedSchema;
46
46
  client: Omit<SchemaUIProps, 'generated'>;
47
47
  /**
48
48
  * include read only props
@@ -58,5 +58,4 @@ interface SchemaUIGeneratedData {
58
58
  refs: Record<string, SchemaData>;
59
59
  }
60
60
  //#endregion
61
- export { SchemaUIGeneratedData, SchemaUIOptions };
62
- //# sourceMappingURL=index.d.ts.map
61
+ export { SchemaUIGeneratedData, SchemaUIOptions };
@@ -1,4 +1,4 @@
1
- import { mergeAllOf } from "../../utils/merge-schema.js";
1
+ import { mergeAllOf } from "../../utils/schema/merge.js";
2
2
  import { FormatFlags, schemaToString } from "../../utils/schema/to-string.js";
3
3
  import { I18nLabel } from "../client/i18n.js";
4
4
  import { useMemo } from "react";
@@ -254,5 +254,3 @@ function formatRange(value, min, exclusiveMin, max, exclusiveMax) {
254
254
  }
255
255
  //#endregion
256
256
  export { Schema };
257
-
258
- //# sourceMappingURL=index.js.map
@@ -19,5 +19,3 @@ function deepEqual(a, b) {
19
19
  }
20
20
  //#endregion
21
21
  export { deepEqual };
22
-
23
- //# sourceMappingURL=deep-equal.js.map
@@ -14,5 +14,4 @@ interface DereferencedDocument {
14
14
  bundled: Document;
15
15
  }
16
16
  //#endregion
17
- export { DereferencedDocument };
18
- //# sourceMappingURL=dereference.d.ts.map
17
+ export { DereferencedDocument };
@@ -17,5 +17,3 @@ function dereferenceDocument(bundled) {
17
17
  }
18
18
  //#endregion
19
19
  export { dereferenceDocument };
20
-
21
- //# sourceMappingURL=dereference.js.map
@@ -3,5 +3,4 @@ import { DereferencedDocument } from "./dereference.js";
3
3
  //#region src/utils/document/process.d.ts
4
4
  type ProcessedDocument = DereferencedDocument;
5
5
  //#endregion
6
- export { ProcessedDocument };
7
- //# sourceMappingURL=process.d.ts.map
6
+ export { ProcessedDocument };
@@ -19,5 +19,3 @@ async function processDocument(input) {
19
19
  }
20
20
  //#endregion
21
21
  export { processDocument };
22
-
23
- //# sourceMappingURL=process.js.map
@@ -10,5 +10,3 @@ function idToTitle(id) {
10
10
  }
11
11
  //#endregion
12
12
  export { idToTitle };
13
-
14
- //# sourceMappingURL=id-to-title.js.map
@@ -6,5 +6,3 @@ function isPlainObject(value) {
6
6
  }
7
7
  //#endregion
8
8
  export { isPlainObject };
9
-
10
- //# sourceMappingURL=is-plain-object.js.map
@@ -85,5 +85,4 @@ interface ExtractedInfo {
85
85
  declare function fromServer(server: OpenAPIServer, config: PagesBuilderConfig): Promise<Record<string, OutputEntry[]>>;
86
86
  declare function fromSchema(schemaId: string, processed: DereferencedDocument, config: PagesBuilderConfig): OutputEntry[];
87
87
  //#endregion
88
- export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, fromServer };
89
- //# sourceMappingURL=builder.d.ts.map
88
+ export { OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput, fromSchema, fromServer };
@@ -99,5 +99,3 @@ function fromSchema(schemaId, processed, config) {
99
99
  }
100
100
  //#endregion
101
101
  export { fromSchema, fromServer };
102
-
103
- //# sourceMappingURL=builder.js.map
@@ -68,5 +68,4 @@ interface BaseConfig {
68
68
  }
69
69
  declare function createAutoPreset(options: SchemaToPagesOptions): PagesBuilderConfig;
70
70
  //#endregion
71
- export { SchemaToPagesOptions, createAutoPreset };
72
- //# sourceMappingURL=preset-auto.d.ts.map
71
+ export { SchemaToPagesOptions, createAutoPreset };
@@ -182,5 +182,3 @@ function createAutoPreset(options) {
182
182
  }
183
183
  //#endregion
184
184
  export { createAutoPreset };
185
-
186
- //# sourceMappingURL=preset-auto.js.map
@@ -44,5 +44,3 @@ function toStaticData(page, dereferenced) {
44
44
  }
45
45
  //#endregion
46
46
  export { toStaticData };
47
-
48
- //# sourceMappingURL=to-static-data.js.map
@@ -41,5 +41,4 @@ type DocumentContext = {
41
41
  type: 'file';
42
42
  };
43
43
  //#endregion
44
- export { PagesToTextOptions };
45
- //# sourceMappingURL=to-text.d.ts.map
44
+ export { PagesToTextOptions };
@@ -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,11 +80,9 @@ 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
87
88
  export { generateDocument, toText };
88
-
89
- //# sourceMappingURL=to-text.js.map
@@ -17,5 +17,3 @@ function removeUndefined(value, deep = false) {
17
17
  }
18
18
  //#endregion
19
19
  export { removeUndefined };
20
-
21
- //# sourceMappingURL=remove-undefined.js.map
@@ -1,3 +1,4 @@
1
+ import { isPlainObject } from "../is-plain-object.js";
1
2
  import { resolveRefSync } from "./resolve-ref.js";
2
3
  //#region src/utils/schema/dereference.ts
3
4
  /**
@@ -8,30 +9,37 @@ function dereferenceSync(schema, setOriginalRef) {
8
9
  const visitedNodes = /* @__PURE__ */ new Set();
9
10
  const cloned = structuredClone(schema);
10
11
  function resolve(current) {
11
- if (typeof current === "object" && current !== null) {
12
- if (visitedNodes.has(current)) return current;
13
- visitedNodes.add(current);
14
- if (Array.isArray(current)) {
15
- for (let index = 0; index < current.length; index++) current[index] = resolve(current[index]);
16
- return current;
17
- }
18
- const obj = current;
19
- if ("$ref" in current && typeof current["$ref"] === "string") {
12
+ if (visitedNodes.has(current)) return current;
13
+ visitedNodes.add(current);
14
+ if (Array.isArray(current)) for (let index = 0; index < current.length; index++) current[index] = resolve(current[index]);
15
+ else if (isPlainObject(current)) {
16
+ if (typeof current.$ref === "string") {
20
17
  const ref = current["$ref"];
21
18
  delete current["$ref"];
22
19
  const resolved = resolve(resolveRefSync(ref, cloned));
23
20
  setOriginalRef(resolved, ref);
24
21
  setOriginalRef(current, ref);
25
22
  if (typeof resolved === "boolean") throw new Error("invalid schema");
26
- for (const k in resolved) if (!(k in current)) obj[k] = resolved[k];
23
+ for (const k in resolved) if (!(k in current)) current[k] = resolved[k];
27
24
  }
28
- for (const key in current) obj[key] = resolve(obj[key]);
25
+ for (const key in current) current[key] = resolve(current[key]);
29
26
  }
30
27
  return current;
31
28
  }
32
29
  return resolve(cloned);
33
30
  }
31
+ function dereferenceSwallow(schema, full) {
32
+ if (isPlainObject(schema)) {
33
+ if (typeof schema.$ref !== "string") return schema;
34
+ const { $ref, ...rest } = schema;
35
+ const resolved = dereferenceSwallow(resolveRefSync($ref, full), full);
36
+ if (typeof resolved !== "object") throw new Error(`invalid schema referenced via "${$ref}"`);
37
+ return {
38
+ ...resolved,
39
+ ...rest
40
+ };
41
+ }
42
+ return schema;
43
+ }
34
44
  //#endregion
35
- export { dereferenceSync };
36
-
37
- //# sourceMappingURL=dereference.js.map
45
+ export { dereferenceSwallow, dereferenceSync };
@@ -1,20 +1,14 @@
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
5
5
  type NoReference<T> = T extends (infer I)[] ? NoReference<I>[] : T extends ReferenceObject ? Exclude<T, ReferenceObject> : T extends object ? { [K in keyof T]: NoReference<T[K]> } : T;
6
- type NoReferenceJSONSchema<T> = T extends (infer I)[] ? NoReference<I>[] : T extends {
7
- $ref?: string;
8
- } ? Omit<T, '$ref'> : T;
9
6
  type ParsedSchema = (JSONSchema & {
10
7
  'x-playground-lazy'?: boolean;
11
8
  }) | boolean;
12
- type ResolvedSchema = NoReferenceJSONSchema<ParsedSchema>;
13
- /** parsed security scheme objects */
14
- type SecurityEntry = SecuritySchemeObject & {
9
+ interface SecurityEntry {
15
10
  scopes: string[];
16
11
  id: string;
17
- };
12
+ }
18
13
  //#endregion
19
- export { NoReference, ParsedSchema, ResolvedSchema, SecurityEntry };
20
- //# sourceMappingURL=index.d.ts.map
14
+ export { NoReference, ParsedSchema, SecurityEntry };
@@ -51,20 +51,13 @@ 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;
66
61
  }
67
62
  //#endregion
68
63
  export { createMethod, getPreferredType, getTagDisplayName, methodKeys, parseSecurities, pickExample };
69
-
70
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { deepEqual } from "./deep-equal.js";
2
- //#region src/utils/merge-schema.ts
1
+ import { deepEqual } from "../deep-equal.js";
2
+ //#region src/utils/schema/merge.ts
3
3
  /**
4
4
  * Merge `allOf` object schema
5
5
  */
@@ -154,5 +154,3 @@ function intersectArray(a, b) {
154
154
  }
155
155
  //#endregion
156
156
  export { mergeAllOf };
157
-
158
- //# sourceMappingURL=merge-schema.js.map
@@ -42,5 +42,3 @@ function setField(obj, field, value) {
42
42
  }
43
43
  //#endregion
44
44
  export { pickSchema };
45
-
46
- //# sourceMappingURL=pick.js.map
@@ -33,5 +33,3 @@ function decodeInternalRef(ref) {
33
33
  }
34
34
  //#endregion
35
35
  export { decodeInternalRef, encodeInternalRef };
36
-
37
- //# sourceMappingURL=ref.js.map
@@ -9,5 +9,3 @@ function resolveRefSync(ref, schema) {
9
9
  }
10
10
  //#endregion
11
11
  export { resolveRefSync };
12
-
13
- //# sourceMappingURL=resolve-ref.js.map
@@ -23,15 +23,14 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
23
23
  const result = Array.from(members).join(sep);
24
24
  return nullable ? `${result} | null` : result;
25
25
  }
26
- function run(schema, flags) {
27
- const resolved = resolver(schema);
28
- schema = resolved.dereferenced;
26
+ function run(input, flags) {
27
+ const { dereferenced: schema, raw } = resolver(input);
29
28
  if (schema === true) return "any";
30
29
  else if (schema === false) return "never";
31
30
  if ((flags & FormatFlags.UseAlias) === FormatFlags.UseAlias) {
32
31
  if (schema.title) return schema.title;
33
- if (typeof resolved.raw === "object" && resolved.raw.$ref) {
34
- const ref = resolved.raw.$ref.split("/");
32
+ if (typeof raw === "object" && raw.$ref) {
33
+ const ref = raw.$ref.split("/");
35
34
  if (ref.length > 0) return ref[ref.length - 1];
36
35
  }
37
36
  }
@@ -54,5 +53,3 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
54
53
  }
55
54
  //#endregion
56
55
  export { FormatFlags, schemaToString };
57
-
58
- //# sourceMappingURL=to-string.js.map