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
new DefaultRouteGenerator(metadata, options): DefaultRouteGenerator;Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:14
Parameters
metadata
Metadata
options
Returns
DefaultRouteGenerator
Overrides
AbstractRouteGenerator.constructor
Properties
metadata
protected readonly metadata: Metadata;Defined in: cli/src/routeGeneration/routeGenerator.ts:13
Inherited from
AbstractRouteGenerator.metadata
options
protected readonly options: ExtendedRoutesConfig;Defined in: cli/src/routeGeneration/routeGenerator.ts:14
Inherited from
AbstractRouteGenerator.options
pathTransformerFn
pathTransformerFn: (path) => string;Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:12
Parameters
path
string
Returns
string
template
template: string;Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:13
Methods
buildContent()
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()
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
authenticationModule: string | undefined;basePath
basePath: string = normalisedBasePath;canImportByAlias
canImportByAlias: boolean;controllers
controllers: object[];embeddedSpecGeneratorArtifacts
embeddedSpecGeneratorArtifacts:
| {
spec: Spec;
yaml: string;
}
| undefined;environment
environment: ProcessEnv = process.env;esm
esm: boolean | undefined;existingGetPaths
existingGetPaths: string[];iocModule
iocModule: string | undefined;minimalSwaggerConfig
minimalSwaggerConfig: object;minimalSwaggerConfig.bodyCoercion
bodyCoercion: boolean;minimalSwaggerConfig.noImplicitAdditionalProperties
noImplicitAdditionalProperties: "ignore" | "throw-on-extras" | "silently-remove-extras";models
models: Models;multerOpts
multerOpts: Options | undefined;runtimeSpecConfig
runtimeSpecConfig:
| {
compilerOptions?: Record<string, unknown>;
defaultNumberType?: "double" | "float" | "integer" | "long";
ignore?: string[];
metadata: Metadata;
spec: SpecConfig & object;
}
| undefined;useFileUploads
useFileUploads: boolean;useSecurity
useSecurity: boolean;useSpecPaths
useSpecPaths: boolean;Inherited from
AbstractRouteGenerator.buildContext
buildEmbeddedSpecGeneratorArtifacts()
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()
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()
protected buildParameterSchema(source): ParameterSchema;Defined in: cli/src/routeGeneration/routeGenerator.ts:199
Parameters
source
Parameter
Returns
ParameterSchema
Inherited from
AbstractRouteGenerator.buildParameterSchema
buildProperty()
protected buildProperty(type): PropertySchema;Defined in: cli/src/routeGeneration/routeGenerator.ts:219
Parameters
type
Type
Returns
PropertySchema
Inherited from
AbstractRouteGenerator.buildProperty
buildPropertySchema()
protected buildPropertySchema(source): PropertySchema;Defined in: cli/src/routeGeneration/routeGenerator.ts:188
Parameters
source
Property
Returns
PropertySchema
Inherited from
AbstractRouteGenerator.buildPropertySchema
GenerateCustomRoutes()
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()
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()
protected getRelativeImportPath(fileLocation): string;Defined in: cli/src/routeGeneration/routeGenerator.ts:176
Parameters
fileLocation
string
Returns
string
Inherited from
AbstractRouteGenerator.getRelativeImportPath
pathTransformer()
protected pathTransformer(path): string;Defined in: cli/src/routeGeneration/defaultRouteGenerator.ts:64
Parameters
path
string
Returns
string
Overrides
AbstractRouteGenerator.pathTransformer
shouldWriteFile()
protected shouldWriteFile(fileName, content): Promise<boolean>;Defined in: cli/src/routeGeneration/routeGenerator.ts:263
Parameters
fileName
string
content
string
Returns
Promise<boolean>
