UNPKG

fumadocs-openapi

Version:

Generate MDX docs for your OpenAPI spec

69 lines 2.38 kB
import type { OperationItem, WebhookItem } from './render/api-page.js'; import type { ProcessedDocument } from './utils/process-document.js'; import type { TagObject } from './types.js'; export interface GenerateOptions { /** * Additional imports of your MDX components. */ imports?: { names: string[]; from: string; }[]; /** * Customise frontmatter. * * A `full: true` property will be added by default. */ frontmatter?: (title: string, description: string | undefined, context: DocumentContext) => Record<string, unknown>; /** * Add description to document body. * * We recommend but don't enable it by default because some OpenAPI schemas have invalid description that breaks MDX syntax. * * @defaultValue false */ includeDescription?: boolean; /** * Add a comment to the top of generated files indicating they are auto-generated. * - `true`: Adds a standardized comment * - `false`: No comment is added * - `string`: Adds the provided custom comment * * @defaultValue true */ addGeneratedComment?: boolean | string; cwd?: string; /** * Inline the entire OpenAPI document into the MDX file. * * @deprecated Use the new `input` API on `createOpenAPI()` instead. * @defaultValue false */ inlineDocument?: boolean; } export interface GenerateTagOutput { tag: string; content: string; } export type GeneratePageOutput = { type: 'operation'; item: OperationItem; content: string; } | { type: 'webhook'; item: WebhookItem; content: string; }; export declare function generateAll(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): string; export declare function generatePages(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): GeneratePageOutput[]; export declare function generateTags(schemaId: string, processed: ProcessedDocument, options?: GenerateOptions): GenerateTagOutput[]; export declare function generateDocument(frontmatter: unknown, content: string, options: Pick<GenerateOptions, 'addGeneratedComment' | 'imports'>): string; export type DocumentContext = { type: 'tag'; tag: TagObject | undefined; } | { type: 'operation'; } | { type: 'file'; }; //# sourceMappingURL=generate.d.ts.map