@tsoa/runtime
Advanced tools
Comparing version 6.0.0-rc.0 to 6.0.0-rc.1
import { ExtensionType } from '../decorators/extension'; | ||
import type { Swagger } from '../swagger/swagger'; | ||
import { Validator } from '..'; | ||
export declare namespace Tsoa { | ||
interface Metadata { | ||
export interface Metadata { | ||
controllers: Controller[]; | ||
referenceTypeMap: ReferenceTypeMap; | ||
} | ||
interface Controller { | ||
export interface Controller { | ||
location: string; | ||
@@ -15,3 +16,3 @@ methods: Method[]; | ||
} | ||
interface Method { | ||
export interface Method { | ||
extensions: Extension[]; | ||
@@ -35,3 +36,3 @@ deprecated?: boolean; | ||
} | ||
interface Parameter { | ||
export interface Parameter { | ||
parameterName: string; | ||
@@ -51,24 +52,25 @@ example?: Array<{ | ||
} | ||
interface ResParameter extends Response, Parameter { | ||
export interface ResParameter extends Response, Parameter { | ||
in: 'res'; | ||
description: string; | ||
} | ||
interface ArrayParameter extends Parameter { | ||
export interface ArrayParameter extends Parameter { | ||
type: ArrayType; | ||
collectionFormat?: 'csv' | 'multi' | 'pipes' | 'ssv' | 'tsv'; | ||
} | ||
interface Validators { | ||
[key: string]: { | ||
value?: unknown; | ||
errorMsg?: string; | ||
}; | ||
} | ||
interface Security { | ||
type AllKeys<T> = T extends any ? keyof T : never; | ||
export type ValidatorKey = AllKeys<Validator>; | ||
export type SchemaValidatorKey = Exclude<ValidatorKey, `is${string}` | 'minDate' | 'maxDate'>; | ||
export type Validators = Partial<Record<ValidatorKey, { | ||
value?: unknown; | ||
errorMsg?: string; | ||
}>>; | ||
export interface Security { | ||
[key: string]: string[]; | ||
} | ||
interface Extension { | ||
key: string; | ||
export interface Extension { | ||
key: `x-${string}`; | ||
value: ExtensionType | ExtensionType[]; | ||
} | ||
interface Response { | ||
export interface Response { | ||
description: string; | ||
@@ -84,3 +86,3 @@ name: string; | ||
} | ||
interface Property { | ||
export interface Property { | ||
default?: unknown; | ||
@@ -97,17 +99,17 @@ description?: string; | ||
} | ||
type TypeStringLiteral = 'string' | 'boolean' | 'double' | 'float' | 'file' | 'integer' | 'long' | 'enum' | 'array' | 'datetime' | 'date' | 'binary' | 'buffer' | 'byte' | 'void' | 'object' | 'any' | 'refEnum' | 'refObject' | 'refAlias' | 'nestedObjectLiteral' | 'union' | 'intersection' | 'undefined'; | ||
type RefTypeLiteral = 'refObject' | 'refEnum' | 'refAlias'; | ||
type PrimitiveTypeLiteral = Exclude<TypeStringLiteral, RefTypeLiteral | 'enum' | 'array' | 'void' | 'undefined' | 'nestedObjectLiteral' | 'union' | 'intersection'>; | ||
interface TypeBase { | ||
export type TypeStringLiteral = 'string' | 'boolean' | 'double' | 'float' | 'file' | 'integer' | 'long' | 'enum' | 'array' | 'datetime' | 'date' | 'binary' | 'buffer' | 'byte' | 'void' | 'object' | 'any' | 'refEnum' | 'refObject' | 'refAlias' | 'nestedObjectLiteral' | 'union' | 'intersection' | 'undefined'; | ||
export type RefTypeLiteral = 'refObject' | 'refEnum' | 'refAlias'; | ||
export type PrimitiveTypeLiteral = Exclude<TypeStringLiteral, RefTypeLiteral | 'enum' | 'array' | 'void' | 'undefined' | 'nestedObjectLiteral' | 'union' | 'intersection'>; | ||
export interface TypeBase { | ||
dataType: TypeStringLiteral; | ||
} | ||
type PrimitiveType = StringType | BooleanType | DoubleType | FloatType | IntegerType | LongType | VoidType | UndefinedType; | ||
export type PrimitiveType = StringType | BooleanType | DoubleType | FloatType | IntegerType | LongType | VoidType | UndefinedType; | ||
/** | ||
* This is one of the possible objects that tsoa creates that helps the code store information about the type it found in the code. | ||
*/ | ||
type Type = PrimitiveType | ObjectsNoPropsType | EnumType | ArrayType | FileType | DateTimeType | DateType | BinaryType | BufferType | ByteType | AnyType | RefEnumType | RefObjectType | RefAliasType | NestedObjectLiteralType | UnionType | IntersectionType; | ||
interface StringType extends TypeBase { | ||
export type Type = PrimitiveType | ObjectsNoPropsType | EnumType | ArrayType | FileType | DateTimeType | DateType | BinaryType | BufferType | ByteType | AnyType | RefEnumType | RefObjectType | RefAliasType | NestedObjectLiteralType | UnionType | IntersectionType; | ||
export interface StringType extends TypeBase { | ||
dataType: 'string'; | ||
} | ||
interface BooleanType extends TypeBase { | ||
export interface BooleanType extends TypeBase { | ||
dataType: 'boolean'; | ||
@@ -118,15 +120,15 @@ } | ||
*/ | ||
interface ObjectsNoPropsType extends TypeBase { | ||
export interface ObjectsNoPropsType extends TypeBase { | ||
dataType: 'object'; | ||
} | ||
interface DoubleType extends TypeBase { | ||
export interface DoubleType extends TypeBase { | ||
dataType: 'double'; | ||
} | ||
interface FloatType extends TypeBase { | ||
export interface FloatType extends TypeBase { | ||
dataType: 'float'; | ||
} | ||
interface IntegerType extends TypeBase { | ||
export interface IntegerType extends TypeBase { | ||
dataType: 'integer'; | ||
} | ||
interface LongType extends TypeBase { | ||
export interface LongType extends TypeBase { | ||
dataType: 'long'; | ||
@@ -137,38 +139,38 @@ } | ||
*/ | ||
interface EnumType extends TypeBase { | ||
export interface EnumType extends TypeBase { | ||
dataType: 'enum'; | ||
enums: Array<string | number | boolean | null>; | ||
} | ||
interface ArrayType extends TypeBase { | ||
export interface ArrayType extends TypeBase { | ||
dataType: 'array'; | ||
elementType: Type; | ||
} | ||
interface DateType extends TypeBase { | ||
export interface DateType extends TypeBase { | ||
dataType: 'date'; | ||
} | ||
interface FileType extends TypeBase { | ||
export interface FileType extends TypeBase { | ||
dataType: 'file'; | ||
} | ||
interface DateTimeType extends TypeBase { | ||
export interface DateTimeType extends TypeBase { | ||
dataType: 'datetime'; | ||
} | ||
interface BinaryType extends TypeBase { | ||
export interface BinaryType extends TypeBase { | ||
dataType: 'binary'; | ||
} | ||
interface BufferType extends TypeBase { | ||
export interface BufferType extends TypeBase { | ||
dataType: 'buffer'; | ||
} | ||
interface ByteType extends TypeBase { | ||
export interface ByteType extends TypeBase { | ||
dataType: 'byte'; | ||
} | ||
interface VoidType extends TypeBase { | ||
export interface VoidType extends TypeBase { | ||
dataType: 'void'; | ||
} | ||
interface UndefinedType extends TypeBase { | ||
export interface UndefinedType extends TypeBase { | ||
dataType: 'undefined'; | ||
} | ||
interface AnyType extends TypeBase { | ||
export interface AnyType extends TypeBase { | ||
dataType: 'any'; | ||
} | ||
interface NestedObjectLiteralType extends TypeBase { | ||
export interface NestedObjectLiteralType extends TypeBase { | ||
dataType: 'nestedObjectLiteral'; | ||
@@ -178,3 +180,3 @@ properties: Property[]; | ||
} | ||
interface RefEnumType extends ReferenceTypeBase { | ||
export interface RefEnumType extends ReferenceTypeBase { | ||
dataType: 'refEnum'; | ||
@@ -184,3 +186,3 @@ enums: Array<string | number>; | ||
} | ||
interface RefObjectType extends ReferenceTypeBase { | ||
export interface RefObjectType extends ReferenceTypeBase { | ||
dataType: 'refObject'; | ||
@@ -190,7 +192,7 @@ properties: Property[]; | ||
} | ||
interface RefAliasType extends Omit<Property, 'name' | 'required'>, ReferenceTypeBase { | ||
export interface RefAliasType extends Omit<Property, 'name' | 'required'>, ReferenceTypeBase { | ||
dataType: 'refAlias'; | ||
} | ||
type ReferenceType = RefEnumType | RefObjectType | RefAliasType; | ||
interface ReferenceTypeBase extends TypeBase { | ||
export type ReferenceType = RefEnumType | RefObjectType | RefAliasType; | ||
export interface ReferenceTypeBase extends TypeBase { | ||
description?: string; | ||
@@ -202,17 +204,18 @@ dataType: RefTypeLiteral; | ||
} | ||
interface UnionType extends TypeBase { | ||
export interface UnionType extends TypeBase { | ||
dataType: 'union'; | ||
types: Type[]; | ||
} | ||
interface IntersectionType extends TypeBase { | ||
export interface IntersectionType extends TypeBase { | ||
dataType: 'intersection'; | ||
types: Type[]; | ||
} | ||
interface ReferenceTypeMap { | ||
export interface ReferenceTypeMap { | ||
[refName: string]: Tsoa.ReferenceType; | ||
} | ||
interface MethodsSignatureMap { | ||
export interface MethodsSignatureMap { | ||
[signature: string]: string[]; | ||
} | ||
type HeaderType = Tsoa.NestedObjectLiteralType | Tsoa.RefObjectType; | ||
export type HeaderType = Tsoa.NestedObjectLiteralType | Tsoa.RefObjectType; | ||
export {}; | ||
} |
@@ -21,3 +21,3 @@ "use strict"; | ||
let value = rawValue; | ||
// If undefined is alowed type, we can move to value validation | ||
// If undefined is allowed type, we can move to value validation | ||
if (value === undefined && property.dataType !== 'undefined') { | ||
@@ -34,3 +34,3 @@ // If there's either default value or datatype is union with undefined valid, we can just set it and move to validation | ||
Object.keys(validators).forEach((key) => { | ||
const errorMsg = validators[key].errorMsg; | ||
const errorMsg = validators[key]?.errorMsg; | ||
if (key.startsWith('is') && errorMsg) { | ||
@@ -37,0 +37,0 @@ message = errorMsg; |
@@ -11,3 +11,3 @@ "use strict"; | ||
Swagger.isQueryParameter = isQueryParameter; | ||
})(Swagger = exports.Swagger || (exports.Swagger = {})); | ||
})(Swagger || (exports.Swagger = Swagger = {})); | ||
//# sourceMappingURL=swagger.js.map |
{ | ||
"name": "@tsoa/runtime", | ||
"description": "Build swagger-compliant REST APIs using TypeScript and Node", | ||
"version": "6.0.0-rc.0", | ||
"version": "6.0.0-rc.1", | ||
"main": "./dist/index.js", | ||
@@ -52,3 +52,3 @@ "typings": "./dist/index.d.ts", | ||
}, | ||
"gitHead": "5e53bbe937c2de32a80ab836c7a3dc6d9000e416" | ||
"gitHead": "3d3b93f0f54cdff633743d2eefb386f0980ceb80" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
127859
2486