fumadocs-openapi 10.6.3 → 10.6.5

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 (228) hide show
  1. package/css/generated/shared.css +8 -17
  2. package/dist/_openapi/types.d.ts +1 -2
  3. package/dist/generate-file.d.ts +3 -4
  4. package/dist/generate-file.js +0 -2
  5. package/dist/i18n.d.ts +1 -2
  6. package/dist/i18n.js +0 -2
  7. package/dist/playground/client.d.ts +12 -22
  8. package/dist/playground/client.js +37 -18
  9. package/dist/playground/components/inputs.js +0 -2
  10. package/dist/playground/components/oauth-dialog.js +0 -2
  11. package/dist/playground/components/server-select.js +0 -2
  12. package/dist/playground/fetcher.d.ts +1 -2
  13. package/dist/playground/fetcher.js +0 -2
  14. package/dist/playground/schema.d.ts +1 -2
  15. package/dist/playground/schema.js +25 -37
  16. package/dist/playground/status-info.js +0 -2
  17. package/dist/requests/generators/all.d.ts +1 -2
  18. package/dist/requests/generators/all.js +0 -2
  19. package/dist/requests/generators/csharp.d.ts +1 -2
  20. package/dist/requests/generators/csharp.js +0 -2
  21. package/dist/requests/generators/curl.d.ts +1 -2
  22. package/dist/requests/generators/curl.js +0 -2
  23. package/dist/requests/generators/go.d.ts +1 -2
  24. package/dist/requests/generators/go.js +0 -2
  25. package/dist/requests/generators/index.d.ts +1 -2
  26. package/dist/requests/generators/index.js +0 -2
  27. package/dist/requests/generators/java.d.ts +1 -2
  28. package/dist/requests/generators/java.js +0 -2
  29. package/dist/requests/generators/javascript.d.ts +1 -2
  30. package/dist/requests/generators/javascript.js +0 -2
  31. package/dist/requests/generators/python.d.ts +1 -2
  32. package/dist/requests/generators/python.js +0 -2
  33. package/dist/requests/media/adapter.d.ts +1 -2
  34. package/dist/requests/media/adapter.js +0 -2
  35. package/dist/requests/media/encode.d.ts +1 -2
  36. package/dist/requests/media/encode.js +0 -2
  37. package/dist/requests/media/resolve-adapter.js +0 -2
  38. package/dist/requests/string-utils.js +0 -2
  39. package/dist/requests/types.d.ts +1 -2
  40. package/dist/scalar/client.js +0 -2
  41. package/dist/scalar/index.d.ts +1 -2
  42. package/dist/scalar/index.js +0 -2
  43. package/dist/server/create.d.ts +2 -3
  44. package/dist/server/create.js +1 -3
  45. package/dist/server/proxy.d.ts +1 -2
  46. package/dist/server/proxy.js +0 -2
  47. package/dist/server/source-api.d.ts +3 -4
  48. package/dist/server/source-api.js +0 -2
  49. package/dist/types.d.ts +5 -6
  50. package/dist/ui/api-page.d.ts +1 -2
  51. package/dist/ui/api-page.js +0 -2
  52. package/dist/ui/base.d.ts +10 -10
  53. package/dist/ui/base.js +22 -2
  54. package/dist/ui/client/boundary.d.ts +1 -2
  55. package/dist/ui/client/boundary.js +0 -2
  56. package/dist/ui/client/boundary.lazy.js +0 -2
  57. package/dist/ui/client/full.js +0 -2
  58. package/dist/ui/client/i18n.js +0 -2
  59. package/dist/ui/client/index.d.ts +1 -2
  60. package/dist/ui/client/index.js +0 -2
  61. package/dist/ui/client/storage-key.js +0 -2
  62. package/dist/ui/components/accordion.js +0 -2
  63. package/dist/ui/components/codeblock.d.ts +1 -2
  64. package/dist/ui/components/codeblock.js +0 -2
  65. package/dist/ui/components/dialog.js +0 -2
  66. package/dist/ui/components/input.js +0 -2
  67. package/dist/ui/components/method-label.js +0 -2
  68. package/dist/ui/components/select-tab.js +0 -2
  69. package/dist/ui/components/select.js +0 -2
  70. package/dist/ui/contexts/api.d.ts +1 -2
  71. package/dist/ui/contexts/api.js +0 -2
  72. package/dist/ui/create-client.d.ts +1 -2
  73. package/dist/ui/create-client.js +18 -15
  74. package/dist/ui/index.d.ts +1 -2
  75. package/dist/ui/index.js +0 -2
  76. package/dist/ui/operation/client.js +0 -2
  77. package/dist/ui/operation/get-example-requests.d.ts +1 -2
  78. package/dist/ui/operation/get-example-requests.js +2 -4
  79. package/dist/ui/operation/index.js +5 -8
  80. package/dist/ui/operation/request-tabs.js +0 -2
  81. package/dist/ui/operation/response-tabs.d.ts +2 -3
  82. package/dist/ui/operation/response-tabs.js +0 -2
  83. package/dist/ui/operation/usage-tabs/client.d.ts +1 -2
  84. package/dist/ui/operation/usage-tabs/client.js +0 -2
  85. package/dist/ui/operation/usage-tabs/index.js +0 -2
  86. package/dist/ui/schema/client.d.ts +1 -2
  87. package/dist/ui/schema/client.js +0 -2
  88. package/dist/ui/schema/index.d.ts +3 -4
  89. package/dist/ui/schema/index.js +1 -3
  90. package/dist/utils/deep-equal.js +8 -6
  91. package/dist/utils/document/dereference.d.ts +17 -0
  92. package/dist/utils/document/dereference.js +19 -0
  93. package/dist/utils/document/process.d.ts +6 -0
  94. package/dist/utils/{process-document.js → document/process.js} +4 -19
  95. package/dist/utils/id-to-title.js +0 -2
  96. package/dist/utils/is-plain-object.js +8 -0
  97. package/dist/utils/pages/builder.d.ts +5 -6
  98. package/dist/utils/pages/builder.js +0 -2
  99. package/dist/utils/pages/preset-auto.d.ts +3 -4
  100. package/dist/utils/pages/preset-auto.js +0 -2
  101. package/dist/utils/pages/to-static-data.js +0 -2
  102. package/dist/utils/pages/to-text.d.ts +1 -2
  103. package/dist/utils/pages/to-text.js +0 -2
  104. package/dist/utils/remove-undefined.js +10 -10
  105. package/dist/utils/schema/dereference.js +22 -14
  106. package/dist/utils/schema/index.d.ts +7 -7
  107. package/dist/utils/schema/index.js +21 -4
  108. package/dist/utils/{merge-schema.js → schema/merge.js} +2 -4
  109. package/dist/utils/schema/pick.js +44 -0
  110. package/dist/utils/schema/ref.js +35 -0
  111. package/dist/utils/schema/resolve-ref.js +4 -14
  112. package/dist/utils/schema/to-string.js +4 -7
  113. package/dist/utils/url.js +0 -2
  114. package/dist/utils/use-query.js +0 -2
  115. package/package.json +3 -4
  116. package/dist/_openapi/types.d.ts.map +0 -1
  117. package/dist/generate-file.d.ts.map +0 -1
  118. package/dist/generate-file.js.map +0 -1
  119. package/dist/i18n.d.ts.map +0 -1
  120. package/dist/i18n.js.map +0 -1
  121. package/dist/playground/client.d.ts.map +0 -1
  122. package/dist/playground/client.js.map +0 -1
  123. package/dist/playground/components/inputs.js.map +0 -1
  124. package/dist/playground/components/oauth-dialog.js.map +0 -1
  125. package/dist/playground/components/server-select.js.map +0 -1
  126. package/dist/playground/fetcher.d.ts.map +0 -1
  127. package/dist/playground/fetcher.js.map +0 -1
  128. package/dist/playground/index.d.ts +0 -22
  129. package/dist/playground/index.d.ts.map +0 -1
  130. package/dist/playground/index.js +0 -118
  131. package/dist/playground/index.js.map +0 -1
  132. package/dist/playground/schema.d.ts.map +0 -1
  133. package/dist/playground/schema.js.map +0 -1
  134. package/dist/playground/status-info.js.map +0 -1
  135. package/dist/requests/generators/all.d.ts.map +0 -1
  136. package/dist/requests/generators/all.js.map +0 -1
  137. package/dist/requests/generators/csharp.d.ts.map +0 -1
  138. package/dist/requests/generators/csharp.js.map +0 -1
  139. package/dist/requests/generators/curl.d.ts.map +0 -1
  140. package/dist/requests/generators/curl.js.map +0 -1
  141. package/dist/requests/generators/go.d.ts.map +0 -1
  142. package/dist/requests/generators/go.js.map +0 -1
  143. package/dist/requests/generators/index.d.ts.map +0 -1
  144. package/dist/requests/generators/index.js.map +0 -1
  145. package/dist/requests/generators/java.d.ts.map +0 -1
  146. package/dist/requests/generators/java.js.map +0 -1
  147. package/dist/requests/generators/javascript.d.ts.map +0 -1
  148. package/dist/requests/generators/javascript.js.map +0 -1
  149. package/dist/requests/generators/python.d.ts.map +0 -1
  150. package/dist/requests/generators/python.js.map +0 -1
  151. package/dist/requests/media/adapter.d.ts.map +0 -1
  152. package/dist/requests/media/adapter.js.map +0 -1
  153. package/dist/requests/media/encode.d.ts.map +0 -1
  154. package/dist/requests/media/encode.js.map +0 -1
  155. package/dist/requests/media/resolve-adapter.js.map +0 -1
  156. package/dist/requests/string-utils.js.map +0 -1
  157. package/dist/requests/types.d.ts.map +0 -1
  158. package/dist/scalar/client.js.map +0 -1
  159. package/dist/scalar/index.d.ts.map +0 -1
  160. package/dist/scalar/index.js.map +0 -1
  161. package/dist/server/create.d.ts.map +0 -1
  162. package/dist/server/create.js.map +0 -1
  163. package/dist/server/proxy.d.ts.map +0 -1
  164. package/dist/server/proxy.js.map +0 -1
  165. package/dist/server/source-api.d.ts.map +0 -1
  166. package/dist/server/source-api.js.map +0 -1
  167. package/dist/types.d.ts.map +0 -1
  168. package/dist/ui/api-page.d.ts.map +0 -1
  169. package/dist/ui/api-page.js.map +0 -1
  170. package/dist/ui/base.d.ts.map +0 -1
  171. package/dist/ui/base.js.map +0 -1
  172. package/dist/ui/client/boundary.d.ts.map +0 -1
  173. package/dist/ui/client/boundary.js.map +0 -1
  174. package/dist/ui/client/boundary.lazy.js.map +0 -1
  175. package/dist/ui/client/full.js.map +0 -1
  176. package/dist/ui/client/i18n.js.map +0 -1
  177. package/dist/ui/client/index.d.ts.map +0 -1
  178. package/dist/ui/client/index.js.map +0 -1
  179. package/dist/ui/client/storage-key.js.map +0 -1
  180. package/dist/ui/components/accordion.js.map +0 -1
  181. package/dist/ui/components/codeblock.d.ts.map +0 -1
  182. package/dist/ui/components/codeblock.js.map +0 -1
  183. package/dist/ui/components/dialog.js.map +0 -1
  184. package/dist/ui/components/input.js.map +0 -1
  185. package/dist/ui/components/method-label.js.map +0 -1
  186. package/dist/ui/components/select-tab.js.map +0 -1
  187. package/dist/ui/components/select.js.map +0 -1
  188. package/dist/ui/contexts/api.d.ts.map +0 -1
  189. package/dist/ui/contexts/api.js.map +0 -1
  190. package/dist/ui/create-client.d.ts.map +0 -1
  191. package/dist/ui/create-client.js.map +0 -1
  192. package/dist/ui/index.d.ts.map +0 -1
  193. package/dist/ui/index.js.map +0 -1
  194. package/dist/ui/operation/client.js.map +0 -1
  195. package/dist/ui/operation/get-example-requests.d.ts.map +0 -1
  196. package/dist/ui/operation/get-example-requests.js.map +0 -1
  197. package/dist/ui/operation/index.js.map +0 -1
  198. package/dist/ui/operation/request-tabs.js.map +0 -1
  199. package/dist/ui/operation/response-tabs.d.ts.map +0 -1
  200. package/dist/ui/operation/response-tabs.js.map +0 -1
  201. package/dist/ui/operation/usage-tabs/client.d.ts.map +0 -1
  202. package/dist/ui/operation/usage-tabs/client.js.map +0 -1
  203. package/dist/ui/operation/usage-tabs/index.js.map +0 -1
  204. package/dist/ui/schema/client.d.ts.map +0 -1
  205. package/dist/ui/schema/client.js.map +0 -1
  206. package/dist/ui/schema/index.d.ts.map +0 -1
  207. package/dist/ui/schema/index.js.map +0 -1
  208. package/dist/utils/deep-equal.js.map +0 -1
  209. package/dist/utils/id-to-title.js.map +0 -1
  210. package/dist/utils/merge-schema.js.map +0 -1
  211. package/dist/utils/pages/builder.d.ts.map +0 -1
  212. package/dist/utils/pages/builder.js.map +0 -1
  213. package/dist/utils/pages/preset-auto.d.ts.map +0 -1
  214. package/dist/utils/pages/preset-auto.js.map +0 -1
  215. package/dist/utils/pages/to-static-data.js.map +0 -1
  216. package/dist/utils/pages/to-text.d.ts.map +0 -1
  217. package/dist/utils/pages/to-text.js.map +0 -1
  218. package/dist/utils/process-document.d.ts +0 -18
  219. package/dist/utils/process-document.d.ts.map +0 -1
  220. package/dist/utils/process-document.js.map +0 -1
  221. package/dist/utils/remove-undefined.js.map +0 -1
  222. package/dist/utils/schema/dereference.js.map +0 -1
  223. package/dist/utils/schema/index.d.ts.map +0 -1
  224. package/dist/utils/schema/index.js.map +0 -1
  225. package/dist/utils/schema/resolve-ref.js.map +0 -1
  226. package/dist/utils/schema/to-string.js.map +0 -1
  227. package/dist/utils/url.js.map +0 -1
  228. package/dist/utils/use-query.js.map +0 -1
