UNPKG

fumadocs-openapi

Version:

Generate MDX docs for your OpenAPI spec

37 lines (35 loc) 1.31 kB
import { createProxy } from "./proxy.js"; import { CodeUsageGenerator } from "../ui/operation/usage-tabs/index.js"; import { ProcessedDocument } from "../utils/process-document.js"; import { OpenAPIV3, OpenAPIV3_1 } from "openapi-types"; //#region src/server/create.d.ts /** * schema id -> file path, URL, or downloaded schema object */ type SchemaMap = Record<string, string | OpenAPIV3_1.Document | OpenAPIV3.Document>; type ProcessedSchemaMap = Record<string, ProcessedDocument>; interface OpenAPIOptions { /** * Schema files, can be: * - URL * - file path * - a function returning records of downloaded schemas. */ input?: string[] | (() => SchemaMap | Promise<SchemaMap>); disableCache?: boolean; /** * The url of proxy to avoid CORS issues */ proxyUrl?: string; } interface OpenAPIServer { createProxy: typeof createProxy; getSchemas: () => Promise<ProcessedSchemaMap>; getSchema: (document: string) => Promise<ProcessedDocument>; readonly options: OpenAPIOptions; } declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer; declare function createCodeSample<T>(options: Partial<CodeUsageGenerator<T>>): CodeUsageGenerator; //#endregion export { OpenAPIOptions, OpenAPIServer, createCodeSample, createOpenAPI }; //# sourceMappingURL=create.d.ts.map