koas-swagger-ui
Version:
Koas Swagger UI serves Swagger UI. This requires the `specURL` variable to have been set on the `ctx.openApi` object. Typically this is done by combining it with [`koas-spec-handler`][].
30 lines (29 loc) • 839 B
TypeScript
import 'koas-spec-handler';
import { Plugin } from 'koas-core';
import { SwaggerUIBundlePlugin } from './plugins';
import { SwaggerUIBundlePreset } from './presets';
export declare const SwaggerUIBundle: {
plugins: typeof SwaggerUIBundlePlugin;
presets: typeof SwaggerUIBundlePreset;
};
export interface SwaggerUIOptions {
/**
* The Swagger UI plugins to use.
*/
plugins?: SwaggerUIBundlePlugin[];
/**
* The Swagger UI presets to use.
*/
presets?: SwaggerUIBundlePreset[];
/**
* The URL from which to serve Swagger UI.
*/
url?: string;
}
/**
* Serve Swagger UI for the Koas API.
*
* @param options - The options for Swagger UI.
* @returns Koas middleware that servers Swagger UI
*/
export declare function swaggerUI({ plugins, presets, url, }?: SwaggerUIOptions): Plugin;