Skip to content

tsoa-next / @tsoa-next/cli / DefaultRouteGenerator

Class: DefaultRouteGenerator

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:11

Default route generator for the built-in Express, Koa, and Hapi templates.

Extends

Constructors

Constructor

ts
new DefaultRouteGenerator(metadata, options): DefaultRouteGenerator;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:14

Parameters

metadata

Metadata

options

ExtendedRoutesConfig

Returns

DefaultRouteGenerator

Overrides

AbstractRouteGenerator.constructor

Properties

metadata

ts
protected readonly metadata: Metadata;

Defined in: cli/src/routeGeneration/routeGenerator.ts:13

Inherited from

AbstractRouteGenerator.metadata


options

ts
protected readonly options: ExtendedRoutesConfig;

Defined in: cli/src/routeGeneration/routeGenerator.ts:14

Inherited from

AbstractRouteGenerator.options


pathTransformerFn

ts
pathTransformerFn: (path) => string;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:12

Parameters

path

string

Returns

string


template

ts
template: string;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:13

Methods

buildContent()

ts
buildContent(middlewareTemplate): string;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:69

Renders the route template with the current metadata context.

Parameters

middlewareTemplate

string

Returns

string


buildContext()

ts
protected buildContext(): object;

Defined in: cli/src/routeGeneration/routeGenerator.ts:76

Builds the Handlebars template context used by the default route templates.

Returns

object

authenticationModule
ts
authenticationModule: string | undefined;
basePath
ts
basePath: string = normalisedBasePath;
canImportByAlias
ts
canImportByAlias: boolean;
controllers
ts
controllers: object[];
embeddedSpecGeneratorArtifacts
ts
embeddedSpecGeneratorArtifacts: 
  | {
  spec: Spec;
  yaml: string;
}
  | undefined;
environment
ts
environment: ProcessEnv = process.env;
esm
ts
esm: boolean | undefined;
existingGetPaths
ts
existingGetPaths: string[];
iocModule
ts
iocModule: string | undefined;
minimalSwaggerConfig
ts
minimalSwaggerConfig: object;
minimalSwaggerConfig.bodyCoercion
ts
bodyCoercion: boolean;
minimalSwaggerConfig.noImplicitAdditionalProperties
ts
noImplicitAdditionalProperties: "ignore" | "throw-on-extras" | "silently-remove-extras";
models
ts
models: Models;
multerOpts
ts
multerOpts: Options | undefined;
runtimeSpecConfig
ts
runtimeSpecConfig: 
  | {
  compilerOptions?: Record<string, unknown>;
  defaultNumberType?: "double" | "float" | "integer" | "long";
  ignore?: string[];
  metadata: Metadata;
  spec: SpecConfig & object;
}
  | undefined;
useFileUploads
ts
useFileUploads: boolean;
useSecurity
ts
useSecurity: boolean;
useSpecPaths
ts
useSpecPaths: boolean;

Inherited from

AbstractRouteGenerator.buildContext


buildEmbeddedSpecGeneratorArtifacts()

ts
protected buildEmbeddedSpecGeneratorArtifacts(useSpecPaths): 
  | {
  spec: Spec;
  yaml: string;
}
  | undefined;

Defined in: cli/src/routeGeneration/routeGenerator.ts:157

Parameters

useSpecPaths

boolean

Returns

| { spec: Spec; yaml: string; } | undefined

Inherited from

AbstractRouteGenerator.buildEmbeddedSpecGeneratorArtifacts


buildModels()

ts
buildModels(): Models;

Defined in: cli/src/routeGeneration/routeGenerator.ts:23

Builds the runtime model metadata consumed by generated route handlers.

Returns

Models

Inherited from

AbstractRouteGenerator.buildModels


buildParameterSchema()

ts
protected buildParameterSchema(source): ParameterSchema;

Defined in: cli/src/routeGeneration/routeGenerator.ts:199

Parameters

source

Parameter

Returns

ParameterSchema

Inherited from

AbstractRouteGenerator.buildParameterSchema


buildProperty()

ts
protected buildProperty(type): PropertySchema;

Defined in: cli/src/routeGeneration/routeGenerator.ts:219

Parameters

type

Type

Returns

PropertySchema

Inherited from

AbstractRouteGenerator.buildProperty


buildPropertySchema()

ts
protected buildPropertySchema(source): PropertySchema;

Defined in: cli/src/routeGeneration/routeGenerator.ts:188

Parameters

source

Property

Returns

PropertySchema

Inherited from

AbstractRouteGenerator.buildPropertySchema


GenerateCustomRoutes()

ts
GenerateCustomRoutes(): Promise<void>;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:37

Loads the selected template file and generates the route output.

Returns

Promise<void>

Overrides

AbstractRouteGenerator.GenerateCustomRoutes


GenerateRoutes()

ts
GenerateRoutes(middlewareTemplate): Promise<void>;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:44

Writes the generated route file to disk.

Parameters

middlewareTemplate

string

Returns

Promise<void>


getRelativeImportPath()

ts
protected getRelativeImportPath(fileLocation): string;

Defined in: cli/src/routeGeneration/routeGenerator.ts:176

Parameters

fileLocation

string

Returns

string

Inherited from

AbstractRouteGenerator.getRelativeImportPath


pathTransformer()

ts
protected pathTransformer(path): string;

Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:64

Parameters

path

string

Returns

string

Overrides

AbstractRouteGenerator.pathTransformer


shouldWriteFile()

ts
protected shouldWriteFile(fileName, content): Promise<boolean>;

Defined in: cli/src/routeGeneration/routeGenerator.ts:263

Parameters

fileName

string

content

string

Returns

Promise<boolean>

Inherited from

AbstractRouteGenerator.shouldWriteFile

TypeScript-first OpenAPI generation, route generation, and runtime validation.