Skip to content

SwaggerSettingsBase

@tsed/swagger

Usage

typescript
import { SwaggerSettingsBase } from "@tsed/swagger";

See /packages/specs/swagger/src/types/interfaces/SwaggerSettings.ts.

Overview

ts
interface SwaggerSettingsBase {
    path: string;
    specVersion?: OpenSpecVersions;
    fileName?: string;
    hidden?: string;
    doc?: string;
    cssPath?: string;
    jsPath?: string;
    viewPath?: string | false;
    options?: SwaggerUIOptions;
    showExplorer?: boolean;
    specPath?: string;
    outFile?: string;
    sortPaths?: boolean;
    operationIdFormatter?: (name: string, propertyKey: string, path: string) => string;
    operationIdPattern?: string;
    disableSpec?: boolean;
    pathPatterns?: string[];
}

path

ts
path: string;

The url subpath to access to the documentation.

specVersion

ts
specVersion?: OpenSpecVersions;

Specify the spec version you want to generate.

fileName

ts
fileName?: string;

Swagger file name. By default swagger.json

hidden

ts
hidden?: string;

Hidden documentation. Use this to hide documentation link in the dropdown.

doc

ts
doc?: string;

The documentation key used by @Docs decorator to create several swagger documentations.

cssPath

ts
cssPath?: string;

The path to the CSS file.

jsPath

ts
jsPath?: string;

The path to the JS file.

viewPath

ts
viewPath?: string | false;

The path to the ejs file to create html page.

options

ts
options?: SwaggerUIOptions;

SwaggerUI options. See (https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md)

showExplorer

ts
showExplorer?: boolean;

Display the search field in the navbar.

specPath

ts
specPath?: string;

Load the base spec documentation from the specified path.

outFile

ts
outFile?: string;

Write the swagger.json spec documentation on the specified path.

sortPaths

ts
sortPaths?: boolean;

Sort paths by alphabetical order

operationIdFormatter:

ts
operationIdFormatter?: (name: string, propertyKey: string, path: string) => string;

A function to generate the operationId.

operationIdPattern

ts
operationIdPattern?: string;

A pattern to generate the operationId. Format of operationId field (%c: class name, %m: method name).

disableSpec

ts
disableSpec?: boolean;

pathPatterns

ts
pathPatterns?: string[];

Include only controllers whose paths match the pattern list provided.

Released under the MIT License.