@@ -3,5 +3,4 @@ import { CodeUsageGenerator } from "./index.js";
3
3
  //#region src/requests/generators/javascript.d.ts
4
4
  declare const javascript: CodeUsageGenerator;
5
5
  //#endregion
6
- export { javascript };
7
- //# sourceMappingURL=javascript.d.ts.map
6
+ export { javascript };
@@ -37,5 +37,3 @@ const javascript = {
37
37
  };
38
38
  //#endregion
39
39
  export { javascript };
40
-
41
- //# sourceMappingURL=javascript.js.map
@@ -4,5 +4,4 @@ import { CodeUsageGenerator } from "./index.js";
4
4
  declare const python: CodeUsageGenerator;
5
5
  declare function generatePythonObject(v: unknown, imports: Set<string>): string;
6
6
  //#endregion
7
- export { generatePythonObject, python };
8
- //# sourceMappingURL=python.d.ts.map
7
+ export { generatePythonObject, python };
@@ -47,5 +47,3 @@ function generatePythonObject(v, imports) {
47
47
  }
48
48
  //#endregion
49
49
  export { generatePythonObject, python };
50
-
51
- //# sourceMappingURL=python.js.map
@@ -47,5 +47,4 @@ interface MediaAdapter {
47
47
  }, ctx: MediaContext) => string | undefined;
