fumadocs-openapi 11.4.1 → 11.4.2
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/dist/.translations/index.d.ts +2 -3
- package/dist/generate-file.d.ts +5 -6
- package/dist/i18n.d.ts +3 -3
- package/dist/playground/client.d.ts +9 -9
- package/dist/playground/components/result-display.d.ts +3 -4
- package/dist/playground/fetcher.d.ts +5 -6
- package/dist/requests/generators/all.d.ts +2 -3
- package/dist/requests/generators/csharp.d.ts +2 -3
- package/dist/requests/generators/curl.d.ts +2 -3
- package/dist/requests/generators/go.d.ts +2 -3
- package/dist/requests/generators/index.d.ts +7 -8
- package/dist/requests/generators/java.d.ts +2 -3
- package/dist/requests/generators/javascript.d.ts +2 -3
- package/dist/requests/generators/python.d.ts +3 -4
- package/dist/requests/generators/rust.d.ts +2 -3
- package/dist/requests/media/adapter.d.ts +3 -4
- package/dist/requests/media/encode.d.ts +3 -4
- package/dist/requests/types.d.ts +3 -4
- package/dist/scalar/index.d.ts +2 -3
- package/dist/server/index.d.ts +9 -9
- package/dist/server/proxy.d.ts +4 -5
- package/dist/types/openapi.d.ts +7 -8
- package/dist/types.d.ts +20 -21
- package/dist/ui/base.d.ts +2 -3
- package/dist/ui/contexts/api.d.ts +4 -5
- package/dist/ui/create-client.d.ts +4 -5
- package/dist/ui/index.d.ts +11 -9
- package/dist/ui/operation/context.d.ts +3 -4
- package/dist/ui/operation/index.js +2 -0
- package/dist/ui/operation/request-tabs.d.ts +2 -3
- package/dist/ui/operation/response-tabs.d.ts +3 -4
- package/dist/ui/operation/usage-tabs.js +4 -6
- package/dist/utils/document/dereference.d.ts +2 -3
- package/dist/utils/get-example-requests.d.ts +2 -3
- package/dist/utils/pages/builder.d.ts +11 -12
- package/dist/utils/pages/preset-auto.d.ts +2 -3
- package/dist/utils/pages/to-text.d.ts +3 -4
- package/package.json +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/.translations/index.d.ts
|
|
2
|
-
type Translations = {
|
|
2
|
+
export type Translations = {
|
|
3
3
|
"Access Token(playground)": string;
|
|
4
4
|
"Authenticate using username and password.(OAuth dialog)": string;
|
|
5
5
|
"Authenticate with 3rd party services(OAuth dialog)": string;
|
|
@@ -82,5 +82,4 @@ type Translations = {
|
|
|
82
82
|
"Username(OAuth dialog)": string;
|
|
83
83
|
"loading...(playground server select)": string;
|
|
84
84
|
};
|
|
85
|
-
//#endregion
|
|
86
|
-
export { Translations };
|
|
85
|
+
//#endregion
|
package/dist/generate-file.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { OpenAPIServer } from "./server/index.js";
|
|
|
4
4
|
import { DistributiveOmit } from "./types.js";
|
|
5
5
|
import { PagesToTextOptions } from "./utils/pages/to-text.js";
|
|
6
6
|
//#region src/generate-file.d.ts
|
|
7
|
-
interface OutputFile {
|
|
7
|
+
export interface OutputFile {
|
|
8
8
|
path: string;
|
|
9
9
|
content: string;
|
|
10
10
|
}
|
|
@@ -60,7 +60,7 @@ interface GenerateFilesConfig extends PagesToTextOptions {
|
|
|
60
60
|
interface MetaOptions {
|
|
61
61
|
folderStyle?: 'folder' | 'separator';
|
|
62
62
|
}
|
|
63
|
-
type Config = SchemaToPagesOptions & GenerateFilesConfig & {
|
|
63
|
+
export type Config = SchemaToPagesOptions & GenerateFilesConfig & {
|
|
64
64
|
/**
|
|
65
65
|
* Re-generate when **schema files are changed**, ignores custom input functions & URLs.
|
|
66
66
|
*
|
|
@@ -72,7 +72,6 @@ interface BeforeWriteContext {
|
|
|
72
72
|
readonly generated: Record<string, OutputFile[]>;
|
|
73
73
|
readonly generatedEntries: Record<string, OutputEntry[]>;
|
|
74
74
|
}
|
|
75
|
-
declare function generateFiles(options: Config): Promise<void>;
|
|
76
|
-
declare function generateFilesOnly(options: DistributiveOmit<Config, 'output'>): Promise<OutputFile[]>;
|
|
77
|
-
//#endregion
|
|
78
|
-
export { Config, OutputFile, generateFiles, generateFilesOnly };
|
|
75
|
+
export declare function generateFiles(options: Config): Promise<void>;
|
|
76
|
+
export declare function generateFilesOnly(options: DistributiveOmit<Config, 'output'>): Promise<OutputFile[]>;
|
|
77
|
+
//#endregion
|
package/dist/i18n.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Translations as Translations$1 } from "@fumadocs/api-docs/i18n";
|
|
|
3
3
|
import { TranslationExtension } from "fumadocs-core/i18n";
|
|
4
4
|
import { I18nUIConfig } from "fumadocs-ui/i18n";
|
|
5
5
|
//#region src/i18n.d.ts
|
|
6
|
-
declare function openapiTranslations(): TranslationExtension<keyof Translations | keyof Translations$1>;
|
|
6
|
+
export declare function openapiTranslations(): TranslationExtension<keyof Translations | keyof Translations$1>;
|
|
7
7
|
/** @deprecated use `i18n.translations()` & `openapiTranslations()` instead */
|
|
8
|
-
declare function defineI18nOpenAPI<Languages extends string>(config: I18nUIConfig<Languages>, translations: Partial<Record<NoInfer<Languages>, Partial<Translations>>>): I18nUIConfig<Languages>;
|
|
8
|
+
export declare function defineI18nOpenAPI<Languages extends string>(config: I18nUIConfig<Languages>, translations: Partial<Record<NoInfer<Languages>, Partial<Translations>>>): I18nUIConfig<Languages>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export type { Translations };
|
|
@@ -6,14 +6,14 @@ import { ComponentProps, FC, ReactNode } from "react";
|
|
|
6
6
|
import { Collapsible } from "@fumadocs/api-docs/components/collapsible";
|
|
7
7
|
import { FieldKey } from "@fumari/stf";
|
|
8
8
|
//#region src/playground/client.d.ts
|
|
9
|
-
interface FormValues extends Record<string, unknown> {
|
|
9
|
+
export interface FormValues extends Record<string, unknown> {
|
|
10
10
|
path: Record<string, unknown>;
|
|
11
11
|
query: Record<string, unknown>;
|
|
12
12
|
header: Record<string, unknown>;
|
|
13
13
|
cookie: Record<string, unknown>;
|
|
14
14
|
body: unknown;
|
|
15
15
|
}
|
|
16
|
-
interface PlaygroundClientProps extends Omit<ComponentProps<'form'>, 'method'> {
|
|
16
|
+
export interface PlaygroundClientProps extends Omit<ComponentProps<'form'>, 'method'> {
|
|
17
17
|
route: string;
|
|
18
18
|
method: HttpMethods;
|
|
19
19
|
operation: OperationObject;
|
|
@@ -21,11 +21,11 @@ interface PlaygroundClientProps extends Omit<ComponentProps<'form'>, 'method'> {
|
|
|
21
21
|
writeOnly: boolean;
|
|
22
22
|
readOnly: boolean;
|
|
23
23
|
}
|
|
24
|
-
interface CollapsiblePanelProps extends Omit<ComponentProps<typeof Collapsible>, 'title'> {
|
|
24
|
+
export interface CollapsiblePanelProps extends Omit<ComponentProps<typeof Collapsible>, 'title'> {
|
|
25
25
|
'data-type': 'authorization' | 'body' | ParamType;
|
|
26
26
|
title: ReactNode;
|
|
27
27
|
}
|
|
28
|
-
interface PlaygroundClientOptions {
|
|
28
|
+
export interface PlaygroundClientOptions {
|
|
29
29
|
/**
|
|
30
30
|
* transform fields for auth-specific parameters (e.g. header)
|
|
31
31
|
*/
|
|
@@ -55,10 +55,10 @@ interface RequestBodyInfo {
|
|
|
55
55
|
schema: ParsedSchema;
|
|
56
56
|
mediaType: string;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
export default function PlaygroundClient({ route, method, operation, pathItem, writeOnly, readOnly, ...rest }: PlaygroundClientProps): import("react").JSX.Element;
|
|
59
59
|
declare const ParamTypes: readonly ['path', 'header', 'cookie', 'query'];
|
|
60
60
|
type ParamType = (typeof ParamTypes)[number];
|
|
61
|
-
interface AuthField {
|
|
61
|
+
export interface AuthField {
|
|
62
62
|
fieldName: FieldKey;
|
|
63
63
|
schemeId: string;
|
|
64
64
|
storageKey: string;
|
|
@@ -66,8 +66,8 @@ interface AuthField {
|
|
|
66
66
|
children: ReactNode;
|
|
67
67
|
mapOutput?: (values: unknown) => unknown;
|
|
68
68
|
}
|
|
69
|
-
declare function DefaultCollapsiblePanel({ title, children, ...props }: CollapsiblePanelProps): import("react").JSX.Element;
|
|
70
|
-
declare const Custom: {
|
|
69
|
+
export declare function DefaultCollapsiblePanel({ title, children, ...props }: CollapsiblePanelProps): import("react").JSX.Element;
|
|
70
|
+
export declare const Custom: {
|
|
71
71
|
useController(fieldName: FieldKey, options?: {
|
|
72
72
|
defaultValue?: unknown;
|
|
73
73
|
}): {
|
|
@@ -76,4 +76,4 @@ declare const Custom: {
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
//#endregion
|
|
79
|
-
export {
|
|
79
|
+
export { DefaultResultDisplay, type ResultDisplayProps };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { FetchResult } from "../fetcher.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
//#region src/playground/components/result-display.d.ts
|
|
4
|
-
interface ResultDisplayProps extends ComponentProps<'div'> {
|
|
4
|
+
export interface ResultDisplayProps extends ComponentProps<'div'> {
|
|
5
5
|
data: FetchResult;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
}
|
|
8
|
-
declare function DefaultResultDisplay({ data, reset, ...rest }: ResultDisplayProps): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { DefaultResultDisplay, ResultDisplayProps };
|
|
8
|
+
export declare function DefaultResultDisplay({ data, reset, ...rest }: ResultDisplayProps): import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import "../requests/types.js";
|
|
2
2
|
import { Awaitable } from "../types.js";
|
|
3
3
|
//#region src/playground/fetcher.d.ts
|
|
4
|
-
type FetchResult = FetchResponseResult | FetchErrorResult;
|
|
5
|
-
interface FetchErrorResult {
|
|
4
|
+
export type FetchResult = FetchResponseResult | FetchErrorResult;
|
|
5
|
+
export interface FetchErrorResult {
|
|
6
6
|
type: 'client_error';
|
|
7
7
|
url: string;
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
|
-
interface FetchResponseResult {
|
|
10
|
+
export interface FetchResponseResult {
|
|
11
11
|
type: 'response';
|
|
12
12
|
url: string;
|
|
13
13
|
status: number;
|
|
14
14
|
headers: Headers;
|
|
15
15
|
body: ArrayBuffer;
|
|
16
16
|
}
|
|
17
|
-
interface BrowserFetcherOptions {
|
|
17
|
+
export interface BrowserFetcherOptions {
|
|
18
18
|
/**
|
|
19
19
|
* Request timeout in seconds (default: 10s)
|
|
20
20
|
*/
|
|
@@ -31,5 +31,4 @@ interface BrowserFetcherOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
onRequestInit?: (requestInit: RequestInit) => Awaitable<RequestInit>;
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { BrowserFetcherOptions, FetchErrorResult, FetchResponseResult, FetchResult };
|
|
34
|
+
//#endregion
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CodeUsageGeneratorRegistry } from "./index.js";
|
|
2
2
|
//#region src/requests/generators/all.d.ts
|
|
3
|
-
declare function registerDefault(registry: CodeUsageGeneratorRegistry): CodeUsageGeneratorRegistry;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { registerDefault };
|
|
3
|
+
export declare function registerDefault(registry: CodeUsageGeneratorRegistry): CodeUsageGeneratorRegistry;
|
|
4
|
+
//#endregion
|
|
@@ -2,8 +2,8 @@ import { MediaAdapter } from "../media/adapter.js";
|
|
|
2
2
|
import { RequestData } from "../types.js";
|
|
3
3
|
import * as Shared from "@fumadocs/api-docs/codegen";
|
|
4
4
|
//#region src/requests/generators/index.d.ts
|
|
5
|
-
declare function pathnameFromRequest(pathname: string, { path, query }: RequestData): string;
|
|
6
|
-
type CodeUsageGeneratorRegistry = Shared.CodeUsageGeneratorRegistry<RequestData & {
|
|
5
|
+
export declare function pathnameFromRequest(pathname: string, { path, query }: RequestData): string;
|
|
6
|
+
export type CodeUsageGeneratorRegistry = Shared.CodeUsageGeneratorRegistry<RequestData & {
|
|
7
7
|
url: string;
|
|
8
8
|
}, {
|
|
9
9
|
mediaAdapters: Record<string, MediaAdapter>;
|
|
@@ -12,7 +12,7 @@ type CodeUsageGeneratorRegistry = Shared.CodeUsageGeneratorRegistry<RequestData
|
|
|
12
12
|
/**
|
|
13
13
|
* Generate code example for given programming language
|
|
14
14
|
*/
|
|
15
|
-
type CodeUsageGenerator = Shared.CodeUsageGenerator<RequestData & {
|
|
15
|
+
export type CodeUsageGenerator = Shared.CodeUsageGenerator<RequestData & {
|
|
16
16
|
url: string;
|
|
17
17
|
}, {
|
|
18
18
|
mediaAdapters: Record<string, MediaAdapter>;
|
|
@@ -21,18 +21,17 @@ type CodeUsageGenerator = Shared.CodeUsageGenerator<RequestData & {
|
|
|
21
21
|
/**
|
|
22
22
|
* Generate code example for given programming language
|
|
23
23
|
*/
|
|
24
|
-
type InlineCodeUsageGenerator<T = unknown> = Shared.InlineCodeUsageGenerator<RequestData & {
|
|
24
|
+
export type InlineCodeUsageGenerator<T = unknown> = Shared.InlineCodeUsageGenerator<RequestData & {
|
|
25
25
|
url: string;
|
|
26
26
|
}, {
|
|
27
27
|
mediaAdapters: Record<string, MediaAdapter>;
|
|
28
28
|
custom: T;
|
|
29
29
|
}>;
|
|
30
|
-
declare function createCodeUsageGeneratorRegistry(inherit?: CodeUsageGeneratorRegistry): CodeUsageGeneratorRegistry;
|
|
31
|
-
type CodeUsageGeneratorFn<T = unknown> = (data: RequestData & {
|
|
30
|
+
export declare function createCodeUsageGeneratorRegistry(inherit?: CodeUsageGeneratorRegistry): CodeUsageGeneratorRegistry;
|
|
31
|
+
export type CodeUsageGeneratorFn<T = unknown> = (data: RequestData & {
|
|
32
32
|
url: string;
|
|
33
33
|
}, context: {
|
|
34
34
|
mediaAdapters: Record<string, MediaAdapter>;
|
|
35
35
|
custom: T;
|
|
36
36
|
}) => string;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { CodeUsageGenerator, CodeUsageGeneratorFn, CodeUsageGeneratorRegistry, InlineCodeUsageGenerator, createCodeUsageGeneratorRegistry, pathnameFromRequest };
|
|
37
|
+
//#endregion
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CodeUsageGenerator } from "./index.js";
|
|
2
2
|
//#region src/requests/generators/python.d.ts
|
|
3
|
-
declare const python: CodeUsageGenerator;
|
|
4
|
-
declare function generatePythonObject(v: unknown, imports: Set<string>): string;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { generatePythonObject, python };
|
|
3
|
+
export declare const python: CodeUsageGenerator;
|
|
4
|
+
export declare function generatePythonObject(v: unknown, imports: Set<string>): string;
|
|
5
|
+
//#endregion
|
|
@@ -21,10 +21,10 @@ interface CSharpContext extends BaseContext {
|
|
|
21
21
|
lang: 'csharp';
|
|
22
22
|
addImport: (specifier: string) => void;
|
|
23
23
|
}
|
|
24
|
-
type MediaContext = JavaContext | GoContext | JavaScriptContext | CSharpContext | (BaseContext & {
|
|
24
|
+
export type MediaContext = JavaContext | GoContext | JavaScriptContext | CSharpContext | (BaseContext & {
|
|
25
25
|
lang: string;
|
|
26
26
|
});
|
|
27
|
-
interface MediaAdapter {
|
|
27
|
+
export interface MediaAdapter {
|
|
28
28
|
/**
|
|
29
29
|
* encode data into specified media type for `fetch()`.
|
|
30
30
|
*
|
|
@@ -46,5 +46,4 @@ interface MediaAdapter {
|
|
|
46
46
|
body: unknown;
|
|
47
47
|
}, ctx: MediaContext) => string | undefined;
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
|
-
export { MediaAdapter, MediaContext };
|
|
49
|
+
//#endregion
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "../types.js";
|
|
2
2
|
import "../../types.js";
|
|
3
3
|
//#region src/requests/media/encode.d.ts
|
|
4
|
-
interface EncodedParameter {
|
|
4
|
+
export interface EncodedParameter {
|
|
5
5
|
readonly value: string;
|
|
6
6
|
}
|
|
7
|
-
interface EncodedParameterMultiple {
|
|
7
|
+
export interface EncodedParameterMultiple {
|
|
8
8
|
readonly values: string[];
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { EncodedParameter, EncodedParameterMultiple };
|
|
10
|
+
//#endregion
|
package/dist/requests/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EncodedParameter, EncodedParameterMultiple } from "./media/encode.js";
|
|
2
2
|
import { HttpMethods } from "../types.js";
|
|
3
3
|
//#region src/requests/types.d.ts
|
|
4
|
-
interface RawRequestData {
|
|
4
|
+
export interface RawRequestData {
|
|
5
5
|
method: HttpMethods;
|
|
6
6
|
path: Record<string, unknown>;
|
|
7
7
|
query: Record<string, unknown>;
|
|
@@ -10,7 +10,7 @@ interface RawRequestData {
|
|
|
10
10
|
body?: unknown;
|
|
11
11
|
bodyMediaType?: string;
|
|
12
12
|
}
|
|
13
|
-
interface RequestData {
|
|
13
|
+
export interface RequestData {
|
|
14
14
|
method: HttpMethods;
|
|
15
15
|
path: Record<string, EncodedParameter>;
|
|
16
16
|
query: Record<string, EncodedParameterMultiple>;
|
|
@@ -19,5 +19,4 @@ interface RequestData {
|
|
|
19
19
|
body?: unknown;
|
|
20
20
|
bodyMediaType?: string;
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { RawRequestData, RequestData };
|
|
22
|
+
//#endregion
|
package/dist/scalar/index.d.ts
CHANGED
|
@@ -5,6 +5,5 @@ import { CreateOpenAPIPageOptions } from "../ui/index.js";
|
|
|
5
5
|
*
|
|
6
6
|
* Requires `@scalar/api-client-react` to be installed, it imports the styles automatically.
|
|
7
7
|
*/
|
|
8
|
-
declare function withScalar(options?: CreateOpenAPIPageOptions): CreateOpenAPIPageOptions;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { withScalar };
|
|
8
|
+
export declare function withScalar(options?: CreateOpenAPIPageOptions): CreateOpenAPIPageOptions;
|
|
9
|
+
//#endregion
|
package/dist/server/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type SchemaRecord = Record<string, string | Document | (() => Awaitable<string |
|
|
|
13
13
|
interface LoadedDocument {
|
|
14
14
|
bundled: Document;
|
|
15
15
|
}
|
|
16
|
-
interface OpenAPIOptions {
|
|
16
|
+
export interface OpenAPIOptions {
|
|
17
17
|
/**
|
|
18
18
|
* Schema files, can be:
|
|
19
19
|
* - URL
|
|
@@ -27,7 +27,7 @@ interface OpenAPIOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
proxyUrl?: string;
|
|
29
29
|
}
|
|
30
|
-
interface OpenAPIServer {
|
|
30
|
+
export interface OpenAPIServer {
|
|
31
31
|
createProxy: typeof createProxy;
|
|
32
32
|
getSchemas: () => Promise<Record<string, LoadedDocument>>;
|
|
33
33
|
getSchema: (document: string) => Promise<LoadedDocument>;
|
|
@@ -54,7 +54,7 @@ interface OpenAPIServer {
|
|
|
54
54
|
/** @private internal API */
|
|
55
55
|
_getWatchPaths: () => string[];
|
|
56
56
|
}
|
|
57
|
-
interface OpenAPIPageData extends PageData {
|
|
57
|
+
export interface OpenAPIPageData extends PageData {
|
|
58
58
|
getOpenAPIPageProps: () => OpenAPIPageProps_Spec;
|
|
59
59
|
getSchema: () => {
|
|
60
60
|
id: string;
|
|
@@ -68,15 +68,15 @@ interface OpenAPIPageData extends PageData {
|
|
|
68
68
|
/** @deprecated use `getOpenAPIPageProps()` instead */
|
|
69
69
|
getClientAPIPageProps: () => OpenAPIPageProps_Spec;
|
|
70
70
|
}
|
|
71
|
-
type OpenAPISourceOptions = SchemaToPagesOptions & {
|
|
71
|
+
export type OpenAPISourceOptions = SchemaToPagesOptions & {
|
|
72
72
|
baseDir?: string;
|
|
73
73
|
/** Generate `meta.json` files */
|
|
74
74
|
meta?: boolean | {
|
|
75
75
|
folderStyle?: 'folder' | 'separator';
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
-
declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
|
|
79
|
-
interface InternalOpenAPIMeta {
|
|
78
|
+
export declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
|
|
79
|
+
export interface InternalOpenAPIMeta {
|
|
80
80
|
method?: string;
|
|
81
81
|
webhook?: boolean;
|
|
82
82
|
deprecated?: boolean;
|
|
@@ -85,13 +85,13 @@ interface InternalOpenAPIMeta {
|
|
|
85
85
|
/**
|
|
86
86
|
* Fumadocs Source API integration, pass this to `plugins` array in `loader()`.
|
|
87
87
|
*/
|
|
88
|
-
declare function openapiPlugin(): LoaderPlugin;
|
|
88
|
+
export declare function openapiPlugin(): LoaderPlugin;
|
|
89
89
|
/**
|
|
90
90
|
* Generate virtual pages for Fumadocs Source API
|
|
91
91
|
*/
|
|
92
|
-
declare function openapiSource(server: OpenAPIServer, options?: OpenAPISourceOptions): Promise<Source<{
|
|
92
|
+
export declare function openapiSource(server: OpenAPIServer, options?: OpenAPISourceOptions): Promise<Source<{
|
|
93
93
|
metaData: MetaData;
|
|
94
94
|
pageData: OpenAPIPageData;
|
|
95
95
|
}>>;
|
|
96
96
|
//#endregion
|
|
97
|
-
export {
|
|
97
|
+
export type { CreateProxyOptions, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec, Proxy };
|
package/dist/server/proxy.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
declare const methods: readonly ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
3
3
|
type Handler = (req: Request) => Promise<Response>;
|
|
4
4
|
type OriginMatcher = string | RegExp;
|
|
5
|
-
interface Proxy extends Record<(typeof methods)[number], Handler> {
|
|
5
|
+
export interface Proxy extends Record<(typeof methods)[number], Handler> {
|
|
6
6
|
handle: Handler;
|
|
7
7
|
}
|
|
8
|
-
interface CreateProxyOptions {
|
|
8
|
+
export interface CreateProxyOptions {
|
|
9
9
|
/**
|
|
10
10
|
* List of allowed origins to proxy to, also enforced on redirects.
|
|
11
11
|
*
|
|
@@ -28,6 +28,5 @@ interface CreateProxyOptions {
|
|
|
28
28
|
response?: (response: Response) => Response;
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
declare function createProxy(options?: CreateProxyOptions): Proxy;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { CreateProxyOptions, Proxy, createProxy };
|
|
31
|
+
export declare function createProxy(options?: CreateProxyOptions): Proxy;
|
|
32
|
+
//#endregion
|
package/dist/types/openapi.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** Original copy: https://github.com/scalar/scalar/blob/main/packages/openapi-types/src/openapi-types.ts
|
|
3
3
|
* - Removed Record<string, unknown> fallbacks
|
|
4
4
|
*/
|
|
5
|
-
declare namespace OpenAPI {
|
|
5
|
+
export declare namespace OpenAPI {
|
|
6
6
|
type Document<T = {}> = OpenAPIV2.Document<T> | OpenAPIV3.Document<T> | OpenAPIV3_1.Document<T> | OpenAPIV3_2.Document<T>;
|
|
7
7
|
type Operation<T = {}> = OpenAPIV2.OperationObject<T> | OpenAPIV3.OperationObject<T> | OpenAPIV3_1.OperationObject<T> | OpenAPIV3_2.OperationObject<T>;
|
|
8
8
|
type Request = {
|
|
@@ -19,7 +19,7 @@ declare namespace OpenAPI {
|
|
|
19
19
|
type SchemaObject = OpenAPIV2.SchemaObject | OpenAPIV3.SchemaObject | OpenAPIV3_1.SchemaObject | OpenAPIV3_2.SchemaObject;
|
|
20
20
|
type HttpMethod = OpenAPIV2.HttpMethods | OpenAPIV3.HttpMethods | OpenAPIV3_1.HttpMethods | OpenAPIV3_2.HttpMethods;
|
|
21
21
|
}
|
|
22
|
-
declare namespace OpenAPIV3_2 {
|
|
22
|
+
export declare namespace OpenAPIV3_2 {
|
|
23
23
|
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
24
24
|
type PathsWebhooksComponents<T = {}> = {
|
|
25
25
|
paths?: PathsObject<T>;
|
|
@@ -181,7 +181,7 @@ declare namespace OpenAPIV3_2 {
|
|
|
181
181
|
kind?: string;
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
declare namespace OpenAPIV3_1 {
|
|
184
|
+
export declare namespace OpenAPIV3_1 {
|
|
185
185
|
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
186
186
|
type PathsWebhooksComponents<T = {}> = {
|
|
187
187
|
paths?: PathsObject<T>;
|
|
@@ -337,7 +337,7 @@ declare namespace OpenAPIV3_1 {
|
|
|
337
337
|
type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
|
|
338
338
|
type TagObject = OpenAPIV3.TagObject;
|
|
339
339
|
}
|
|
340
|
-
declare namespace OpenAPIV3 {
|
|
340
|
+
export declare namespace OpenAPIV3 {
|
|
341
341
|
type Document<T = {}> = {
|
|
342
342
|
/**
|
|
343
343
|
* Version of the OpenAPI specification
|
|
@@ -642,7 +642,7 @@ declare namespace OpenAPIV3 {
|
|
|
642
642
|
externalDocs?: ExternalDocumentationObject;
|
|
643
643
|
};
|
|
644
644
|
}
|
|
645
|
-
declare namespace OpenAPIV2 {
|
|
645
|
+
export declare namespace OpenAPIV2 {
|
|
646
646
|
type Document<T = {}> = {
|
|
647
647
|
/**
|
|
648
648
|
* Version of the OpenAPI specification
|
|
@@ -851,7 +851,7 @@ declare namespace OpenAPIV2 {
|
|
|
851
851
|
url?: string;
|
|
852
852
|
};
|
|
853
853
|
}
|
|
854
|
-
type IJsonSchema = {
|
|
854
|
+
export type IJsonSchema = {
|
|
855
855
|
id?: string;
|
|
856
856
|
$schema?: string;
|
|
857
857
|
title?: string;
|
|
@@ -893,5 +893,4 @@ type IJsonSchema = {
|
|
|
893
893
|
not?: IJsonSchema;
|
|
894
894
|
$ref?: string;
|
|
895
895
|
};
|
|
896
|
-
//#endregion
|
|
897
|
-
export { IJsonSchema, OpenAPI, OpenAPIV2, OpenAPIV3, OpenAPIV3_1, OpenAPIV3_2 };
|
|
896
|
+
//#endregion
|
package/dist/types.d.ts
CHANGED
|
@@ -6,28 +6,28 @@ import { OpenAPIOptions } from "./server/index.js";
|
|
|
6
6
|
import { FC, ReactNode } from "react";
|
|
7
7
|
import { SchemaUIOptions } from "@fumadocs/api-docs/components/schema";
|
|
8
8
|
//#region src/types.d.ts
|
|
9
|
-
type Document = OpenAPIV3_2.Document;
|
|
10
|
-
type OperationObject = OpenAPIV3_2.OperationObject & {
|
|
9
|
+
export type Document = OpenAPIV3_2.Document;
|
|
10
|
+
export type OperationObject = OpenAPIV3_2.OperationObject & {
|
|
11
11
|
'x-codeSamples'?: InlineCodeUsageGenerator[];
|
|
12
12
|
'x-selectedCodeSample'?: string;
|
|
13
13
|
'x-exclusiveCodeSample'?: string;
|
|
14
14
|
};
|
|
15
|
-
type ParameterObject = OpenAPIV3_2.ParameterObject;
|
|
16
|
-
type SecuritySchemeObject = OpenAPIV3_2.SecuritySchemeObject;
|
|
17
|
-
type ReferenceObject = OpenAPIV3_2.ReferenceObject;
|
|
18
|
-
type PathItemObject = OpenAPIV3_2.PathItemObject;
|
|
19
|
-
type TagObject = OpenAPIV3_2.TagObject;
|
|
20
|
-
type ServerObject = OpenAPIV3_2.ServerObject;
|
|
21
|
-
type CallbackObject = OpenAPIV3_2.CallbackObject;
|
|
22
|
-
type ServerVariableObject = OpenAPIV3.ServerVariableObject;
|
|
23
|
-
type ResponseObject = OpenAPIV3_2.ResponseObject;
|
|
24
|
-
type OAuth2SecurityScheme = OpenAPIV3_2.OAuth2SecurityScheme;
|
|
25
|
-
type HttpMethods = OpenAPIV3_2.HttpMethods;
|
|
26
|
-
type ExampleObject = OpenAPIV3_2.ExampleObject;
|
|
27
|
-
type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
|
|
28
|
-
type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
|
|
15
|
+
export type ParameterObject = OpenAPIV3_2.ParameterObject;
|
|
16
|
+
export type SecuritySchemeObject = OpenAPIV3_2.SecuritySchemeObject;
|
|
17
|
+
export type ReferenceObject = OpenAPIV3_2.ReferenceObject;
|
|
18
|
+
export type PathItemObject = OpenAPIV3_2.PathItemObject;
|
|
19
|
+
export type TagObject = OpenAPIV3_2.TagObject;
|
|
20
|
+
export type ServerObject = OpenAPIV3_2.ServerObject;
|
|
21
|
+
export type CallbackObject = OpenAPIV3_2.CallbackObject;
|
|
22
|
+
export type ServerVariableObject = OpenAPIV3.ServerVariableObject;
|
|
23
|
+
export type ResponseObject = OpenAPIV3_2.ResponseObject;
|
|
24
|
+
export type OAuth2SecurityScheme = OpenAPIV3_2.OAuth2SecurityScheme;
|
|
25
|
+
export type HttpMethods = OpenAPIV3_2.HttpMethods;
|
|
26
|
+
export type ExampleObject = OpenAPIV3_2.ExampleObject;
|
|
27
|
+
export type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
|
|
28
|
+
export type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
|
|
29
29
|
type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
30
|
-
interface RenderContext extends Pick<OpenAPIOptions, 'proxyUrl'>, Omit<RequireKeys<CreateOpenAPIPageOptions, 'generateTypeScriptDefinitions' | 'mediaAdapters' | 'codeUsages' | 'shikiOptions' | 'shiki'>, 'schemaUI'> {
|
|
30
|
+
export interface RenderContext extends Pick<OpenAPIOptions, 'proxyUrl'>, Omit<RequireKeys<CreateOpenAPIPageOptions, 'generateTypeScriptDefinitions' | 'mediaAdapters' | 'codeUsages' | 'shikiOptions' | 'shiki'>, 'schemaUI'> {
|
|
31
31
|
/**
|
|
32
32
|
* dereferenced schema
|
|
33
33
|
*/
|
|
@@ -35,7 +35,6 @@ interface RenderContext extends Pick<OpenAPIOptions, 'proxyUrl'>, Omit<RequireKe
|
|
|
35
35
|
_default_processMarkdown: (md: string) => ReactNode;
|
|
36
36
|
SchemaUI: FC<Omit<SchemaUIOptions, 'renderMarkdown' | 'renderCodeblock'>>;
|
|
37
37
|
}
|
|
38
|
-
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
39
|
-
type Awaitable<T> = T | Promise<T>;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { Awaitable, CallbackObject, DistributiveOmit, Document, ExampleObject, HttpMethods, MediaTypeObject, OAuth2SecurityScheme, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, RequestBodyObject, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject };
|
|
38
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
39
|
+
export type Awaitable<T> = T | Promise<T>;
|
|
40
|
+
//#endregion
|
package/dist/ui/base.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { ShikiFactory } from "fumadocs-core/highlight/shiki";
|
|
|
5
5
|
/**
|
|
6
6
|
* Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
|
|
7
7
|
*/
|
|
8
|
-
declare function createOpenAPIPageBase({ shiki, shikiOptions, schemaUI: schemaUIOptions, codeUsages, generateTypeScriptDefinitions, ...options }: CreateOpenAPIPageOptions & {
|
|
8
|
+
export declare function createOpenAPIPageBase({ shiki, shikiOptions, schemaUI: schemaUIOptions, codeUsages, generateTypeScriptDefinitions, ...options }: CreateOpenAPIPageOptions & {
|
|
9
9
|
shiki: ShikiFactory;
|
|
10
10
|
}): FC<OpenAPIPageProps>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createOpenAPIPageBase };
|
|
11
|
+
//#endregion
|
|
@@ -7,12 +7,11 @@ interface ServerContextType {
|
|
|
7
7
|
setServer: (value: string) => void;
|
|
8
8
|
setServerVariables: (value: Record<string, string>) => void;
|
|
9
9
|
}
|
|
10
|
-
interface SelectedServer {
|
|
10
|
+
export interface SelectedServer {
|
|
11
11
|
url: string;
|
|
12
12
|
name?: string;
|
|
13
13
|
variables: Record<string, string>;
|
|
14
14
|
}
|
|
15
|
-
declare function useRenderContext(): RenderContext;
|
|
16
|
-
declare function useServerContext(): ServerContextType;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { SelectedServer, useRenderContext, useServerContext };
|
|
15
|
+
export declare function useRenderContext(): RenderContext;
|
|
16
|
+
export declare function useServerContext(): ServerContextType;
|
|
17
|
+
//#endregion
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CreateOpenAPIPageOptions, OpenAPIPageProps, createOpenAPIPage } from "./index.js";
|
|
2
2
|
//#region src/ui/create-client.d.ts
|
|
3
3
|
/** @deprecated Use `CreateOpenAPIPageOptions` insteawd */
|
|
4
|
-
type CreateClientAPIPageOptions = CreateOpenAPIPageOptions;
|
|
4
|
+
export type CreateClientAPIPageOptions = CreateOpenAPIPageOptions;
|
|
5
5
|
/** @deprecated Use `OpenAPIPageProps` instead */
|
|
6
|
-
type ClientApiPageProps = OpenAPIPageProps;
|
|
6
|
+
export type ClientApiPageProps = OpenAPIPageProps;
|
|
7
7
|
/** @deprecated use `createOpenAPIPage()` from `fumadocs-openapi/ui` instead */
|
|
8
|
-
declare const createClientAPIPage: typeof createOpenAPIPage;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { ClientApiPageProps, CreateClientAPIPageOptions, createClientAPIPage };
|
|
8
|
+
export declare const createClientAPIPage: typeof createOpenAPIPage;
|
|
9
|
+
//#endregion
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -14,20 +14,20 @@ import { SchemaUIOptions } from "@fumadocs/api-docs/components/schema";
|
|
|
14
14
|
import { ShikiFactory } from "fumadocs-core/highlight/shiki";
|
|
15
15
|
import { BundledTheme, CodeOptionsThemes, CodeToHastOptionsCommon } from "shiki";
|
|
16
16
|
//#region src/ui/index.d.ts
|
|
17
|
-
interface GenerateTypeScriptDefinitionsContext {
|
|
17
|
+
export interface GenerateTypeScriptDefinitionsContext {
|
|
18
18
|
name: string;
|
|
19
19
|
readOnly: boolean;
|
|
20
20
|
writeOnly: boolean;
|
|
21
21
|
ctx: RenderContext;
|
|
22
22
|
}
|
|
23
|
-
interface APIPlaygroundProps {
|
|
23
|
+
export interface APIPlaygroundProps {
|
|
24
24
|
path: string;
|
|
25
25
|
method: HttpMethods;
|
|
26
26
|
operation: OperationObject;
|
|
27
27
|
pathItem: PathItemObject;
|
|
28
28
|
ctx: RenderContext;
|
|
29
29
|
}
|
|
30
|
-
interface CreateOpenAPIPageOptions {
|
|
30
|
+
export interface CreateOpenAPIPageOptions {
|
|
31
31
|
/**
|
|
32
32
|
* Generate TypeScript definitions from JSON schema.
|
|
33
33
|
*
|
|
@@ -42,6 +42,7 @@ interface CreateOpenAPIPageOptions {
|
|
|
42
42
|
* Generate example code usage for each endpoint.
|
|
43
43
|
*/
|
|
44
44
|
generateCodeSamples?: (options: {
|
|
45
|
+
path: string;
|
|
45
46
|
operation: OperationObject;
|
|
46
47
|
method: HttpMethods;
|
|
47
48
|
pathItem: PathItemObject;
|
|
@@ -97,6 +98,7 @@ interface CreateOpenAPIPageOptions {
|
|
|
97
98
|
responses: ReactNode;
|
|
98
99
|
callbacks: ReactNode;
|
|
99
100
|
}, context: {
|
|
101
|
+
path: string;
|
|
100
102
|
operation: OperationObject;
|
|
101
103
|
method: HttpMethods;
|
|
102
104
|
pathItem: PathItemObject;
|
|
@@ -182,14 +184,14 @@ interface CreateOpenAPIPageOptions {
|
|
|
182
184
|
/** @deprecated use `components.Markdown` instead */
|
|
183
185
|
renderMarkdown?: (md: string) => ReactNode;
|
|
184
186
|
}
|
|
185
|
-
type OpenAPIPageProps = OpenAPIPageProps_Spec | OpenAPIPageProps_Preloaded;
|
|
186
|
-
type OpenAPIPageProps_Spec = Omit<GeneratedPageProps, 'document'> & {
|
|
187
|
+
export type OpenAPIPageProps = OpenAPIPageProps_Spec | OpenAPIPageProps_Preloaded;
|
|
188
|
+
export type OpenAPIPageProps_Spec = Omit<GeneratedPageProps, 'document'> & {
|
|
187
189
|
payload: {
|
|
188
190
|
bundled: Document;
|
|
189
191
|
proxyUrl?: string;
|
|
190
192
|
};
|
|
191
193
|
};
|
|
192
|
-
type OpenAPIPageProps_Preloaded = GeneratedPageProps & {
|
|
194
|
+
export type OpenAPIPageProps_Preloaded = GeneratedPageProps & {
|
|
193
195
|
preloaded: {
|
|
194
196
|
docs: Record<string, Document>;
|
|
195
197
|
proxyUrl?: string;
|
|
@@ -198,8 +200,8 @@ type OpenAPIPageProps_Preloaded = GeneratedPageProps & {
|
|
|
198
200
|
/**
|
|
199
201
|
* Create `<OpenAPIPage />` (a client component).
|
|
200
202
|
*/
|
|
201
|
-
declare function createOpenAPIPage(options?: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
203
|
+
export declare function createOpenAPIPage(options?: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
202
204
|
/** @deprecated Use `OpenAPIPageProps` instead */
|
|
203
|
-
type ApiPageProps = OpenAPIPageProps;
|
|
205
|
+
export type ApiPageProps = OpenAPIPageProps;
|
|
204
206
|
//#endregion
|
|
205
|
-
export {
|
|
207
|
+
export { type OperationItem, type WebhookItem, useOperationContext, useRenderContext, useServerContext };
|
|
@@ -2,8 +2,8 @@ import { RawRequestData, RequestData } from "../../requests/types.js";
|
|
|
2
2
|
import { ExampleRequestItem } from "../../utils/get-example-requests.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
//#region src/ui/operation/context.d.ts
|
|
5
|
-
type ExampleUpdateListener = (data: RawRequestData, encoded: RequestData) => void;
|
|
6
|
-
declare function useOperationContext(): {
|
|
5
|
+
export type ExampleUpdateListener = (data: RawRequestData, encoded: RequestData) => void;
|
|
6
|
+
export declare function useOperationContext(): {
|
|
7
7
|
route: string;
|
|
8
8
|
examples: ExampleRequestItem[];
|
|
9
9
|
example: string | undefined;
|
|
@@ -12,5 +12,4 @@ declare function useOperationContext(): {
|
|
|
12
12
|
addListener: (listener: ExampleUpdateListener) => void;
|
|
13
13
|
removeListener: (listener: ExampleUpdateListener) => void;
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ExampleUpdateListener, useOperationContext };
|
|
15
|
+
//#endregion
|
|
@@ -331,11 +331,13 @@ function Operation({ type = "operation", path, operation, pathItem, method, show
|
|
|
331
331
|
responses: responseNode,
|
|
332
332
|
apiPlayground,
|
|
333
333
|
apiExample: /* @__PURE__ */ jsx(UsageTabs, {
|
|
334
|
+
path,
|
|
334
335
|
method,
|
|
335
336
|
operation,
|
|
336
337
|
pathItem
|
|
337
338
|
})
|
|
338
339
|
}, {
|
|
340
|
+
path,
|
|
339
341
|
operation,
|
|
340
342
|
method,
|
|
341
343
|
pathItem,
|
|
@@ -2,12 +2,11 @@ import { ExampleRequestItem } from "../../utils/get-example-requests.js";
|
|
|
2
2
|
import { HttpMethods, OperationObject, PathItemObject } from "../../types.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
//#region src/ui/operation/request-tabs.d.ts
|
|
5
|
-
interface RequestTabsRenderOptions {
|
|
5
|
+
export interface RequestTabsRenderOptions {
|
|
6
6
|
route: string;
|
|
7
7
|
items: ExampleRequestItem[];
|
|
8
8
|
method: HttpMethods;
|
|
9
9
|
pathItem: PathItemObject;
|
|
10
10
|
operation: OperationObject;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { RequestTabsRenderOptions };
|
|
12
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResponseObject } from "../../types.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
//#region src/ui/operation/response-tabs.d.ts
|
|
4
|
-
interface ResponseTab {
|
|
4
|
+
export interface ResponseTab {
|
|
5
5
|
/**
|
|
6
6
|
* HTTP response code
|
|
7
7
|
*/
|
|
@@ -24,8 +24,7 @@ interface ResponseExample {
|
|
|
24
24
|
*/
|
|
25
25
|
description?: string;
|
|
26
26
|
}
|
|
27
|
-
interface ResponseTabsRenderOptions {
|
|
27
|
+
export interface ResponseTabsRenderOptions {
|
|
28
28
|
tabs: ResponseTab[];
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { ResponseTab, ResponseTabsRenderOptions };
|
|
30
|
+
//#endregion
|
|
@@ -10,7 +10,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
|
|
10
10
|
import { joinURL, resolveServerUrl } from "@fumadocs/api-docs/utils/url";
|
|
11
11
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "fumadocs-ui/components/codeblock";
|
|
12
12
|
//#region src/ui/operation/usage-tabs.tsx
|
|
13
|
-
function UsageTabs({ method, operation, pathItem }) {
|
|
13
|
+
function UsageTabs({ path, method, operation, pathItem }) {
|
|
14
14
|
const ctx = useRenderContext();
|
|
15
15
|
let { renderAPIExampleUsageTabs, renderAPIExampleLayout } = ctx.content ?? {};
|
|
16
16
|
renderAPIExampleLayout ??= (slots) => {
|
|
@@ -44,6 +44,7 @@ function UsageTabs({ method, operation, pathItem }) {
|
|
|
44
44
|
const registry = useMemo(() => {
|
|
45
45
|
const registry = createCodeUsageGeneratorRegistry(ctx.codeUsages);
|
|
46
46
|
if (ctx.generateCodeSamples) for (const gen of ctx.generateCodeSamples({
|
|
47
|
+
path,
|
|
47
48
|
operation,
|
|
48
49
|
method,
|
|
49
50
|
pathItem
|
|
@@ -52,6 +53,7 @@ function UsageTabs({ method, operation, pathItem }) {
|
|
|
52
53
|
return registry;
|
|
53
54
|
}, [
|
|
54
55
|
ctx,
|
|
56
|
+
path,
|
|
55
57
|
operation,
|
|
56
58
|
method,
|
|
57
59
|
pathItem
|
|
@@ -59,11 +61,7 @@ function UsageTabs({ method, operation, pathItem }) {
|
|
|
59
61
|
return renderAPIExampleLayout({
|
|
60
62
|
selector: operation["x-exclusiveCodeSample"] ? null : /* @__PURE__ */ jsx(UsageTabsSelector, {}),
|
|
61
63
|
usageTabs: renderAPIExampleUsageTabs(registry, ctx),
|
|
62
|
-
responseTabs: /* @__PURE__ */ jsx(ResponseTabs, {
|
|
63
|
-
operation,
|
|
64
|
-
method,
|
|
65
|
-
pathItem
|
|
66
|
-
})
|
|
64
|
+
responseTabs: /* @__PURE__ */ jsx(ResponseTabs, { operation })
|
|
67
65
|
}, ctx);
|
|
68
66
|
}
|
|
69
67
|
function UsageTabsSelector() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Document } from "../../types.js";
|
|
2
2
|
import { NoReferenceSwallow } from "@fumadocs/api-docs/schema";
|
|
3
3
|
//#region src/utils/document/dereference.d.ts
|
|
4
|
-
interface DereferencedDocument {
|
|
4
|
+
export interface DereferencedDocument {
|
|
5
5
|
/**
|
|
6
6
|
* document wrapped in a magic proxy (`@scalar/json-magic`).
|
|
7
7
|
*
|
|
@@ -16,5 +16,4 @@ interface DereferencedDocument {
|
|
|
16
16
|
resolve: <T>(node: T) => NoReferenceSwallow<T>;
|
|
17
17
|
bundled: Document;
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { DereferencedDocument };
|
|
19
|
+
//#endregion
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { RawRequestData, RequestData } from "../requests/types.js";
|
|
2
2
|
import "../types.js";
|
|
3
3
|
//#region src/utils/get-example-requests.d.ts
|
|
4
|
-
interface ExampleRequestItem {
|
|
4
|
+
export interface ExampleRequestItem {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
data: RawRequestData;
|
|
9
9
|
encoded: RequestData;
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { ExampleRequestItem };
|
|
11
|
+
//#endregion
|
|
@@ -10,35 +10,35 @@ interface BaseEntry {
|
|
|
10
10
|
deprecated?: boolean;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
interface OperationOutput extends BaseEntry {
|
|
13
|
+
export interface OperationOutput extends BaseEntry {
|
|
14
14
|
type: 'operation';
|
|
15
15
|
item: OperationItem;
|
|
16
16
|
}
|
|
17
|
-
interface WebhookOutput extends BaseEntry {
|
|
17
|
+
export interface WebhookOutput extends BaseEntry {
|
|
18
18
|
type: 'webhook';
|
|
19
19
|
item: WebhookItem;
|
|
20
20
|
}
|
|
21
|
-
interface PageOutput extends BaseEntry {
|
|
21
|
+
export interface PageOutput extends BaseEntry {
|
|
22
22
|
type: 'page';
|
|
23
23
|
operations: OperationItem[];
|
|
24
24
|
webhooks: WebhookItem[];
|
|
25
25
|
/** tag info if the page is generated from a tag. */
|
|
26
26
|
tag?: TagObject;
|
|
27
27
|
}
|
|
28
|
-
interface OutputGroup extends BaseEntry {
|
|
28
|
+
export interface OutputGroup extends BaseEntry {
|
|
29
29
|
type: 'group';
|
|
30
30
|
entries: OutputEntry[];
|
|
31
31
|
/** tag info if the group is generated from a tag. */
|
|
32
32
|
tag?: TagObject;
|
|
33
33
|
}
|
|
34
|
-
interface WebhookItem {
|
|
34
|
+
export interface WebhookItem {
|
|
35
35
|
/**
|
|
36
36
|
* webhook name in `webhooks`
|
|
37
37
|
*/
|
|
38
38
|
name: string;
|
|
39
39
|
method: HttpMethods;
|
|
40
40
|
}
|
|
41
|
-
interface OperationItem {
|
|
41
|
+
export interface OperationItem {
|
|
42
42
|
/**
|
|
43
43
|
* the path of operation in `paths`
|
|
44
44
|
*/
|
|
@@ -48,11 +48,11 @@ interface OperationItem {
|
|
|
48
48
|
*/
|
|
49
49
|
method: HttpMethods;
|
|
50
50
|
}
|
|
51
|
-
type OutputEntry = PageOutput | OperationOutput | WebhookOutput | OutputGroup;
|
|
52
|
-
interface PagesBuilderConfig {
|
|
51
|
+
export type OutputEntry = PageOutput | OperationOutput | WebhookOutput | OutputGroup;
|
|
52
|
+
export interface PagesBuilderConfig {
|
|
53
53
|
toPages: (builder: PagesBuilder) => void;
|
|
54
54
|
}
|
|
55
|
-
interface PagesBuilder {
|
|
55
|
+
export interface PagesBuilder {
|
|
56
56
|
/**
|
|
57
57
|
* the input ID in OpenAPI server
|
|
58
58
|
*/
|
|
@@ -98,7 +98,7 @@ interface ExtractedInfo {
|
|
|
98
98
|
tags?: string[];
|
|
99
99
|
})[];
|
|
100
100
|
}
|
|
101
|
-
interface GeneratedPageProps {
|
|
101
|
+
export interface GeneratedPageProps {
|
|
102
102
|
/** schema ID */
|
|
103
103
|
document: string;
|
|
104
104
|
showTitle?: boolean;
|
|
@@ -109,5 +109,4 @@ interface GeneratedPageProps {
|
|
|
109
109
|
operations?: OperationItem[];
|
|
110
110
|
webhooks?: WebhookItem[];
|
|
111
111
|
}
|
|
112
|
-
//#endregion
|
|
113
|
-
export { GeneratedPageProps, OperationItem, OperationOutput, OutputEntry, OutputGroup, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookItem, WebhookOutput };
|
|
112
|
+
//#endregion
|
|
@@ -41,7 +41,7 @@ interface SchemaConfig extends BaseConfig {
|
|
|
41
41
|
*/
|
|
42
42
|
name?: NameFn<PageOutput> | NameFnOptions;
|
|
43
43
|
}
|
|
44
|
-
type SchemaToPagesOptions = SchemaConfig | TagConfig | OperationConfig | ({
|
|
44
|
+
export type SchemaToPagesOptions = SchemaConfig | TagConfig | OperationConfig | ({
|
|
45
45
|
per: 'custom';
|
|
46
46
|
} & PagesBuilderConfig);
|
|
47
47
|
type NameFn<Entry extends OperationOutput | WebhookOutput | PageOutput = OperationOutput | WebhookOutput | PageOutput> = (this: PagesBuilder, output: DistributiveOmit<Entry, 'path'>) => string;
|
|
@@ -64,5 +64,4 @@ interface BaseConfig {
|
|
|
64
64
|
*/
|
|
65
65
|
slugify?: (name: string) => string;
|
|
66
66
|
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { SchemaToPagesOptions };
|
|
67
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./builder.js";
|
|
2
2
|
import { TagObject } from "../../types.js";
|
|
3
3
|
//#region src/utils/pages/to-text.d.ts
|
|
4
|
-
interface PagesToTextOptions {
|
|
4
|
+
export interface PagesToTextOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Additional imports of your MDX components.
|
|
7
7
|
*/
|
|
@@ -33,7 +33,7 @@ interface PagesToTextOptions {
|
|
|
33
33
|
*/
|
|
34
34
|
addGeneratedComment?: boolean | string;
|
|
35
35
|
}
|
|
36
|
-
type DocumentContext = {
|
|
36
|
+
export type DocumentContext = {
|
|
37
37
|
type: 'tag';
|
|
38
38
|
tag: TagObject;
|
|
39
39
|
} | {
|
|
@@ -41,5 +41,4 @@ type DocumentContext = {
|
|
|
41
41
|
} | {
|
|
42
42
|
type: 'file';
|
|
43
43
|
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { DocumentContext, PagesToTextOptions };
|
|
44
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.2",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@fuma-translate/react": "^1.0.2",
|
|
47
47
|
"@fumari/json-schema-ts": "^1.0.2",
|
|
48
|
-
"@scalar/json-magic": "^0.13.
|
|
48
|
+
"@scalar/json-magic": "^0.13.4",
|
|
49
49
|
"chokidar": "^5.0.0",
|
|
50
50
|
"class-variance-authority": "^0.7.1",
|
|
51
|
-
"cn": "^0.2.
|
|
51
|
+
"cn": "^0.2.6",
|
|
52
52
|
"github-slugger": "^2.0.0",
|
|
53
53
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
54
|
-
"lucide-react": "^1.
|
|
54
|
+
"lucide-react": "^1.43.0",
|
|
55
55
|
"remark": "^15.0.1",
|
|
56
56
|
"remark-rehype": "^11.1.2",
|
|
57
57
|
"shiki": "^4.4.3",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"@fumari/stf": "1.1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@scalar/api-client-react": "^2.0.
|
|
63
|
+
"@scalar/api-client-react": "^2.0.44",
|
|
64
64
|
"@scalar/openapi-upgrader": "^0.2.15",
|
|
65
65
|
"@tailwindcss/oxide": "^4.3.3",
|
|
66
|
-
"@types/node": "26.
|
|
66
|
+
"@types/node": "26.5.0",
|
|
67
67
|
"@types/react": "^19.2.18",
|
|
68
68
|
"fast-content-type-parse": "^4.0.0",
|
|
69
69
|
"fuma-cli": "^0.1.1",
|
|
70
70
|
"json-schema-typed": "^8.0.2",
|
|
71
|
-
"tsdown": "0.
|
|
71
|
+
"tsdown": "0.23.0",
|
|
72
72
|
"xml-js": "^1.6.11",
|
|
73
|
-
"fumadocs-core": "16.15.
|
|
74
|
-
"fumadocs-ui": "npm:@fumadocs/base-ui@16.15.
|
|
73
|
+
"fumadocs-core": "16.15.9",
|
|
74
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@16.15.9",
|
|
75
75
|
"tsconfig": "0.0.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|