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.
- package/css/generated/shared.css +8 -17
- package/dist/_openapi/types.d.ts +1 -2
- package/dist/generate-file.d.ts +3 -4
- package/dist/generate-file.js +0 -2
- package/dist/i18n.d.ts +1 -2
- package/dist/i18n.js +0 -2
- package/dist/playground/client.d.ts +12 -22
- package/dist/playground/client.js +37 -18
- package/dist/playground/components/inputs.js +0 -2
- package/dist/playground/components/oauth-dialog.js +0 -2
- package/dist/playground/components/server-select.js +0 -2
- package/dist/playground/fetcher.d.ts +1 -2
- package/dist/playground/fetcher.js +0 -2
- package/dist/playground/schema.d.ts +1 -2
- package/dist/playground/schema.js +25 -37
- package/dist/playground/status-info.js +0 -2
- package/dist/requests/generators/all.d.ts +1 -2
- package/dist/requests/generators/all.js +0 -2
- package/dist/requests/generators/csharp.d.ts +1 -2
- package/dist/requests/generators/csharp.js +0 -2
- package/dist/requests/generators/curl.d.ts +1 -2
- package/dist/requests/generators/curl.js +0 -2
- package/dist/requests/generators/go.d.ts +1 -2
- package/dist/requests/generators/go.js +0 -2
- package/dist/requests/generators/index.d.ts +1 -2
- package/dist/requests/generators/index.js +0 -2
- package/dist/requests/generators/java.d.ts +1 -2
- package/dist/requests/generators/java.js +0 -2
- package/dist/requests/generators/javascript.d.ts +1 -2
- package/dist/requests/generators/javascript.js +0 -2
- package/dist/requests/generators/python.d.ts +1 -2
- package/dist/requests/generators/python.js +0 -2
- package/dist/requests/media/adapter.d.ts +1 -2
- package/dist/requests/media/adapter.js +0 -2
- package/dist/requests/media/encode.d.ts +1 -2
- package/dist/requests/media/encode.js +0 -2
- package/dist/requests/media/resolve-adapter.js +0 -2
- package/dist/requests/string-utils.js +0 -2
- package/dist/requests/types.d.ts +1 -2
- package/dist/scalar/client.js +0 -2
- package/dist/scalar/index.d.ts +1 -2
- package/dist/scalar/index.js +0 -2
- package/dist/server/create.d.ts +2 -3
- package/dist/server/create.js +1 -3
- package/dist/server/proxy.d.ts +1 -2
- package/dist/server/proxy.js +0 -2
- package/dist/server/source-api.d.ts +3 -4
- package/dist/server/source-api.js +0 -2
- package/dist/types.d.ts +5 -6
- package/dist/ui/api-page.d.ts +1 -2
- package/dist/ui/api-page.js +0 -2
- package/dist/ui/base.d.ts +10 -10
- package/dist/ui/base.js +22 -2
- package/dist/ui/client/boundary.d.ts +1 -2
- package/dist/ui/client/boundary.js +0 -2
- package/dist/ui/client/boundary.lazy.js +0 -2
- package/dist/ui/client/full.js +0 -2
- package/dist/ui/client/i18n.js +0 -2
- package/dist/ui/client/index.d.ts +1 -2
- package/dist/ui/client/index.js +0 -2
- package/dist/ui/client/storage-key.js +0 -2
- package/dist/ui/components/accordion.js +0 -2
- package/dist/ui/components/codeblock.d.ts +1 -2
- package/dist/ui/components/codeblock.js +0 -2
- package/dist/ui/components/dialog.js +0 -2
- package/dist/ui/components/input.js +0 -2
- package/dist/ui/components/method-label.js +0 -2
- package/dist/ui/components/select-tab.js +0 -2
- package/dist/ui/components/select.js +0 -2
- package/dist/ui/contexts/api.d.ts +1 -2
- package/dist/ui/contexts/api.js +0 -2
- package/dist/ui/create-client.d.ts +1 -2
- package/dist/ui/create-client.js +18 -15
- package/dist/ui/index.d.ts +1 -2
- package/dist/ui/index.js +0 -2
- package/dist/ui/operation/client.js +0 -2
- package/dist/ui/operation/get-example-requests.d.ts +1 -2
- package/dist/ui/operation/get-example-requests.js +2 -4
- package/dist/ui/operation/index.js +5 -8
- package/dist/ui/operation/request-tabs.js +0 -2
- package/dist/ui/operation/response-tabs.d.ts +2 -3
- package/dist/ui/operation/response-tabs.js +0 -2
- package/dist/ui/operation/usage-tabs/client.d.ts +1 -2
- package/dist/ui/operation/usage-tabs/client.js +0 -2
- package/dist/ui/operation/usage-tabs/index.js +0 -2
- package/dist/ui/schema/client.d.ts +1 -2
- package/dist/ui/schema/client.js +0 -2
- package/dist/ui/schema/index.d.ts +3 -4
- package/dist/ui/schema/index.js +1 -3
- package/dist/utils/deep-equal.js +8 -6
- package/dist/utils/document/dereference.d.ts +17 -0
- package/dist/utils/document/dereference.js +19 -0
- package/dist/utils/document/process.d.ts +6 -0
- package/dist/utils/{process-document.js → document/process.js} +4 -19
- package/dist/utils/id-to-title.js +0 -2
- package/dist/utils/is-plain-object.js +8 -0
- package/dist/utils/pages/builder.d.ts +5 -6
- package/dist/utils/pages/builder.js +0 -2
- package/dist/utils/pages/preset-auto.d.ts +3 -4
- package/dist/utils/pages/preset-auto.js +0 -2
- package/dist/utils/pages/to-static-data.js +0 -2
- package/dist/utils/pages/to-text.d.ts +1 -2
- package/dist/utils/pages/to-text.js +0 -2
- package/dist/utils/remove-undefined.js +10 -10
- package/dist/utils/schema/dereference.js +22 -14
- package/dist/utils/schema/index.d.ts +7 -7
- package/dist/utils/schema/index.js +21 -4
- package/dist/utils/{merge-schema.js → schema/merge.js} +2 -4
- package/dist/utils/schema/pick.js +44 -0
- package/dist/utils/schema/ref.js +35 -0
- package/dist/utils/schema/resolve-ref.js +4 -14
- package/dist/utils/schema/to-string.js +4 -7
- package/dist/utils/url.js +0 -2
- package/dist/utils/use-query.js +0 -2
- package/package.json +3 -4
- package/dist/_openapi/types.d.ts.map +0 -1
- package/dist/generate-file.d.ts.map +0 -1
- package/dist/generate-file.js.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/i18n.js.map +0 -1
- package/dist/playground/client.d.ts.map +0 -1
- package/dist/playground/client.js.map +0 -1
- package/dist/playground/components/inputs.js.map +0 -1
- package/dist/playground/components/oauth-dialog.js.map +0 -1
- package/dist/playground/components/server-select.js.map +0 -1
- package/dist/playground/fetcher.d.ts.map +0 -1
- package/dist/playground/fetcher.js.map +0 -1
- package/dist/playground/index.d.ts +0 -22
- package/dist/playground/index.d.ts.map +0 -1
- package/dist/playground/index.js +0 -118
- package/dist/playground/index.js.map +0 -1
- package/dist/playground/schema.d.ts.map +0 -1
- package/dist/playground/schema.js.map +0 -1
- package/dist/playground/status-info.js.map +0 -1
- package/dist/requests/generators/all.d.ts.map +0 -1
- package/dist/requests/generators/all.js.map +0 -1
- package/dist/requests/generators/csharp.d.ts.map +0 -1
- package/dist/requests/generators/csharp.js.map +0 -1
- package/dist/requests/generators/curl.d.ts.map +0 -1
- package/dist/requests/generators/curl.js.map +0 -1
- package/dist/requests/generators/go.d.ts.map +0 -1
- package/dist/requests/generators/go.js.map +0 -1
- package/dist/requests/generators/index.d.ts.map +0 -1
- package/dist/requests/generators/index.js.map +0 -1
- package/dist/requests/generators/java.d.ts.map +0 -1
- package/dist/requests/generators/java.js.map +0 -1
- package/dist/requests/generators/javascript.d.ts.map +0 -1
- package/dist/requests/generators/javascript.js.map +0 -1
- package/dist/requests/generators/python.d.ts.map +0 -1
- package/dist/requests/generators/python.js.map +0 -1
- package/dist/requests/media/adapter.d.ts.map +0 -1
- package/dist/requests/media/adapter.js.map +0 -1
- package/dist/requests/media/encode.d.ts.map +0 -1
- package/dist/requests/media/encode.js.map +0 -1
- package/dist/requests/media/resolve-adapter.js.map +0 -1
- package/dist/requests/string-utils.js.map +0 -1
- package/dist/requests/types.d.ts.map +0 -1
- package/dist/scalar/client.js.map +0 -1
- package/dist/scalar/index.d.ts.map +0 -1
- package/dist/scalar/index.js.map +0 -1
- package/dist/server/create.d.ts.map +0 -1
- package/dist/server/create.js.map +0 -1
- package/dist/server/proxy.d.ts.map +0 -1
- package/dist/server/proxy.js.map +0 -1
- package/dist/server/source-api.d.ts.map +0 -1
- package/dist/server/source-api.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/ui/api-page.d.ts.map +0 -1
- package/dist/ui/api-page.js.map +0 -1
- package/dist/ui/base.d.ts.map +0 -1
- package/dist/ui/base.js.map +0 -1
- package/dist/ui/client/boundary.d.ts.map +0 -1
- package/dist/ui/client/boundary.js.map +0 -1
- package/dist/ui/client/boundary.lazy.js.map +0 -1
- package/dist/ui/client/full.js.map +0 -1
- package/dist/ui/client/i18n.js.map +0 -1
- package/dist/ui/client/index.d.ts.map +0 -1
- package/dist/ui/client/index.js.map +0 -1
- package/dist/ui/client/storage-key.js.map +0 -1
- package/dist/ui/components/accordion.js.map +0 -1
- package/dist/ui/components/codeblock.d.ts.map +0 -1
- package/dist/ui/components/codeblock.js.map +0 -1
- package/dist/ui/components/dialog.js.map +0 -1
- package/dist/ui/components/input.js.map +0 -1
- package/dist/ui/components/method-label.js.map +0 -1
- package/dist/ui/components/select-tab.js.map +0 -1
- package/dist/ui/components/select.js.map +0 -1
- package/dist/ui/contexts/api.d.ts.map +0 -1
- package/dist/ui/contexts/api.js.map +0 -1
- package/dist/ui/create-client.d.ts.map +0 -1
- package/dist/ui/create-client.js.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/operation/client.js.map +0 -1
- package/dist/ui/operation/get-example-requests.d.ts.map +0 -1
- package/dist/ui/operation/get-example-requests.js.map +0 -1
- package/dist/ui/operation/index.js.map +0 -1
- package/dist/ui/operation/request-tabs.js.map +0 -1
- package/dist/ui/operation/response-tabs.d.ts.map +0 -1
- package/dist/ui/operation/response-tabs.js.map +0 -1
- package/dist/ui/operation/usage-tabs/client.d.ts.map +0 -1
- package/dist/ui/operation/usage-tabs/client.js.map +0 -1
- package/dist/ui/operation/usage-tabs/index.js.map +0 -1
- package/dist/ui/schema/client.d.ts.map +0 -1
- package/dist/ui/schema/client.js.map +0 -1
- package/dist/ui/schema/index.d.ts.map +0 -1
- package/dist/ui/schema/index.js.map +0 -1
- package/dist/utils/deep-equal.js.map +0 -1
- package/dist/utils/id-to-title.js.map +0 -1
- package/dist/utils/merge-schema.js.map +0 -1
- package/dist/utils/pages/builder.d.ts.map +0 -1
- package/dist/utils/pages/builder.js.map +0 -1
- package/dist/utils/pages/preset-auto.d.ts.map +0 -1
- package/dist/utils/pages/preset-auto.js.map +0 -1
- package/dist/utils/pages/to-static-data.js.map +0 -1
- package/dist/utils/pages/to-text.d.ts.map +0 -1
- package/dist/utils/pages/to-text.js.map +0 -1
- package/dist/utils/process-document.d.ts +0 -18
- package/dist/utils/process-document.d.ts.map +0 -1
- package/dist/utils/process-document.js.map +0 -1
- package/dist/utils/remove-undefined.js.map +0 -1
- package/dist/utils/schema/dereference.js.map +0 -1
- package/dist/utils/schema/index.d.ts.map +0 -1
- package/dist/utils/schema/index.js.map +0 -1
- package/dist/utils/schema/resolve-ref.js.map +0 -1
- package/dist/utils/schema/to-string.js.map +0 -1
- package/dist/utils/url.js.map +0 -1
- package/dist/utils/use-query.js.map +0 -1
|
@@ -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 };
|
package/dist/requests/types.d.ts
CHANGED
package/dist/scalar/client.js
CHANGED
package/dist/scalar/index.d.ts
CHANGED
package/dist/scalar/index.js
CHANGED
package/dist/server/create.d.ts
CHANGED
|
@@ -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 };
|
package/dist/server/create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createProxy } from "./proxy.js";
|
|
2
|
-
import { processDocument } from "../utils/process
|
|
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
|
package/dist/server/proxy.d.ts
CHANGED
package/dist/server/proxy.js
CHANGED
|
@@ -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 {
|
|
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
|
-
} &
|
|
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 };
|
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 {
|
|
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:
|
|
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:
|
|
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 };
|
package/dist/ui/api-page.d.ts
CHANGED
package/dist/ui/api-page.js
CHANGED
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 {
|
|
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 |
|
|
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
|
package/dist/ui/client/full.js
CHANGED
package/dist/ui/client/i18n.js
CHANGED
|
@@ -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 };
|
package/dist/ui/client/index.js
CHANGED
|
@@ -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
|
|
@@ -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
|
package/dist/ui/contexts/api.js
CHANGED
|
@@ -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 };
|
package/dist/ui/create-client.js
CHANGED
|
@@ -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 {
|
|
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
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -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
|
@@ -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 !== "
|
|
74
|
-
skipWriteOnly: method.method === "
|
|
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 === "
|
|
111
|
-
writeOnly: method.method !== "
|
|
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 ?
|
|
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 === "
|
|
324
|
-
writeOnly: method.method !== "
|
|
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
|