api-morph
Version:
A modern TypeScript-first OpenAPI document generator that analyzes your code and JSDoc comments to automatically generate comprehensive and accurate API documentation.
48 lines • 1.31 kB
TypeScript
//#region src/core/swagger.d.ts
/**
* generateSwaggerUI 的选项配置
*
* @category Core
*/
interface GenerateSwaggerUIHTMLOptions {
/** Swagger JSON 文件的 URL 路径,默认为 '/openapi.json' */
url?: string;
/** HTML 页面标题,默认为 'Swagger UI' */
title?: string;
/** 自定义 CSS 样式 */
customCss?: string;
/** 自定义 JavaScript 代码 */
customJs?: string;
/** If set to true, it persists authorization data and it would not be lost on browser close/refresh。默认为 false */
persistAuthorization?: boolean;
}
/**
* Swagger UI 静态资源路径
*
* @category Core
*/
interface SwaggerUIAssetPaths {
indexCss: string;
css: string;
bundleJs: string;
standalonePresetJs: string;
favicon32: string;
favicon16: string;
}
/**
* 获取 Swagger UI 静态资源目录。
* @returns Swagger UI 静态资源目录。
*
* @category Core
*/
declare function getSwaggerUIAssetDir(): string;
/**
* 生成 Swagger UI 的 HTML 字符串。
* @param options 选项。
* @returns 完整的 Swagger UI HTML 字符串。
*
* @category Core
*/
declare function generateSwaggerUIHTML(options?: GenerateSwaggerUIHTMLOptions): string;
//#endregion
export { GenerateSwaggerUIHTMLOptions, SwaggerUIAssetPaths, generateSwaggerUIHTML, getSwaggerUIAssetDir };