UNPKG

@namecheap/tsoa-cli

Version:

Build swagger-compliant REST APIs using TypeScript and Node

39 lines (38 loc) 1.98 kB
import { Config, Tsoa } from '@namecheap/tsoa-runtime'; import { type ClassDeclaration, type CompilerOptions, type TypeChecker } from 'typescript'; import { NodeDecoratorProcessor } from './types/nodeDecoratorProcessor'; import { SecurityGenerator } from './securityGenerator'; export interface MetadataGeneratorOptions { securityGenerator?: SecurityGenerator; customDecoratorProcessors?: Record<string, NodeDecoratorProcessor>; } export declare class MetadataGenerator { private readonly compilerOptions?; private readonly ignorePaths?; private readonly rootSecurity; readonly defaultNumberType: NonNullable<Config['defaultNumberType']>; readonly controllerNodes: ClassDeclaration[]; readonly typeChecker: TypeChecker; readonly securityGenerator: SecurityGenerator | undefined; readonly customDecoratorProcessors: Record<string, NodeDecoratorProcessor> | undefined; private readonly program; private referenceTypeMap; private modelDefinitionPosMap; private expressionOrigNameMap; constructor(entryFile: string, compilerOptions?: CompilerOptions | undefined, ignorePaths?: string[] | undefined, controllers?: string[], rootSecurity?: Tsoa.Security[], defaultNumberType?: NonNullable<Config['defaultNumberType']>, esm?: boolean, generatorOptions?: MetadataGeneratorOptions); Generate(): Tsoa.Metadata; private setProgramToDynamicControllersFiles; private resolveCompilerOptions; private extractNodeFromProgramSourceFiles; private checkForMethodSignatureDuplicates; private checkForPathParamSignatureDuplicates; TypeChecker(): TypeChecker; AddReferenceType(referenceType: Tsoa.ReferenceType): void; GetReferenceType(refName: string): Tsoa.ReferenceType; CheckModelUnicity(refName: string, positions: Array<{ fileName: string; pos: number; }>): void; CheckExpressionUnicity(formattedRefName: string, refName: string): void; private buildControllers; }