48
48
  }
49
49
  //#endregion
50
- export { MediaAdapter };
51
- //# sourceMappingURL=adapter.d.ts.map
50
+ export { MediaAdapter };
@@ -120,5 +120,3 @@ function str(init, mediaType, ctx) {
120
120
  }
121
121
  //#endregion
122
122
  export { defaultAdapters };
123
-
124
- //# sourceMappingURL=adapter.js.map
@@ -6,5 +6,4 @@ interface EncodedParameterMultiple {
6
6
  readonly values: string[];
7
7
  }
8
8
  //#endregion
9
- export { EncodedParameter, EncodedParameterMultiple };
10
- //# sourceMappingURL=encode.d.ts.map
9
+ export { EncodedParameter, EncodedParameterMultiple };
@@ -128,5 +128,3 @@ function serializeCookieParameter(field, value, output) {
128
128
  }
129
129
  //#endregion
130
130
  export { encodeRequestData };
131
-
132
- //# sourceMappingURL=encode.js.map
@@ -33,5 +33,3 @@ function isMediaTypeSupported(mediaType, adapters) {
33
33
  }
34
34
  //#endregion
35
35
  export { isMediaTypeSupported, resolveMediaAdapter };
36
-
37
- //# sourceMappingURL=resolve-adapter.js.map
@@ -28,5 +28,3 @@ function indent(code, tab = 1) {
28
28
  }
