UNPKG

@foal/swagger

Version:

Swagger UI for FoalTS

58 lines (57 loc) 1.94 kB
import { Class, Context, HttpResponseBadRequest, HttpResponseMovedPermanently, HttpResponseNotFound, HttpResponseOK, OpenApi } from '@foal/core'; /** * Serve Swagger UI to visualize and interact with API resources. * * @export * @abstract * @class SwaggerController */ export declare abstract class SwaggerController { openApi: OpenApi; /** * Specify the OpenAPI Specification(s) and their location(s). * * If a controller class is provided, then an OpenAPI Specification is generated * from its definition. * * @abstract * @type {({ url: string } | * { controllerClass: Class } | * ( * { name: string, url: string, primary?: boolean } | * { name: string, controllerClass: Class, primary?: boolean } * )[])} * @memberof SwaggerController */ abstract options: { url: string; } | { controllerClass: Class; } | ({ name: string; url: string; primary?: boolean; } | { name: string; controllerClass: Class; primary?: boolean; })[]; /** * Extend Swagger UI options. * * See https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/. * * @type {object} * @example * uiOptions = { docExpansion: 'none' }; * @memberof SwaggerController */ uiOptions: object; getOpenApiDefinition(ctx: Context): HttpResponseNotFound<any> | HttpResponseOK<import("@foal/core").IOpenAPI> | HttpResponseBadRequest<string>; index(ctx: Context): Promise<HttpResponseMovedPermanently | HttpResponseOK<string>>; main(ctx: Context): Promise<HttpResponseOK<string>>; swaggerUi(): Promise<HttpResponseOK<any>>; swaggerUiBundle(): Promise<HttpResponseOK<any>>; swaggerUiStandalonePreset(): Promise<HttpResponseOK<any>>; private createHttpResponseFile; }