fumadocs-openapi 11.4.0 → 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/node_modules/.pnpm/fast-content-type-parse@4.0.0/node_modules/fast-content-type-parse/index.js +226 -0
- package/dist/playground/client.d.ts +10 -10
- package/dist/playground/components/result-display.d.ts +3 -4
- package/dist/playground/components/result-display.js +1 -1
- 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 +5 -6
- 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/cn.js +1 -1
- 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 +13 -13
- package/dist/node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js +0 -115
package/dist/server/proxy.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//#region src/server/proxy.d.ts
|
|
2
|
-
declare const methods: readonly [
|
|
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() {
|
package/dist/utils/cn.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "cn";
|
|
2
2
|
export { cn };
|
|
@@ -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,34 +45,34 @@
|
|
|
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
|
-
"
|
|
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",
|
|
58
58
|
"yaml": "^2.9.0",
|
|
59
|
-
"@fumadocs/api-docs": "0.2.
|
|
59
|
+
"@fumadocs/api-docs": "0.2.8",
|
|
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
|
-
"fast-content-type-parse": "^
|
|
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
|
-
"
|
|
75
|
-
"
|
|
73
|
+
"fumadocs-core": "16.15.9",
|
|
74
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@16.15.9",
|
|
75
|
+
"tsconfig": "0.0.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@scalar/api-client-react": "^2.0.20",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"inlinedDependencies": {
|
|
98
98
|
"@scalar/openapi-upgrader": "0.2.15",
|
|
99
|
-
"fast-content-type-parse": "
|
|
99
|
+
"fast-content-type-parse": "4.0.0",
|
|
100
100
|
"xml-js": "1.6.11"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|