29
29
  //#endregion
30
30
  export { escapeString, indent, inputToString };
31
-
32
- //# sourceMappingURL=string-utils.js.map
@@ -20,5 +20,4 @@ interface RequestData {
20
20
  bodyMediaType?: string;
21
21
  }
22
22
  //#endregion
23
- export { RawRequestData, RequestData };
24
- //# sourceMappingURL=types.d.ts.map
23
+ export { RawRequestData, RequestData };
@@ -55,5 +55,3 @@ function Trigger({ path, method }) {
55
55
  }
56
56
  //#endregion
57
57
  export { ScalarPlayground as default };
58
-
59
- //# sourceMappingURL=client.js.map
@@ -8,5 +8,4 @@ import { CreateAPIPageOptions } from "../ui/index.js";
8
8
  */
9
9
  declare function withScalar(options?: CreateAPIPageOptions): CreateAPIPageOptions;
10
10
  //#endregion
11
- export { withScalar };
12
- //# sourceMappingURL=index.d.ts.map
11
+ export { withScalar };
@@ -27,5 +27,3 @@ function withScalar(options = {}) {
27
27
  }
28
28
  //#endregion
29
29
  export { withScalar };
30
-
31
- //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import { InlineCodeUsageGenerator } from "../requests/generators/index.js";
2
2
  import { createProxy } from "./proxy.js";
3
+ import { ProcessedDocument } from "../utils/document/process.js";
3
4
  import { Document } from "../types.js";
4
- import { ProcessedDocument } from "../utils/process-document.js";
5
5
 
6
6
  //#region src/server/create.d.ts
7
7
  /**
@@ -37,5 +37,4 @@ declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
37
37
  */
38
38
  declare function createCodeSample<T>(options: InlineCodeUsageGenerator<T>): InlineCodeUsageGenerator<T>;
39
39
  //#endregion
40
- export { OpenAPIOptions, OpenAPIServer, createCodeSample, createOpenAPI };
41
- //# sourceMappingURL=create.d.ts.map
40
+ export { OpenAPIOptions, OpenAPIServer, createCodeSample, createOpenAPI };
@@ -1,5 +1,5 @@
1
1
  import { createProxy } from "./proxy.js";
2
- import { processDocument } from "../utils/process-document.js";
2
+ import { processDocument } from "../utils/document/process.js";
3
3
  import fs from "node:fs";
4
4
  //#region src/server/create.ts
5
5
  function createOpenAPI(options = {}) {
@@ -40,5 +40,3 @@ function createCodeSample(options) {
40
40
  }
41
41
  //#endregion
42
42
  export { createCodeSample, createOpenAPI };
43
-
44
- //# sourceMappingURL=create.js.map
@@ -31,5 +31,4 @@ interface CreateProxyOptions {
31
31
  }
32
32
  declare function createProxy(options?: CreateProxyOptions): Proxy;
33
33
  //#endregion
34
- export { createProxy };
35
- //# sourceMappingURL=proxy.d.ts.map
34
+ export { createProxy };
@@ -65,5 +65,3 @@ function createProxy(options = {}) {
65
65
  }
66
66
  //#endregion
67
67
  export { createProxy };
68
-
69
- //# sourceMappingURL=proxy.js.map
@@ -2,7 +2,7 @@ import { OpenAPIServer } from "./create.js";
2
2
  import { ApiPageProps } from "../ui/api-page.js";
3
3
  import { SchemaToPagesOptions } from "../utils/pages/preset-auto.js";
4
4
  import { ClientApiPageProps } from "../ui/create-client.js";
5
- import { ProcessedDocument } from "../utils/process-document.js";
5
+ import { DereferencedDocument } from "../utils/document/dereference.js";
6
6
  import { LoaderPlugin, MetaData, PageData, PageTreeTransformer, Source } from "fumadocs-core/source";
7
7
  import { StructuredData } from "fumadocs-core/mdx-plugins";
8
8
  import { TOCItemType } from "fumadocs-core/toc";
@@ -28,7 +28,7 @@ interface OpenAPIPageData extends PageData {
28
28
  getAPIPageProps: () => ApiPageProps;
29
29
  getSchema: () => {
30
30
  id: string;
31
- } & ProcessedDocument;
31
+ } & DereferencedDocument;
32
32
  getClientAPIPageProps: () => Promise<ClientApiPageProps>;
33
33
  structuredData: StructuredData;
34
34
  toc: TOCItemType[];
@@ -51,5 +51,4 @@ declare function openapiSource(server: OpenAPIServer, options?: SchemaToPagesOpt
51
51
  */
52
52
  declare function transformerOpenAPI(): PageTreeTransformer;
53
53
  //#endregion
54
- export { InternalOpenAPIMeta, openapiPlugin, openapiSource, transformerOpenAPI };
55
- //# sourceMappingURL=source-api.d.ts.map
54
+ export { InternalOpenAPIMeta, openapiPlugin, openapiSource, transformerOpenAPI };
@@ -142,5 +142,3 @@ function transformerOpenAPI() {
142
142
  }
143
143
  //#endregion
144
144
  export { openapiPlugin, openapiSource, transformerOpenAPI };
145
-
146
- //# sourceMappingURL=source-api.js.map
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { MediaAdapter } from "./requests/media/adapter.js";
2
- import { NoReference } from "./utils/schema/index.js";
3
2
  import { InlineCodeUsageGenerator } from "./requests/generators/index.js";
4
3
  import { boundary_d_exports } from "./ui/client/boundary.js";
5
4
  import { OpenAPIV3, OpenAPIV3_2 } from "./_openapi/types.js";
6
5
  import { OpenAPIOptions } from "./server/create.js";
7
6
  import { CreateAPIPageOptions } from "./ui/base.js";
8
- import { ProcessedDocument } from "./utils/process-document.js";
7
+ import { NoReference } from "./utils/schema/index.js";
8
+ import { DereferencedDocument } from "./utils/document/dereference.js";
9
9
  import { HTMLAttributes, ReactNode } from "react";
10
10
 
11
11
  //#region src/types.d.ts
@@ -26,7 +26,7 @@ type ExampleObject = OpenAPIV3_2.ExampleObject;
26
26
  type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
27
27
  type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
28
28
  type MethodInformation = NoReference<OperationObject> & {
29
- method: string;
29
+ method: HttpMethods;
30
30
  'x-codeSamples'?: InlineCodeUsageGenerator[];
31
31
  'x-selectedCodeSample'?: string;
32
32
  'x-exclusiveCodeSample'?: string;
@@ -36,7 +36,7 @@ interface RenderContext extends Pick<OpenAPIOptions, 'proxyUrl'>, Omit<RequireKe
36
36
  /**
37
37
  * dereferenced schema
38
38
  */
39
- schema: ProcessedDocument;
39
+ schema: DereferencedDocument;
40
40
  clientBoundary: typeof boundary_d_exports;
41
41
  mediaAdapters: Record<string, MediaAdapter>;
42
42
  renderHeading: (depth: number, text: string | ReactNode, props?: HTMLAttributes<HTMLHeadingElement> & {
@@ -47,5 +47,4 @@ interface RenderContext extends Pick<OpenAPIOptions, 'proxyUrl'>, Omit<RequireKe
47
47
  type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
48
48
  type Awaitable<T> = T | Promise<T>;
49
49
  //#endregion
50
- export { Awaitable, CallbackObject, DistributiveOmit, Document, ExampleObject, HttpMethods, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject };
51
- //# sourceMappingURL=types.d.ts.map
50
+ export { Awaitable, CallbackObject, DistributiveOmit, Document, ExampleObject, HttpMethods, MediaTypeObject, MethodInformation, OAuth2SecurityScheme, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject };
@@ -28,5 +28,4 @@ interface OperationItem {
28
28
  method: HttpMethods;
29
29
  }
30
30
  //#endregion
31
- export { ApiPageProps, OperationItem, WebhookItem };
32
- //# sourceMappingURL=api-page.d.ts.map
31
+ export { ApiPageProps, OperationItem, WebhookItem };
@@ -55,5 +55,3 @@ function APIPage({ showTitle: hasHead = false, showDescription, operations, webh
55
55
  }
56
56
  //#endregion
57
57
  export { APIPage };
58
-
59
- //# sourceMappingURL=api-page.js.map
package/dist/ui/base.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { MediaAdapter } from "../requests/media/adapter.js";
2
- import { NoReference } from "../utils/schema/index.js";
3
2
  import { CodeUsageGeneratorRegistry, InlineCodeUsageGenerator } from "../requests/generators/index.js";
4
3
  import { ExampleRequestItem } from "./operation/get-example-requests.js";
5
4
  import { APIPageClientOptions } from "./client/index.js";
@@ -9,7 +8,8 @@ import { ApiPageProps, OperationItem, WebhookItem } from "./api-page.js";
9
8
  import { ResponseTab } from "./operation/response-tabs.js";
10
9
  import { ClientCodeBlockProvider } from "./components/codeblock.js";
11
10
  import { Awaitable, MethodInformation, RenderContext } from "../types.js";
12
- import { ProcessedDocument } from "../utils/process-document.js";
11
+ import { NoReference } from "../utils/schema/index.js";
12
+ import { DereferencedDocument } from "../utils/document/dereference.js";
13
13
  import { FC, HTMLAttributes, ReactNode } from "react";
14
14
  import { ShikiFactory } from "fumadocs-core/highlight/shiki";
15
15
  import { JSONSchema } from "json-schema-typed";
@@ -26,6 +26,11 @@ interface GenerateTypeScriptDefinitionsContext extends RenderContext {
26
26
  contentType: string;
27
27
  };
28
28
  }
29
+ interface APIPlaygroundProps {
30
+ path: string;
31
+ method: MethodInformation;
32
+ ctx: RenderContext;
33
+ }
29
34
  interface CreateAPIPageOptions {
30
35
  /**
31
36
  * Generate TypeScript definitions from response schema.
@@ -140,11 +145,7 @@ interface CreateAPIPageOptions {
140
145
  /**
141
146
  * replace the server-side renderer
142
147
  */
143
- render?: (props: {
144
- path: string;
145
- method: MethodInformation;
146
- ctx: RenderContext;
147
- }) => Awaitable<ReactNode>;
148
+ render?: (props: APIPlaygroundProps) => ReactNode;
148
149
  };
149
150
  renderHeading?: (props: HTMLAttributes<HTMLHeadingElement>, depth: number) => ReactNode;
150
151
  renderCodeBlock?: (props: {
@@ -154,9 +155,8 @@ interface CreateAPIPageOptions {
154
155
  client?: APIPageClientOptions;
155
156
  }
156
157
  interface ServerApiPageProps extends Omit<ApiPageProps, 'document'> {
157
- document: string | ProcessedDocument;
158
+ document: string | DereferencedDocument;
158
159
  }
159
160
  declare function createAPIPage(server: OpenAPIServer, options: CreateAPIPageOptions): FC<ServerApiPageProps>;
160
161
  //#endregion
161
- export { ClientCodeBlockProvider, CreateAPIPageOptions, GenerateTypeScriptDefinitionsContext, ServerApiPageProps, createAPIPage };
162
- //# sourceMappingURL=base.d.ts.map
162
+ export { APIPlaygroundProps, ClientCodeBlockProvider, CreateAPIPageOptions, GenerateTypeScriptDefinitionsContext, ServerApiPageProps, createAPIPage };
package/dist/ui/base.js CHANGED
@@ -1,6 +1,9 @@
1
+ import { parseSecurities } from "../utils/schema/index.js";
1
2
  import { defaultAdapters } from "../requests/media/adapter.js";
3
+ import { encodeInternalRef } from "../utils/schema/ref.js";
2
4
  import { ClientCodeBlockProvider } from "./components/codeblock.js";
3
5
  import { APIPage } from "./api-page.js";
6
+ import { pickSchema } from "../utils/schema/pick.js";
4
7
  import Slugger from "github-slugger";
5
8
  import * as JsxRuntime from "react/jsx-runtime";
6
9
  import { jsx } from "react/jsx-runtime";
@@ -35,6 +38,21 @@ function createAPIPage(server, options) {
35
38
  ...options.shikiOptions
36
39
  }).use(rehypeReact);
37
40
  }
41
+ function renderPlaygroundDefault({ path, method, ctx }) {
42
+ return /* @__PURE__ */ jsx(ctx.clientBoundary.PlaygroundClient, {
43
+ route: path,
44
+ securities: parseSecurities(method, ctx.schema.dereferenced),
45
+ method: method.method,
46
+ doc: pickSchema(ctx.schema.bundled, encodeInternalRef([
47
+ "paths",
48
+ path,
49
+ method.method
50
+ ])),
51
+ proxyUrl: ctx.proxyUrl,
52
+ writeOnly: true,
53
+ readOnly: false
54
+ });
55
+ }
38
56
  return async function APIPageWrapper({ document, ...props }) {
39
57
  let processed;
40
58
  if (typeof document === "string") processed = await server.getSchema(document);
@@ -57,6 +75,10 @@ function createAPIPage(server, options) {
57
75
  ...defaultAdapters,
58
76
  ...options.mediaAdapters
59
77
  },
78
+ playground: {
79
+ ...options.playground,
80
+ render: options.playground?.render ?? renderPlaygroundDefault
81
+ },
60
82
  renderHeading(depth, text, props) {
61
83
  const id = typeof text === "string" ? slugger.slug(text) : props?.id;
62
84
  if (!id) throw new Error("missing 'id' for non-string children");
@@ -120,5 +142,3 @@ function createAPIPage(server, options) {
120
142
  }
121
143
  //#endregion
122
144
  export { ClientCodeBlockProvider, createAPIPage };
123
-
124
- //# sourceMappingURL=base.js.map
@@ -8,5 +8,4 @@ declare namespace boundary_d_exports {
8
8
  export { ApiProvider, PlaygroundClient, SchemaUI, ServerProvider, UsageTab, UsageTabsSelector };
9
9
  }
10
10
  //#endregion
11
- export { boundary_d_exports };
12
- //# sourceMappingURL=boundary.d.ts.map
11
+ export { boundary_d_exports };
@@ -15,5 +15,3 @@ var boundary_exports = /* @__PURE__ */ __exportAll({
15
15
  });
16
16
  //#endregion
17
17
  export { boundary_exports };
18
-
19
- //# sourceMappingURL=boundary.js.map
@@ -16,5 +16,3 @@ function wrapLazy(load) {
16
16
  }
17
17
  //#endregion
18
18
  export { ApiProvider, PlaygroundClient, SchemaUI, ServerProvider, UsageTab, UsageTabsSelector };
19
-
20
- //# sourceMappingURL=boundary.lazy.js.map
@@ -11,5 +11,3 @@ function FullProvider({ children }) {
11
11
  }
12
12
  //#endregion
13
13
  export { FullProvider };
14
-
15
- //# sourceMappingURL=full.js.map
@@ -15,5 +15,3 @@ function I18nLabel({ label, replacements = {} }) {
15
15
  }
16
16
  //#endregion
17
17
  export { I18nLabel, useTranslations };
18
-
19
- //# sourceMappingURL=i18n.js.map
@@ -34,5 +34,4 @@ interface OperationClientOptions {
34
34
  }
35
35
  declare function defineClientConfig(options?: APIPageClientOptions): APIPageClientOptions;
36
36
  //#endregion
37
- export { APIPageClientOptions, OperationClientOptions, defineClientConfig };
38
- //# sourceMappingURL=index.d.ts.map
37
+ export { APIPageClientOptions, OperationClientOptions, defineClientConfig };
@@ -5,5 +5,3 @@ function defineClientConfig(options = {}) {
5
5
  }
6
6
  //#endregion
7
7
  export { defineClientConfig };
8
-
9
- //# sourceMappingURL=index.js.map
@@ -13,5 +13,3 @@ function getStorageKey(prefix = "fumadocs-openapi-", name) {
13
13
  }
14
14
  //#endregion
15
15
  export { useStorageKey };
16
-
17
- //# sourceMappingURL=storage-key.js.map
@@ -40,5 +40,3 @@ function AccordionTrigger(props) {
40
40
  }
41
41
  //#endregion
42
42
  export { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions };
43
-
44
- //# sourceMappingURL=accordion.js.map
@@ -11,5 +11,4 @@ declare function ClientCodeBlockProvider({
11
11
  children: ReactNode;
12
12
  }): _$react_jsx_runtime0.JSX.Element;
13
13
  //#endregion
14
- export { ClientCodeBlockProvider };
15
- //# sourceMappingURL=codeblock.d.ts.map
14
+ export { ClientCodeBlockProvider };
@@ -23,5 +23,3 @@ function ClientCodeBlockProvider({ factory, children }) {
23
23
  }
24
24
  //#endregion
25
25
  export { ClientCodeBlock, ClientCodeBlockProvider };
26
-
27
- //# sourceMappingURL=codeblock.js.map
@@ -58,5 +58,3 @@ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /*
58
58
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
59
59
  //#endregion
60
60
  export { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger };
61
-
62
- //# sourceMappingURL=dialog.js.map
@@ -15,5 +15,3 @@ const Input = React.forwardRef(({ className, type, ...props }, ref) => {
15
15
  Input.displayName = "Input";
16
16
  //#endregion
17
17
  export { Input, labelVariants };
18
-
19
- //# sourceMappingURL=input.js.map
@@ -37,5 +37,3 @@ function MethodLabel({ children, ...props }) {
37
37
  }
38
38
  //#endregion
39
39
  export { Badge, MethodLabel };
40
-
41
- //# sourceMappingURL=method-label.js.map
@@ -39,5 +39,3 @@ function SelectTabTrigger({ items, className, ...props }) {
39
39
  }
40
40
  //#endregion
41
41
  export { SelectTab, SelectTabTrigger, SelectTabs };
42
-
43
- //# sourceMappingURL=select-tab.js.map
@@ -70,5 +70,3 @@ const SelectSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE_
70
70
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
71
71
  //#endregion
72
72
  export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
73
-
74
- //# sourceMappingURL=select.js.map
@@ -23,5 +23,4 @@ declare function ServerProvider({
23
23
  children: ReactNode;
24
24
  }): _$react_jsx_runtime0.JSX.Element;
25
25
  //#endregion
26
- export { ApiProvider, ServerProvider };
27
- //# sourceMappingURL=api.d.ts.map
26
+ export { ApiProvider, ServerProvider };
@@ -101,5 +101,3 @@ function getDefaultValues(server) {
101
101
  }
102
102
  //#endregion
103
103
  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
+ import { parseSecurities } from "../utils/schema/index.js";
1
2
  import { defaultAdapters } from "../requests/media/adapter.js";
2
3
  import { ClientCodeBlock, ClientCodeBlockProvider } from "./components/codeblock.js";
3
- import { dereferenceSync } from "../utils/schema/dereference.js";
4
+ import { dereferenceDocument } from "../utils/document/dereference.js";
4
5
  import { APIPage } from "./api-page.js";
5
6
  import { boundary_exports } from "./client/boundary.js";
6
7
  import { slug } from "github-slugger";
@@ -54,19 +55,19 @@ function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { the
54
55
  }
55
56
  return remark().use(remarkGfm).use(remarkRehype).use(rehypeReact);
56
57
  }
58
+ function renderPlaygroundDefault({ method, path, ctx }) {
59
+ return /* @__PURE__ */ jsx(ctx.clientBoundary.PlaygroundClient, {
60
+ route: path,
61
+ securities: parseSecurities(method, ctx.schema.dereferenced),
62
+ method: method.method,
63
+ doc: ctx.schema.bundled,
64
+ proxyUrl: ctx.proxyUrl,
65
+ writeOnly: true,
66
+ readOnly: false
67
+ });
68
+ }
57
69
  return function ClientAPIPage({ payload, ...props }) {
58
- const processed = useMemo(() => {
59
- const dereferenceMap = /* @__PURE__ */ new Map();
60
- return {
61
- bundled: payload.bundled,
62
- dereferenced: dereferenceSync(payload.bundled, (schema, ref) => {
63
- dereferenceMap.set(schema, ref);
64
- }),
65
- getRawRef(obj) {
66
- return dereferenceMap.get(obj);
67
- }
68
- };
69
- }, [payload.bundled]);
70
+ const processed = useMemo(() => dereferenceDocument(payload.bundled), [payload.bundled]);
70
71
  const ctx = useMemo(() => ({
71
72
  schema: processed,
72
73
  proxyUrl: payload.proxyUrl,
@@ -79,6 +80,10 @@ function createClientAPIPage({ shiki = defaultShikiFactory, shikiOptions = { the
79
80
  ...defaultAdapters,
80
81
  ...options.mediaAdapters
81
82
  },
83
+ playground: {
84
+ ...options.playground,
85
+ render: options.playground?.render ?? renderPlaygroundDefault
86
+ },
82
87
  renderHeading(depth, text, props) {
83
88
  const id = typeof text === "string" ? slug(text) : props?.id;
84
89
  if (!id) throw new Error("missing 'id' for non-string children");
@@ -130,5 +135,3 @@ function MarkdownPre(props) {
130
135
  }
131
136
  //#endregion
132
137
  export { createClientAPIPage };
133
-
134
- //# 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 };
@@ -70,8 +70,8 @@ function getRequestData(path, method, sampleKey, _ctx) {
70
70
  if (bodyOfType.examples && sampleKey) result.body = bodyOfType.examples[sampleKey].value;
71
71
  else if (bodyOfType.example) result.body = bodyOfType.example;
72
72
  else result.body = sample(bodyOfType?.schema ?? {}, {
73
- skipReadOnly: method.method !== "GET",
74
- skipWriteOnly: method.method === "GET",
73
+ skipReadOnly: method.method !== "get",
74
+ skipWriteOnly: method.method === "get",
75
75
  skipNonRequired: true
76
76
  });
77
77
  }
@@ -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
@@ -6,7 +6,6 @@ import { cn } from "../../utils/cn.js";
6
6
  import { Badge, MethodLabel } from "../components/method-label.js";
7
7
  import { I18nLabel } from "../client/i18n.js";
8
8
  import { CopyTypeScriptPanel, OperationProvider } from "./client.js";
9
- import { APIPlayground } from "../../playground/index.js";
10
9
  import { Schema } from "../schema/index.js";
11
10
  import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions } from "../components/accordion.js";
12
11
  import { UsageTabs } from "./usage-tabs/index.js";
@@ -107,8 +106,8 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
107
106
  description: param.description ?? param.schema?.description,
108
107
  deprecated: (param.deprecated ?? false) || (param.schema?.deprecated ?? false)
109
108
  } : param.schema,
110
- readOnly: method.method === "GET",
111
- writeOnly: method.method !== "GET",
109
+ readOnly: method.method === "get",
110
+ writeOnly: method.method !== "get",
112
111
  ctx
113
112
  }, param.name))
114
113
  })] }, type);
@@ -228,7 +227,7 @@ function Operation({ type = "operation", path, method, ctx, showTitle, showDescr
228
227
  callbacks: callbacksNode,
229
228
  parameters: parameterNode,
230
229
  responses: responseNode,
231
- apiPlayground: playgroundEnabled ? /* @__PURE__ */ jsx(APIPlayground, {
230
+ apiPlayground: playgroundEnabled ? ctx.playground?.render?.({
232
231
  path,
233
232
  method,
234
233
  ctx
@@ -320,8 +319,8 @@ function RequestBodyContentItem({ content, method, ctx }) {
320
319
  required: method.requestBody?.required
321
320
  },
322
321
  root: content.schema,
323
- readOnly: method.method === "GET",
324
- writeOnly: method.method !== "GET",
322
+ readOnly: method.method === "get",
323
+ writeOnly: method.method !== "get",
325
324
  ctx
326
325
  })] });
327
326
  }
@@ -500,5 +499,3 @@ function AuthProperty({ name, type, deprecated = false, scopes = [], className,
500
499
  }
501
500
  //#endregion
502
501
  export { Operation };
503
-
504
- //# sourceMappingURL=index.js.map
@@ -76,5 +76,3 @@ function renderRequestTabsDefault(items, ctx) {
76
76
  }
77
77
  //#endregion
78
78
  export { RequestTabs };
79
-
80
- //# sourceMappingURL=request-tabs.js.map