@tsoa/runtime
Advanced tools
Comparing version 3.7.0 to 3.8.0
import { Swagger } from './swagger/swagger'; | ||
export interface Config { | ||
/** | ||
* Swagger generation configuration object | ||
*/ | ||
spec: SpecConfig; | ||
/** | ||
* Route generation configuration object | ||
*/ | ||
routes: RoutesConfig; | ||
/** | ||
* Directories to ignore during TypeScript metadata scan | ||
*/ | ||
ignore?: string[]; | ||
/** | ||
* The entry point to your API | ||
*/ | ||
entryFile: string; | ||
/** | ||
* An array of path globs that point to your route controllers that you would like to have tsoa include. | ||
*/ | ||
controllerPathGlobs?: string[]; | ||
/** | ||
* Modes that allow you to prevent input data from entering into your API. This will document your decision in the swagger.yaml and it will turn on excess-property validation (at runtime) in your routes. | ||
*/ | ||
noImplicitAdditionalProperties?: 'throw-on-extras' | 'silently-remove-extras' | 'ignore'; | ||
/** | ||
* Typescript CompilerOptions to be used during generation | ||
* | ||
* @type {Record<string, unknown>} | ||
* @memberof RoutesConfig | ||
*/ | ||
compilerOptions?: Record<string, unknown>; | ||
/** | ||
* Swagger generation configuration object | ||
*/ | ||
spec: SpecConfig; | ||
/** | ||
* Route generation configuration object | ||
*/ | ||
routes: RoutesConfig; | ||
/** | ||
* Directories to ignore during TypeScript metadata scan | ||
*/ | ||
ignore?: string[]; | ||
/** | ||
* The entry point to your API | ||
*/ | ||
entryFile: string; | ||
/** | ||
* An array of path globs that point to your route controllers that you would like to have tsoa include. | ||
*/ | ||
controllerPathGlobs?: string[]; | ||
/** | ||
* Modes that allow you to prevent input data from entering into your API. This will document your decision in the swagger.yaml and it will turn on excess-property validation (at runtime) in your routes. | ||
*/ | ||
noImplicitAdditionalProperties?: 'throw-on-extras' | 'silently-remove-extras' | 'ignore'; | ||
/** | ||
* Typescript CompilerOptions to be used during generation | ||
* | ||
* @type {Record<string, unknown>} | ||
* @memberof RoutesConfig | ||
*/ | ||
compilerOptions?: Record<string, unknown>; | ||
} | ||
@@ -40,141 +40,141 @@ /** | ||
export interface SpecConfig { | ||
/** | ||
* Generated SwaggerConfig.json will output here | ||
*/ | ||
outputDirectory: string; | ||
/** | ||
* API host, expressTemplate.g. localhost:3000 or myapi.com | ||
*/ | ||
host?: string; | ||
/** | ||
* Base-name of swagger.json or swagger.yaml. | ||
* | ||
* @default: "swagger" | ||
*/ | ||
specFileBaseName?: string; | ||
/** | ||
/** | ||
* Generated SwaggerConfig.json will output here | ||
*/ | ||
outputDirectory: string; | ||
/** | ||
* API host, expressTemplate.g. localhost:3000 or myapi.com | ||
*/ | ||
host?: string; | ||
/** | ||
* Base-name of swagger.json or swagger.yaml. | ||
* | ||
* @default: "swagger" | ||
*/ | ||
specFileBaseName?: string; | ||
/** | ||
* API version number; defaults to npm package version | ||
*/ | ||
version?: string; | ||
version?: string; | ||
/** | ||
* Major OpenAPI version to generate; defaults to version 2 when not specified | ||
* Possible values: | ||
* - 2: generates OpenAPI version 2. | ||
* - 3: generates OpenAPI version 3. | ||
*/ | ||
specVersion?: Swagger.SupportedSpecMajorVersion; | ||
/** | ||
* API name; defaults to npm package name | ||
*/ | ||
name?: string; | ||
/** | ||
* API description; defaults to npm package description | ||
*/ | ||
description?: string; | ||
/** | ||
* Contact Information | ||
*/ | ||
contact?: { | ||
/** | ||
* Major OpenAPI version to generate; defaults to version 2 when not specified | ||
* Possible values: | ||
* - 2: generates OpenAPI version 2. | ||
* - 3: generates OpenAPI version 3. | ||
* The identifying name of the contact person/organization. | ||
* @default npm package author | ||
*/ | ||
specVersion?: Swagger.SupportedSpecMajorVersion; | ||
/** | ||
* API name; defaults to npm package name | ||
*/ | ||
name?: string; | ||
/** | ||
* API description; defaults to npm package description | ||
* The email address of the contact person/organization. | ||
* @default npm package author email | ||
*/ | ||
description?: string; | ||
email?: string; | ||
/** | ||
* Contact Information | ||
* API Info url | ||
* The URL pointing to the contact information. | ||
* @default npm package author url | ||
*/ | ||
contact?: { | ||
/** | ||
* The identifying name of the contact person/organization. | ||
* @default npm package author | ||
*/ | ||
name?: string; | ||
/** | ||
* The email address of the contact person/organization. | ||
* @default npm package author email | ||
*/ | ||
email?: string; | ||
/** | ||
* API Info url | ||
* The URL pointing to the contact information. | ||
* @default npm package author url | ||
*/ | ||
url?: string; | ||
}; | ||
/** | ||
* API license; defaults to npm package license | ||
*/ | ||
license?: string; | ||
/** | ||
* Base API path; e.g. the 'v1' in https://myapi.com/v1 | ||
*/ | ||
basePath?: string; | ||
/** | ||
* Extend generated swagger spec with this object | ||
* Note that generated properties will always take precedence over what get specified here | ||
*/ | ||
spec?: any; | ||
/** | ||
* Alter how the spec is merged to generated swagger spec. | ||
* Possible values: | ||
* - 'immediate' is overriding top level elements only thus you can not append a new path or alter an existing value without erasing same level elements. | ||
* - 'recursive' proceed to a deep merge and will concat every branches or override or create new values if needed. @see https://www.npmjs.com/package/merge | ||
* - 'deepmerge' uses `deepmerge` to merge, which will concat object branches and concat arrays as well @see https://www.npmjs.com/package/deepmerge | ||
* The default is set to immediate so it is not breaking previous versions. | ||
* @default 'immediate' | ||
*/ | ||
specMerging?: 'immediate' | 'recursive' | 'deepmerge'; | ||
/** | ||
* Security Definitions Object | ||
* A declaration of the security schemes available to be used in the | ||
* specification. This does not enforce the security schemes on the operations | ||
* and only serves to provide the relevant details for each scheme. | ||
*/ | ||
securityDefinitions?: { | ||
[name: string]: Swagger.Security; | ||
}; | ||
/** | ||
* Swagger Tags Information for your API | ||
*/ | ||
tags?: Swagger.Tag[]; | ||
yaml?: boolean; | ||
schemes?: Swagger.Protocol[]; | ||
/** | ||
* Enable x-enum-varnames support | ||
* @default false | ||
*/ | ||
xEnumVarnames?: boolean; | ||
url?: string; | ||
}; | ||
/** | ||
* API license; defaults to npm package license | ||
*/ | ||
license?: string; | ||
/** | ||
* Base API path; e.g. the 'v1' in https://myapi.com/v1 | ||
*/ | ||
basePath?: string; | ||
/** | ||
* Extend generated swagger spec with this object | ||
* Note that generated properties will always take precedence over what get specified here | ||
*/ | ||
spec?: any; | ||
/** | ||
* Alter how the spec is merged to generated swagger spec. | ||
* Possible values: | ||
* - 'immediate' is overriding top level elements only thus you can not append a new path or alter an existing value without erasing same level elements. | ||
* - 'recursive' proceed to a deep merge and will concat every branches or override or create new values if needed. @see https://www.npmjs.com/package/merge | ||
* - 'deepmerge' uses `deepmerge` to merge, which will concat object branches and concat arrays as well @see https://www.npmjs.com/package/deepmerge | ||
* The default is set to immediate so it is not breaking previous versions. | ||
* @default 'immediate' | ||
*/ | ||
specMerging?: 'immediate' | 'recursive' | 'deepmerge'; | ||
/** | ||
* Security Definitions Object | ||
* A declaration of the security schemes available to be used in the | ||
* specification. This does not enforce the security schemes on the operations | ||
* and only serves to provide the relevant details for each scheme. | ||
*/ | ||
securityDefinitions?: { | ||
[name: string]: Swagger.Security; | ||
}; | ||
/** | ||
* Swagger Tags Information for your API | ||
*/ | ||
tags?: Swagger.Tag[]; | ||
yaml?: boolean; | ||
schemes?: Swagger.Protocol[]; | ||
/** | ||
* Enable x-enum-varnames support | ||
* @default false | ||
*/ | ||
xEnumVarnames?: boolean; | ||
} | ||
export interface RoutesConfig { | ||
/** | ||
* Routes directory; generated routes.ts (which contains the generated code wiring up routes using middleware of choice) will be dropped here | ||
*/ | ||
routesDir: string; | ||
/** | ||
* Routes filename; the filename of the generated route file ('routes.ts' by default) | ||
*/ | ||
routesFileName?: string; | ||
/** | ||
* Avoid writing the generated route file if the existing file is identical (useful to optimize watch processes); false by default | ||
*/ | ||
noWriteIfUnchanged?: boolean; | ||
/** | ||
* Base API path; e.g. the '/v1' in https://myapi.com/v1 | ||
*/ | ||
basePath?: string; | ||
/** | ||
* Middleware provider. | ||
*/ | ||
middleware?: 'express' | 'hapi' | 'koa'; | ||
/** | ||
* Override the Middleware template | ||
*/ | ||
middlewareTemplate?: string; | ||
/** | ||
* IOC module; e.g. './inversify/ioc' where IOC container named `iocContainer` is defined (https://github.com/inversify/InversifyJS) | ||
*/ | ||
iocModule?: string; | ||
/** | ||
* Authentication Module for express, hapi and koa | ||
*/ | ||
authenticationModule?: string; | ||
/** | ||
* When enabled, the `@SuccessResponse` annotations' code is used for responses by default. | ||
* Otherwise, non-empty responses default to 200 and empty responses to 204. | ||
* | ||
* @default false | ||
*/ | ||
useSuccessResponseCode?: boolean; | ||
/** | ||
* Routes directory; generated routes.ts (which contains the generated code wiring up routes using middleware of choice) will be dropped here | ||
*/ | ||
routesDir: string; | ||
/** | ||
* Routes filename; the filename of the generated route file ('routes.ts' by default) | ||
*/ | ||
routesFileName?: string; | ||
/** | ||
* Avoid writing the generated route file if the existing file is identical (useful to optimize watch processes); false by default | ||
*/ | ||
noWriteIfUnchanged?: boolean; | ||
/** | ||
* Base API path; e.g. the '/v1' in https://myapi.com/v1 | ||
*/ | ||
basePath?: string; | ||
/** | ||
* Middleware provider. | ||
*/ | ||
middleware?: 'express' | 'hapi' | 'koa'; | ||
/** | ||
* Override the Middleware template | ||
*/ | ||
middlewareTemplate?: string; | ||
/** | ||
* IOC module; e.g. './inversify/ioc' where IOC container named `iocContainer` is defined (https://github.com/inversify/InversifyJS) | ||
*/ | ||
iocModule?: string; | ||
/** | ||
* Authentication Module for express, hapi and koa | ||
*/ | ||
authenticationModule?: string; | ||
/** | ||
* When enabled, the `@SuccessResponse` annotations' code is used for responses by default. | ||
* Otherwise, non-empty responses default to 200 and empty responses to 204. | ||
* | ||
* @default false | ||
*/ | ||
useSuccessResponseCode?: boolean; | ||
} |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=config.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=config.js.map |
@@ -1,10 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.CustomAttribute = void 0; | ||
function CustomAttribute(_name, _value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.CustomAttribute = CustomAttribute; | ||
//# sourceMappingURL=customAttribute.js.map | ||
//# sourceMappingURL=customAttribute.js.map |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Deprecated = void 0; | ||
@@ -8,7 +8,7 @@ /** | ||
function Deprecated() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Deprecated = Deprecated; | ||
//# sourceMappingURL=deprecated.js.map | ||
//# sourceMappingURL=deprecated.js.map |
@@ -1,10 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Example = void 0; | ||
function Example(exampleModel) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Example = Example; | ||
//# sourceMappingURL=example.js.map | ||
//# sourceMappingURL=example.js.map |
export declare function Extension(_name: string, _value: ExtensionType | ExtensionType[]): Function; | ||
export declare type ExtensionType = string | { | ||
[name: string]: ExtensionType | ExtensionType[]; | ||
}; | ||
export declare type ExtensionType = | ||
| string | ||
| { | ||
[name: string]: ExtensionType | ExtensionType[]; | ||
}; |
@@ -1,10 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Extension = void 0; | ||
function Extension(_name, _value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Extension = Extension; | ||
//# sourceMappingURL=extension.js.map | ||
//# sourceMappingURL=extension.js.map |
@@ -1,46 +0,46 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = exports.Options = void 0; | ||
function Options(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Options = Options; | ||
function Get(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Get = Get; | ||
function Post(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Post = Post; | ||
function Put(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Put = Put; | ||
function Patch(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Patch = Patch; | ||
function Delete(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Delete = Delete; | ||
function Head(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Head = Head; | ||
//# sourceMappingURL=methods.js.map | ||
//# sourceMappingURL=methods.js.map |
@@ -1,10 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.OperationId = void 0; | ||
function OperationId(value) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.OperationId = OperationId; | ||
//# sourceMappingURL=operationid.js.map | ||
//# sourceMappingURL=operationid.js.map |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.FormField = exports.UploadedFiles = exports.UploadedFile = exports.Inject = exports.Header = exports.Query = exports.Path = exports.Request = exports.BodyProp = exports.Body = void 0; | ||
@@ -9,5 +9,5 @@ /** | ||
function Body() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -21,5 +21,5 @@ exports.Body = Body; | ||
function BodyProp(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -31,5 +31,5 @@ exports.BodyProp = BodyProp; | ||
function Request() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -43,5 +43,5 @@ exports.Request = Request; | ||
function Path(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -55,5 +55,5 @@ exports.Path = Path; | ||
function Query(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -67,5 +67,5 @@ exports.Query = Query; | ||
function Header(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -77,5 +77,5 @@ exports.Header = Header; | ||
function Inject() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -89,5 +89,5 @@ exports.Inject = Inject; | ||
function UploadedFile(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -101,5 +101,5 @@ exports.UploadedFile = UploadedFile; | ||
function UploadedFiles(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -113,7 +113,7 @@ exports.UploadedFiles = UploadedFiles; | ||
function FormField(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.FormField = FormField; | ||
//# sourceMappingURL=parameter.js.map | ||
//# sourceMappingURL=parameter.js.map |
import { IsValidHeader } from '../utils/isHeaderType'; | ||
import { HttpStatusCodeLiteral, HttpStatusCodeStringLiteral, OtherValidOpenApiHttpStatusCode } from '../interfaces/response'; | ||
export declare function SuccessResponse<HeaderType extends IsValidHeader<HeaderType> = {}>(name: string | number, description?: string): Function; | ||
export declare function Response<ExampleType, HeaderType extends IsValidHeader<HeaderType> = {}>(name: HttpStatusCodeLiteral | HttpStatusCodeStringLiteral | OtherValidOpenApiHttpStatusCode, description?: string, example?: ExampleType): Function; | ||
export declare function Response<ExampleType, HeaderType extends IsValidHeader<HeaderType> = {}>( | ||
name: HttpStatusCodeLiteral | HttpStatusCodeStringLiteral | OtherValidOpenApiHttpStatusCode, | ||
description?: string, | ||
example?: ExampleType, | ||
): Function; | ||
/** | ||
@@ -6,0 +10,0 @@ * Inject a library-agnostic responder function that can be used to construct type-checked (usually error-) responses. |
@@ -1,14 +0,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Res = exports.Response = exports.SuccessResponse = void 0; | ||
function SuccessResponse(name, description) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.SuccessResponse = SuccessResponse; | ||
function Response(name, description, example) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -22,7 +22,7 @@ exports.Response = Response; | ||
function Res() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Res = Res; | ||
//# sourceMappingURL=response.js.map | ||
//# sourceMappingURL=response.js.map |
@@ -1,8 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Hidden = exports.Route = void 0; | ||
function Route(name) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -14,7 +14,7 @@ exports.Route = Route; | ||
function Hidden() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Hidden = Hidden; | ||
//# sourceMappingURL=route.js.map | ||
//# sourceMappingURL=route.js.map |
@@ -8,4 +8,9 @@ /** | ||
*/ | ||
export declare function Security(name: string | { | ||
[name: string]: string[]; | ||
}, scopes?: string[]): Function; | ||
export declare function Security( | ||
name: | ||
| string | ||
| { | ||
[name: string]: string[]; | ||
}, | ||
scopes?: string[], | ||
): Function; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Security = exports.NoSecurity = void 0; | ||
@@ -8,5 +8,5 @@ /** | ||
function NoSecurity() { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
@@ -18,7 +18,7 @@ exports.NoSecurity = NoSecurity; | ||
function Security(name, scopes) { | ||
return function () { | ||
return; | ||
}; | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Security = Security; | ||
//# sourceMappingURL=security.js.map | ||
//# sourceMappingURL=security.js.map |
@@ -1,14 +0,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Tags = void 0; | ||
function Tags() { | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
return function () { | ||
return; | ||
}; | ||
var values = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
values[_i] = arguments[_i]; | ||
} | ||
return function () { | ||
return; | ||
}; | ||
} | ||
exports.Tags = Tags; | ||
//# sourceMappingURL=tags.js.map | ||
//# sourceMappingURL=tags.js.map |
export declare class Controller { | ||
private statusCode?; | ||
private headers; | ||
setStatus(statusCode: number): void; | ||
getStatus(): number | undefined; | ||
setHeader(name: string, value?: string | string[]): void; | ||
getHeader(name: string): string | string[] | undefined; | ||
getHeaders(): { | ||
[name: string]: string | string[] | undefined; | ||
}; | ||
private statusCode?; | ||
private headers; | ||
setStatus(statusCode: number): void; | ||
getStatus(): number | undefined; | ||
setHeader(name: string, value?: string | string[]): void; | ||
getHeader(name: string): string | string[] | undefined; | ||
getHeaders(): { | ||
[name: string]: string | string[] | undefined; | ||
}; | ||
} |
@@ -1,27 +0,27 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Controller = void 0; | ||
var Controller = /** @class */ (function () { | ||
function Controller() { | ||
this.statusCode = undefined; | ||
this.headers = {}; | ||
} | ||
Controller.prototype.setStatus = function (statusCode) { | ||
this.statusCode = statusCode; | ||
}; | ||
Controller.prototype.getStatus = function () { | ||
return this.statusCode; | ||
}; | ||
Controller.prototype.setHeader = function (name, value) { | ||
this.headers[name] = value; | ||
}; | ||
Controller.prototype.getHeader = function (name) { | ||
return this.headers[name]; | ||
}; | ||
Controller.prototype.getHeaders = function () { | ||
return this.headers; | ||
}; | ||
return Controller; | ||
}()); | ||
function Controller() { | ||
this.statusCode = undefined; | ||
this.headers = {}; | ||
} | ||
Controller.prototype.setStatus = function (statusCode) { | ||
this.statusCode = statusCode; | ||
}; | ||
Controller.prototype.getStatus = function () { | ||
return this.statusCode; | ||
}; | ||
Controller.prototype.setHeader = function (name, value) { | ||
this.headers[name] = value; | ||
}; | ||
Controller.prototype.getHeader = function (name) { | ||
return this.headers[name]; | ||
}; | ||
Controller.prototype.getHeaders = function () { | ||
return this.headers; | ||
}; | ||
return Controller; | ||
})(); | ||
exports.Controller = Controller; | ||
//# sourceMappingURL=controller.js.map | ||
//# sourceMappingURL=controller.js.map |
/// <reference types="node" /> | ||
export declare type File = { | ||
fieldname: string; | ||
originalname: string; | ||
encoding: string; | ||
mimetype: string; | ||
size: number; | ||
buffer: Buffer; | ||
fieldname: string; | ||
originalname: string; | ||
encoding: string; | ||
mimetype: string; | ||
size: number; | ||
buffer: Buffer; | ||
}; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=file.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=file.js.map |
export interface IocContainer { | ||
get<T>(controller: { | ||
prototype: T; | ||
}): T; | ||
get<T>(controller: { prototype: T }): T; | ||
} | ||
export declare type IocContainerFactory = (request: unknown) => IocContainer; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=iocModule.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=iocModule.js.map |
import { IsValidHeader } from '../utils/isHeaderType'; | ||
export declare type HttpStatusCodeLiteral = 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511; | ||
export declare type HttpStatusCodeStringLiteral = '100' | '101' | '102' | '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' | '300' | '301' | '302' | '303' | '304' | '305' | '307' | '308' | '400' | '401' | '402' | '403' | '404' | '405' | '406' | '407' | '408' | '409' | '410' | '411' | '412' | '413' | '414' | '415' | '416' | '417' | '418' | '422' | '423' | '424' | '426' | '428' | '429' | '431' | '500' | '501' | '502' | '503' | '504' | '505' | '506' | '507' | '508' | '510' | '511'; | ||
export declare type HttpStatusCodeLiteral = | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 200 | ||
| 201 | ||
| 202 | ||
| 203 | ||
| 204 | ||
| 205 | ||
| 206 | ||
| 207 | ||
| 208 | ||
| 226 | ||
| 300 | ||
| 301 | ||
| 302 | ||
| 303 | ||
| 304 | ||
| 305 | ||
| 307 | ||
| 308 | ||
| 400 | ||
| 401 | ||
| 402 | ||
| 403 | ||
| 404 | ||
| 405 | ||
| 406 | ||
| 407 | ||
| 408 | ||
| 409 | ||
| 410 | ||
| 411 | ||
| 412 | ||
| 413 | ||
| 414 | ||
| 415 | ||
| 416 | ||
| 417 | ||
| 418 | ||
| 422 | ||
| 423 | ||
| 424 | ||
| 426 | ||
| 428 | ||
| 429 | ||
| 431 | ||
| 500 | ||
| 501 | ||
| 502 | ||
| 503 | ||
| 504 | ||
| 505 | ||
| 506 | ||
| 507 | ||
| 508 | ||
| 510 | ||
| 511; | ||
export declare type HttpStatusCodeStringLiteral = | ||
| '100' | ||
| '101' | ||
| '102' | ||
| '200' | ||
| '201' | ||
| '202' | ||
| '203' | ||
| '204' | ||
| '205' | ||
| '206' | ||
| '207' | ||
| '208' | ||
| '226' | ||
| '300' | ||
| '301' | ||
| '302' | ||
| '303' | ||
| '304' | ||
| '305' | ||
| '307' | ||
| '308' | ||
| '400' | ||
| '401' | ||
| '402' | ||
| '403' | ||
| '404' | ||
| '405' | ||
| '406' | ||
| '407' | ||
| '408' | ||
| '409' | ||
| '410' | ||
| '411' | ||
| '412' | ||
| '413' | ||
| '414' | ||
| '415' | ||
| '416' | ||
| '417' | ||
| '418' | ||
| '422' | ||
| '423' | ||
| '424' | ||
| '426' | ||
| '428' | ||
| '429' | ||
| '431' | ||
| '500' | ||
| '501' | ||
| '502' | ||
| '503' | ||
| '504' | ||
| '505' | ||
| '506' | ||
| '507' | ||
| '508' | ||
| '510' | ||
| '511'; | ||
export declare type OtherValidOpenApiHttpStatusCode = '1XX' | '2XX' | '3XX' | '4XX' | '5XX' | 'default'; | ||
export declare type TsoaResponse<T extends HttpStatusCodeLiteral, BodyType, HeaderType extends IsValidHeader<HeaderType> = {}> = (status: T, data: BodyType, headers?: HeaderType) => any; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=response.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=response.js.map |
import { ExtensionType } from '../decorators/extension'; | ||
export declare namespace Tsoa { | ||
interface Metadata { | ||
controllers: Controller[]; | ||
referenceTypeMap: ReferenceTypeMap; | ||
} | ||
interface Controller { | ||
location: string; | ||
methods: Method[]; | ||
name: string; | ||
path: string; | ||
} | ||
interface Method { | ||
extensions: Extension[]; | ||
deprecated?: boolean; | ||
description?: string; | ||
method: 'get' | 'post' | 'put' | 'delete' | 'options' | 'head' | 'patch'; | ||
name: string; | ||
parameters: Parameter[]; | ||
path: string; | ||
type: Type; | ||
tags?: string[]; | ||
responses: Response[]; | ||
successStatus?: number; | ||
security: Security[]; | ||
summary?: string; | ||
isHidden: boolean; | ||
operationId?: string; | ||
} | ||
interface Parameter { | ||
parameterName: string; | ||
example?: unknown[]; | ||
description?: string; | ||
in: 'query' | 'header' | 'path' | 'formData' | 'body' | 'body-prop' | 'request' | 'res'; | ||
name: string; | ||
required?: boolean; | ||
type: Type; | ||
default?: any; | ||
validators: Validators; | ||
} | ||
interface ResParameter extends Response, Parameter { | ||
in: 'res'; | ||
description: string; | ||
} | ||
interface ArrayParameter extends Parameter { | ||
type: ArrayType; | ||
collectionFormat?: 'csv' | 'multi' | 'pipes' | 'ssv' | 'tsv'; | ||
} | ||
interface Validators { | ||
[key: string]: { | ||
value?: any; | ||
errorMsg?: string; | ||
}; | ||
} | ||
interface Security { | ||
[key: string]: string[]; | ||
} | ||
interface Extension { | ||
key: string; | ||
value: ExtensionType | ExtensionType[]; | ||
} | ||
interface Response { | ||
description: string; | ||
name: string; | ||
schema?: Type; | ||
examples?: unknown[]; | ||
headers?: HeaderType; | ||
} | ||
interface Property { | ||
default?: any; | ||
description?: string; | ||
format?: string; | ||
example?: unknown; | ||
name: string; | ||
type: Type; | ||
required: boolean; | ||
validators: Validators; | ||
} | ||
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'; | ||
type RefTypeLiteral = 'refObject' | 'refEnum' | 'refAlias'; | ||
type PrimitiveTypeLiteral = Exclude<TypeStringLiteral, RefTypeLiteral | 'enum' | 'array' | 'void' | 'nestedObjectLiteral' | 'union' | 'intersection'>; | ||
interface TypeBase { | ||
dataType: TypeStringLiteral; | ||
} | ||
type PrimitiveType = StringType | BooleanType | DoubleType | FloatType | IntegerType | LongType | VoidType; | ||
/** | ||
* 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 { | ||
dataType: 'string'; | ||
} | ||
interface BooleanType extends TypeBase { | ||
dataType: 'boolean'; | ||
} | ||
/** | ||
* This is the type that occurs when a developer writes `const foo: object = {}` since it can no longer have any properties added to it. | ||
*/ | ||
interface ObjectsNoPropsType extends TypeBase { | ||
dataType: 'object'; | ||
} | ||
interface DoubleType extends TypeBase { | ||
dataType: 'double'; | ||
} | ||
interface FloatType extends TypeBase { | ||
dataType: 'float'; | ||
} | ||
interface IntegerType extends TypeBase { | ||
dataType: 'integer'; | ||
} | ||
interface LongType extends TypeBase { | ||
dataType: 'long'; | ||
} | ||
/** | ||
* Not to be confused with `RefEnumType` which is a reusable enum which has a $ref name generated for it. This however, is an inline enum. | ||
*/ | ||
interface EnumType extends TypeBase { | ||
dataType: 'enum'; | ||
enums: Array<string | number | boolean | null>; | ||
} | ||
interface ArrayType extends TypeBase { | ||
dataType: 'array'; | ||
elementType: Type; | ||
} | ||
interface DateType extends TypeBase { | ||
dataType: 'date'; | ||
} | ||
interface FileType extends TypeBase { | ||
dataType: 'file'; | ||
} | ||
interface DateTimeType extends TypeBase { | ||
dataType: 'datetime'; | ||
} | ||
interface BinaryType extends TypeBase { | ||
dataType: 'binary'; | ||
} | ||
interface BufferType extends TypeBase { | ||
dataType: 'buffer'; | ||
} | ||
interface ByteType extends TypeBase { | ||
dataType: 'byte'; | ||
} | ||
interface VoidType extends TypeBase { | ||
dataType: 'void'; | ||
} | ||
interface AnyType extends TypeBase { | ||
dataType: 'any'; | ||
} | ||
interface NestedObjectLiteralType extends TypeBase { | ||
dataType: 'nestedObjectLiteral'; | ||
properties: Property[]; | ||
additionalProperties?: Type; | ||
} | ||
interface RefEnumType extends ReferenceTypeBase { | ||
dataType: 'refEnum'; | ||
enums: Array<string | number>; | ||
enumVarnames?: string[]; | ||
} | ||
interface RefObjectType extends ReferenceTypeBase { | ||
dataType: 'refObject'; | ||
properties: Property[]; | ||
additionalProperties?: Type; | ||
} | ||
interface RefAliasType extends Omit<Property, 'name' | 'required'>, ReferenceTypeBase { | ||
dataType: 'refAlias'; | ||
} | ||
type ReferenceType = RefEnumType | RefObjectType | RefAliasType; | ||
interface ReferenceTypeBase extends TypeBase { | ||
description?: string; | ||
dataType: RefTypeLiteral; | ||
refName: string; | ||
example?: unknown; | ||
} | ||
interface UnionType extends TypeBase { | ||
dataType: 'union'; | ||
types: Type[]; | ||
} | ||
interface IntersectionType extends TypeBase { | ||
dataType: 'intersection'; | ||
types: Type[]; | ||
} | ||
interface ReferenceTypeMap { | ||
[refName: string]: Tsoa.ReferenceType; | ||
} | ||
interface MethodsSignatureMap { | ||
[signature: string]: string[]; | ||
} | ||
type HeaderType = Tsoa.NestedObjectLiteralType | Tsoa.RefObjectType; | ||
interface Metadata { | ||
controllers: Controller[]; | ||
referenceTypeMap: ReferenceTypeMap; | ||
} | ||
interface Controller { | ||
location: string; | ||
methods: Method[]; | ||
name: string; | ||
path: string; | ||
} | ||
interface Method { | ||
extensions: Extension[]; | ||
deprecated?: boolean; | ||
description?: string; | ||
method: 'get' | 'post' | 'put' | 'delete' | 'options' | 'head' | 'patch'; | ||
name: string; | ||
parameters: Parameter[]; | ||
path: string; | ||
type: Type; | ||
tags?: string[]; | ||
responses: Response[]; | ||
successStatus?: number; | ||
security: Security[]; | ||
summary?: string; | ||
isHidden: boolean; | ||
operationId?: string; | ||
} | ||
interface Parameter { | ||
parameterName: string; | ||
example?: unknown[]; | ||
description?: string; | ||
in: 'query' | 'header' | 'path' | 'formData' | 'body' | 'body-prop' | 'request' | 'res'; | ||
name: string; | ||
required?: boolean; | ||
type: Type; | ||
default?: any; | ||
validators: Validators; | ||
deprecated: boolean; | ||
} | ||
interface ResParameter extends Response, Parameter { | ||
in: 'res'; | ||
description: string; | ||
} | ||
interface ArrayParameter extends Parameter { | ||
type: ArrayType; | ||
collectionFormat?: 'csv' | 'multi' | 'pipes' | 'ssv' | 'tsv'; | ||
} | ||
interface Validators { | ||
[key: string]: { | ||
value?: any; | ||
errorMsg?: string; | ||
}; | ||
} | ||
interface Security { | ||
[key: string]: string[]; | ||
} | ||
interface Extension { | ||
key: string; | ||
value: ExtensionType | ExtensionType[]; | ||
} | ||
interface Response { | ||
description: string; | ||
name: string; | ||
schema?: Type; | ||
examples?: unknown[]; | ||
headers?: HeaderType; | ||
} | ||
interface Property { | ||
default?: any; | ||
description?: string; | ||
format?: string; | ||
example?: unknown; | ||
name: string; | ||
type: Type; | ||
required: boolean; | ||
validators: Validators; | ||
deprecated: boolean; | ||
} | ||
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'; | ||
type RefTypeLiteral = 'refObject' | 'refEnum' | 'refAlias'; | ||
type PrimitiveTypeLiteral = Exclude<TypeStringLiteral, RefTypeLiteral | 'enum' | 'array' | 'void' | 'nestedObjectLiteral' | 'union' | 'intersection'>; | ||
interface TypeBase { | ||
dataType: TypeStringLiteral; | ||
} | ||
type PrimitiveType = StringType | BooleanType | DoubleType | FloatType | IntegerType | LongType | VoidType; | ||
/** | ||
* 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 { | ||
dataType: 'string'; | ||
} | ||
interface BooleanType extends TypeBase { | ||
dataType: 'boolean'; | ||
} | ||
/** | ||
* This is the type that occurs when a developer writes `const foo: object = {}` since it can no longer have any properties added to it. | ||
*/ | ||
interface ObjectsNoPropsType extends TypeBase { | ||
dataType: 'object'; | ||
} | ||
interface DoubleType extends TypeBase { | ||
dataType: 'double'; | ||
} | ||
interface FloatType extends TypeBase { | ||
dataType: 'float'; | ||
} | ||
interface IntegerType extends TypeBase { | ||
dataType: 'integer'; | ||
} | ||
interface LongType extends TypeBase { | ||
dataType: 'long'; | ||
} | ||
/** | ||
* Not to be confused with `RefEnumType` which is a reusable enum which has a $ref name generated for it. This however, is an inline enum. | ||
*/ | ||
interface EnumType extends TypeBase { | ||
dataType: 'enum'; | ||
enums: Array<string | number | boolean | null>; | ||
} | ||
interface ArrayType extends TypeBase { | ||
dataType: 'array'; | ||
elementType: Type; | ||
} | ||
interface DateType extends TypeBase { | ||
dataType: 'date'; | ||
} | ||
interface FileType extends TypeBase { | ||
dataType: 'file'; | ||
} | ||
interface DateTimeType extends TypeBase { | ||
dataType: 'datetime'; | ||
} | ||
interface BinaryType extends TypeBase { | ||
dataType: 'binary'; | ||
} | ||
interface BufferType extends TypeBase { | ||
dataType: 'buffer'; | ||
} | ||
interface ByteType extends TypeBase { | ||
dataType: 'byte'; | ||
} | ||
interface VoidType extends TypeBase { | ||
dataType: 'void'; | ||
} | ||
interface AnyType extends TypeBase { | ||
dataType: 'any'; | ||
} | ||
interface NestedObjectLiteralType extends TypeBase { | ||
dataType: 'nestedObjectLiteral'; | ||
properties: Property[]; | ||
additionalProperties?: Type; | ||
} | ||
interface RefEnumType extends ReferenceTypeBase { | ||
dataType: 'refEnum'; | ||
enums: Array<string | number>; | ||
enumVarnames?: string[]; | ||
} | ||
interface RefObjectType extends ReferenceTypeBase { | ||
dataType: 'refObject'; | ||
properties: Property[]; | ||
additionalProperties?: Type; | ||
} | ||
interface RefAliasType extends Omit<Property, 'name' | 'required'>, ReferenceTypeBase { | ||
dataType: 'refAlias'; | ||
} | ||
type ReferenceType = RefEnumType | RefObjectType | RefAliasType; | ||
interface ReferenceTypeBase extends TypeBase { | ||
description?: string; | ||
dataType: RefTypeLiteral; | ||
refName: string; | ||
example?: unknown; | ||
deprecated: boolean; | ||
} | ||
interface UnionType extends TypeBase { | ||
dataType: 'union'; | ||
types: Type[]; | ||
} | ||
interface IntersectionType extends TypeBase { | ||
dataType: 'intersection'; | ||
types: Type[]; | ||
} | ||
interface ReferenceTypeMap { | ||
[refName: string]: Tsoa.ReferenceType; | ||
} | ||
interface MethodsSignatureMap { | ||
[signature: string]: string[]; | ||
} | ||
type HeaderType = Tsoa.NestedObjectLiteralType | Tsoa.RefObjectType; | ||
} |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=tsoa.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=tsoa.js.map |
import { Config } from '../config'; | ||
export interface AdditionalProps { | ||
noImplicitAdditionalProperties: Exclude<Config['noImplicitAdditionalProperties'], undefined>; | ||
noImplicitAdditionalProperties: Exclude<Config['noImplicitAdditionalProperties'], undefined>; | ||
} |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=additionalProps.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=additionalProps.js.map |
@@ -12,4 +12,4 @@ /// <reference types="node" /> | ||
} | undefined, additionalProperties: TsoaRoute.PropertySchema | boolean | undefined, parent: string): any; | ||
validateInt(name: string, value: any, fieldErrors: FieldErrors, validators?: IntegerValidator, parent?: string): any; | ||
validateFloat(name: string, value: any, fieldErrors: FieldErrors, validators?: FloatValidator, parent?: string): any; | ||
validateInt(name: string, value: any, fieldErrors: FieldErrors, validators?: IntegerValidator, parent?: string): number | undefined; | ||
validateFloat(name: string, value: any, fieldErrors: FieldErrors, validators?: FloatValidator, parent?: string): number | undefined; | ||
validateEnum(name: string, value: unknown, fieldErrors: FieldErrors, members?: Array<string | number | boolean | null>, parent?: string): unknown; | ||
@@ -16,0 +16,0 @@ validateDate(name: string, value: any, fieldErrors: FieldErrors, validators?: DateValidator, parent?: string): Date | undefined; |
@@ -59,3 +59,2 @@ "use strict"; | ||
exports.ValidateError = exports.ValidationService = exports.ValidateParam = void 0; | ||
var moment = require("moment"); | ||
var validator_1 = require("validator"); | ||
@@ -302,4 +301,3 @@ var assertNever_1 = require("../utils/assertNever"); | ||
if (parent === void 0) { parent = ''; } | ||
var momentDate = moment(String(value), moment.ISO_8601, true); | ||
if (!momentDate.isValid()) { | ||
if (!validator_1.default.isISO8601(String(value), { strict: true })) { | ||
var message = validators && validators.isDate && validators.isDate.errorMsg ? validators.isDate.errorMsg : "invalid ISO 8601 date format, i.e. YYYY-MM-DD"; | ||
@@ -340,4 +338,3 @@ fieldErrors[parent + name] = { | ||
if (parent === void 0) { parent = ''; } | ||
var momentDateTime = moment(String(value), moment.ISO_8601, true); | ||
if (!momentDateTime.isValid()) { | ||
if (!validator_1.default.isISO8601(String(value), { strict: true })) { | ||
var message = validators && validators.isDateTime && validators.isDateTime.errorMsg ? validators.isDateTime.errorMsg : "invalid ISO 8601 datetime format, i.e. YYYY-MM-DDTHH:mm:ss"; | ||
@@ -344,0 +341,0 @@ fieldErrors[parent + name] = { |
@@ -8,50 +8,50 @@ import { Tsoa } from './../metadataGeneration/tsoa'; | ||
export declare namespace TsoaRoute { | ||
interface Models { | ||
[name: string]: ModelSchema; | ||
} | ||
/** | ||
* This is a convenience type so you can check .properties on the items in the Record without having TypeScript throw a compiler error. That's because this Record can't have enums in it. If you want that, then just use the base interface | ||
*/ | ||
interface RefObjectModels extends TsoaRoute.Models { | ||
[refNames: string]: TsoaRoute.RefObjectModelSchema; | ||
} | ||
interface RefEnumModelSchema { | ||
dataType: 'refEnum'; | ||
enums: Array<string | number>; | ||
} | ||
interface RefObjectModelSchema { | ||
dataType: 'refObject'; | ||
properties: { | ||
[name: string]: PropertySchema; | ||
}; | ||
additionalProperties?: boolean | PropertySchema; | ||
} | ||
interface RefTypeAliasModelSchema { | ||
dataType: 'refAlias'; | ||
type: PropertySchema; | ||
} | ||
type ModelSchema = RefEnumModelSchema | RefObjectModelSchema | RefTypeAliasModelSchema; | ||
type ValidatorSchema = Tsoa.Validators; | ||
interface PropertySchema { | ||
dataType?: Tsoa.TypeStringLiteral; | ||
ref?: string; | ||
required?: boolean; | ||
array?: PropertySchema; | ||
enums?: Array<string | number | boolean | null>; | ||
type?: PropertySchema; | ||
subSchemas?: PropertySchema[]; | ||
validators?: ValidatorSchema; | ||
default?: any; | ||
additionalProperties?: boolean | PropertySchema; | ||
nestedProperties?: { | ||
[name: string]: PropertySchema; | ||
}; | ||
} | ||
interface ParameterSchema extends PropertySchema { | ||
name: string; | ||
in: string; | ||
} | ||
interface Security { | ||
[key: string]: string[]; | ||
} | ||
interface Models { | ||
[name: string]: ModelSchema; | ||
} | ||
/** | ||
* This is a convenience type so you can check .properties on the items in the Record without having TypeScript throw a compiler error. That's because this Record can't have enums in it. If you want that, then just use the base interface | ||
*/ | ||
interface RefObjectModels extends TsoaRoute.Models { | ||
[refNames: string]: TsoaRoute.RefObjectModelSchema; | ||
} | ||
interface RefEnumModelSchema { | ||
dataType: 'refEnum'; | ||
enums: Array<string | number>; | ||
} | ||
interface RefObjectModelSchema { | ||
dataType: 'refObject'; | ||
properties: { | ||
[name: string]: PropertySchema; | ||
}; | ||
additionalProperties?: boolean | PropertySchema; | ||
} | ||
interface RefTypeAliasModelSchema { | ||
dataType: 'refAlias'; | ||
type: PropertySchema; | ||
} | ||
type ModelSchema = RefEnumModelSchema | RefObjectModelSchema | RefTypeAliasModelSchema; | ||
type ValidatorSchema = Tsoa.Validators; | ||
interface PropertySchema { | ||
dataType?: Tsoa.TypeStringLiteral; | ||
ref?: string; | ||
required?: boolean; | ||
array?: PropertySchema; | ||
enums?: Array<string | number | boolean | null>; | ||
type?: PropertySchema; | ||
subSchemas?: PropertySchema[]; | ||
validators?: ValidatorSchema; | ||
default?: any; | ||
additionalProperties?: boolean | PropertySchema; | ||
nestedProperties?: { | ||
[name: string]: PropertySchema; | ||
}; | ||
} | ||
interface ParameterSchema extends PropertySchema { | ||
name: string; | ||
in: string; | ||
} | ||
interface Security { | ||
[key: string]: string[]; | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.isDefaultForAdditionalPropertiesAllowed = void 0; | ||
@@ -9,5 +9,5 @@ /** | ||
function isDefaultForAdditionalPropertiesAllowed(test) { | ||
return test === undefined; | ||
return test === undefined; | ||
} | ||
exports.isDefaultForAdditionalPropertiesAllowed = isDefaultForAdditionalPropertiesAllowed; | ||
//# sourceMappingURL=tsoa-route.js.map | ||
//# sourceMappingURL=tsoa-route.js.map |
export declare namespace Swagger { | ||
export type DataType = 'integer' | 'number' | 'boolean' | 'string' | 'array' | 'object' | 'file'; | ||
export type DataFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password'; | ||
export type Protocol = 'http' | 'https' | 'ws' | 'wss'; | ||
export type SupportedSpecMajorVersion = 2 | 3; | ||
export interface Spec { | ||
info: Info; | ||
tags?: Tag[]; | ||
externalDocs?: ExternalDocs; | ||
} | ||
export interface Spec2 extends Spec { | ||
swagger: '2.0'; | ||
host?: string; | ||
basePath?: string; | ||
schemes?: Protocol[]; | ||
consumes?: string[]; | ||
produces?: string[]; | ||
paths: { | ||
[name: string]: Path; | ||
}; | ||
definitions?: { | ||
[name: string]: Schema; | ||
}; | ||
parameters?: { | ||
[name: string]: Parameter; | ||
}; | ||
responses?: { | ||
[name: string]: Response; | ||
}; | ||
security?: Security[]; | ||
securityDefinitions?: { | ||
[name: string]: Security; | ||
}; | ||
} | ||
export interface Spec3 extends Spec { | ||
openapi: '3.0.0'; | ||
servers: Server[]; | ||
components: Components; | ||
paths: { | ||
[name: string]: Path3; | ||
}; | ||
} | ||
export interface Components { | ||
callbacks?: { | ||
[name: string]: any; | ||
}; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
headers?: { | ||
[name: string]: any; | ||
}; | ||
links?: { | ||
[name: string]: any; | ||
}; | ||
parameters?: { | ||
[name: string]: Parameter; | ||
}; | ||
requestBodies?: { | ||
[name: string]: any; | ||
}; | ||
responses?: { | ||
[name: string]: Response; | ||
}; | ||
schemas?: { | ||
[name: string]: Schema | Schema3; | ||
}; | ||
securitySchemes?: { | ||
[name: string]: Security; | ||
}; | ||
} | ||
export interface Server { | ||
url: string; | ||
} | ||
export interface Info { | ||
title: string; | ||
version?: string; | ||
description?: string; | ||
termsOfService?: string; | ||
contact?: Contact; | ||
license?: License; | ||
} | ||
export interface Contact { | ||
name?: string; | ||
email?: string; | ||
url?: string; | ||
} | ||
export interface License { | ||
name: string; | ||
url?: string; | ||
} | ||
export interface ExternalDocs { | ||
url: string; | ||
description?: string; | ||
} | ||
export interface Tag { | ||
name: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
} | ||
export interface Example { | ||
examples?: { | ||
[exampleName: string]: Swagger.Example3; | ||
}; | ||
} | ||
export interface Example3 { | ||
value: unknown; | ||
summary?: string; | ||
description?: string; | ||
} | ||
export interface BaseParameter extends BaseSchema { | ||
name: string; | ||
in: 'query' | 'header' | 'path' | 'formData' | 'body'; | ||
required?: boolean; | ||
description?: string; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
schema: Schema; | ||
type: DataType; | ||
format?: DataFormat; | ||
} | ||
export interface BodyParameter extends BaseParameter { | ||
in: 'body'; | ||
} | ||
export interface QueryParameter extends BaseParameter { | ||
in: 'query'; | ||
allowEmptyValue?: boolean; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
} | ||
export interface PathParameter extends BaseParameter { | ||
in: 'path'; | ||
} | ||
export interface HeaderParameter extends BaseParameter { | ||
in: 'header'; | ||
} | ||
export interface FormDataParameter extends BaseParameter { | ||
in: 'formData'; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
} | ||
export type Parameter = BodyParameter | FormDataParameter | QueryParameter | PathParameter | HeaderParameter; | ||
export interface Path { | ||
$ref?: string; | ||
get?: Operation; | ||
put?: Operation; | ||
post?: Operation; | ||
delete?: Operation; | ||
options?: Operation; | ||
head?: Operation; | ||
patch?: Operation; | ||
parameters?: Parameter[]; | ||
} | ||
export interface Path3 { | ||
$ref?: string; | ||
get?: Operation3; | ||
put?: Operation3; | ||
post?: Operation3; | ||
delete?: Operation3; | ||
options?: Operation3; | ||
head?: Operation3; | ||
patch?: Operation3; | ||
parameters?: Parameter[]; | ||
} | ||
export interface Operation { | ||
tags?: string[]; | ||
summary?: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
operationId: string; | ||
consumes?: string[]; | ||
produces?: string[]; | ||
parameters?: Parameter[]; | ||
responses: { | ||
[name: string]: Response; | ||
}; | ||
schemes?: Protocol[]; | ||
deprecated?: boolean; | ||
security?: Security[]; | ||
[key: string]: unknown; | ||
} | ||
export interface Operation3 { | ||
tags?: string[]; | ||
summary?: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
operationId: string; | ||
consumes?: string[]; | ||
parameters?: Parameter[]; | ||
responses: { | ||
[name: string]: Response3; | ||
}; | ||
schemes?: Protocol[]; | ||
deprecated?: boolean; | ||
security?: Security[]; | ||
requestBody?: RequestBody; | ||
} | ||
export interface RequestBody { | ||
content: { | ||
[name: string]: MediaType; | ||
}; | ||
description?: string; | ||
required?: boolean; | ||
} | ||
export interface MediaType { | ||
schema?: Schema3; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
encoding?: { | ||
[name: string]: any; | ||
}; | ||
} | ||
export interface Response { | ||
description: string; | ||
schema?: Schema; | ||
headers?: { | ||
[name: string]: Header; | ||
}; | ||
examples?: Example; | ||
} | ||
export interface Response3 { | ||
description: string; | ||
content?: { | ||
[name: string]: Schema & Example; | ||
}; | ||
headers?: { | ||
[name: string]: Header3; | ||
}; | ||
} | ||
export interface BaseSchema { | ||
type?: string; | ||
format?: DataFormat; | ||
$ref?: string; | ||
title?: string; | ||
description?: string; | ||
default?: string | boolean | number | any; | ||
multipleOf?: number; | ||
maximum?: number; | ||
exclusiveMaximum?: number; | ||
minimum?: number; | ||
exclusiveMinimum?: number; | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
maxProperties?: number; | ||
minProperties?: number; | ||
enum?: Array<string | number | null>; | ||
'x-enum-varnames'?: string[]; | ||
items?: BaseSchema; | ||
} | ||
export interface Schema3 extends Omit<Schema, 'type'> { | ||
type?: DataType; | ||
nullable?: boolean; | ||
anyOf?: BaseSchema[]; | ||
allOf?: BaseSchema[]; | ||
} | ||
export interface Schema2 extends Schema { | ||
['x-nullable']?: boolean; | ||
} | ||
export interface Schema extends BaseSchema { | ||
type?: DataType; | ||
format?: DataFormat; | ||
additionalProperties?: boolean | BaseSchema; | ||
properties?: { | ||
[propertyName: string]: Schema3; | ||
}; | ||
discriminator?: string; | ||
readOnly?: boolean; | ||
xml?: XML; | ||
externalDocs?: ExternalDocs; | ||
example?: unknown; | ||
required?: string[]; | ||
} | ||
export interface Header { | ||
description?: string; | ||
type: 'string' | 'number' | 'integer' | 'boolean' | 'array'; | ||
format?: string; | ||
items?: BaseSchema; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
default?: string | boolean | number | any; | ||
maximum?: number; | ||
exclusiveMaximum?: boolean; | ||
minimum?: number; | ||
exclusiveMinimum?: boolean; | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
enum?: Array<string | number | null>; | ||
multipleOf?: number; | ||
} | ||
export interface Header3 extends BaseSchema { | ||
required?: boolean; | ||
description?: string; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
schema: Schema; | ||
type?: DataType; | ||
format?: DataFormat; | ||
} | ||
export interface XML { | ||
type?: string; | ||
namespace?: string; | ||
prefix?: string; | ||
attribute?: string; | ||
wrapped?: boolean; | ||
} | ||
interface BaseSecurity { | ||
description?: string; | ||
} | ||
interface BaseOAuthSecurity extends BaseSecurity { | ||
scopes?: OAuthScope; | ||
} | ||
export interface BasicSecurity3 extends BaseSecurity { | ||
type: 'http'; | ||
scheme: 'basic'; | ||
} | ||
export interface BasicSecurity extends BaseSecurity { | ||
type: 'basic'; | ||
} | ||
export interface ApiKeySecurity extends BaseSecurity { | ||
type: 'apiKey'; | ||
name: string; | ||
in: 'query' | 'header'; | ||
} | ||
export interface OAuth2Security3 extends BaseSecurity { | ||
type: 'oauth2'; | ||
flows: OAuthFlow; | ||
} | ||
export interface OAuth2SecurityFlow3 extends BaseSecurity { | ||
tokenUrl?: string; | ||
authorizationUrl?: string; | ||
scopes?: OAuthScope; | ||
} | ||
export interface OAuth2ImplicitSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
description?: string; | ||
flow: 'implicit'; | ||
authorizationUrl: string; | ||
} | ||
export interface OAuth2PasswordSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'password'; | ||
tokenUrl: string; | ||
} | ||
export interface OAuth2ApplicationSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'application'; | ||
tokenUrl: string; | ||
} | ||
export interface OAuth2AccessCodeSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'accessCode'; | ||
tokenUrl: string; | ||
authorizationUrl: string; | ||
} | ||
export interface OAuthScope { | ||
[scopeName: string]: string; | ||
} | ||
export type OAuthFlow = { | ||
[flowName in OAuth2FlowTypes]?: OAuth2SecurityFlow3; | ||
export type DataType = 'integer' | 'number' | 'boolean' | 'string' | 'array' | 'object' | 'file'; | ||
export type DataFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password'; | ||
export type Protocol = 'http' | 'https' | 'ws' | 'wss'; | ||
export type SupportedSpecMajorVersion = 2 | 3; | ||
export interface Spec { | ||
info: Info; | ||
tags?: Tag[]; | ||
externalDocs?: ExternalDocs; | ||
} | ||
export interface Spec2 extends Spec { | ||
swagger: '2.0'; | ||
host?: string; | ||
basePath?: string; | ||
schemes?: Protocol[]; | ||
consumes?: string[]; | ||
produces?: string[]; | ||
paths: { | ||
[name: string]: Path; | ||
}; | ||
export type OAuth2FlowTypes = 'authorizationCode' | 'implicit' | 'password' | 'clientCredentials'; | ||
export type Security = BasicSecurity | BasicSecurity3 | ApiKeySecurity | OAuth2AccessCodeSecurity | OAuth2ApplicationSecurity | OAuth2ImplicitSecurity | OAuth2PasswordSecurity | OAuth2Security3; | ||
export {}; | ||
definitions?: { | ||
[name: string]: Schema2; | ||
}; | ||
parameters?: { | ||
[name: string]: Parameter; | ||
}; | ||
responses?: { | ||
[name: string]: Response; | ||
}; | ||
security?: Security[]; | ||
securityDefinitions?: { | ||
[name: string]: Security; | ||
}; | ||
} | ||
export interface Spec3 extends Spec { | ||
openapi: '3.0.0'; | ||
servers: Server[]; | ||
components: Components; | ||
paths: { | ||
[name: string]: Path3; | ||
}; | ||
} | ||
export interface Components { | ||
callbacks?: { | ||
[name: string]: any; | ||
}; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
headers?: { | ||
[name: string]: any; | ||
}; | ||
links?: { | ||
[name: string]: any; | ||
}; | ||
parameters?: { | ||
[name: string]: Parameter; | ||
}; | ||
requestBodies?: { | ||
[name: string]: any; | ||
}; | ||
responses?: { | ||
[name: string]: Response; | ||
}; | ||
schemas?: { | ||
[name: string]: Schema3; | ||
}; | ||
securitySchemes?: { | ||
[name: string]: Security; | ||
}; | ||
} | ||
export interface Server { | ||
url: string; | ||
} | ||
export interface Info { | ||
title: string; | ||
version?: string; | ||
description?: string; | ||
termsOfService?: string; | ||
contact?: Contact; | ||
license?: License; | ||
} | ||
export interface Contact { | ||
name?: string; | ||
email?: string; | ||
url?: string; | ||
} | ||
export interface License { | ||
name: string; | ||
url?: string; | ||
} | ||
export interface ExternalDocs { | ||
url: string; | ||
description?: string; | ||
} | ||
export interface Tag { | ||
name: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
} | ||
export interface Example { | ||
examples?: { | ||
[exampleName: string]: Swagger.Example3; | ||
}; | ||
} | ||
export interface Example3 { | ||
value: unknown; | ||
summary?: string; | ||
description?: string; | ||
} | ||
export interface BaseParameter extends BaseSchema { | ||
name: string; | ||
in: 'query' | 'header' | 'path' | 'formData' | 'body'; | ||
required?: boolean; | ||
description?: string; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
schema: Schema; | ||
type: DataType; | ||
format?: DataFormat; | ||
deprecated?: boolean; | ||
} | ||
export interface BodyParameter extends BaseParameter { | ||
in: 'body'; | ||
} | ||
export interface QueryParameter extends BaseParameter { | ||
in: 'query'; | ||
allowEmptyValue?: boolean; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
} | ||
export function isQueryParameter(parameter: BaseParameter): parameter is QueryParameter; | ||
export interface PathParameter extends BaseParameter { | ||
in: 'path'; | ||
} | ||
export interface HeaderParameter extends BaseParameter { | ||
in: 'header'; | ||
} | ||
export interface FormDataParameter extends BaseParameter { | ||
in: 'formData'; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
} | ||
export type Parameter = BodyParameter | FormDataParameter | QueryParameter | PathParameter | HeaderParameter; | ||
export type Parameter2 = Omit< | ||
Parameter & { | ||
'x-deprecated'?: boolean; | ||
}, | ||
'deprecated' | ||
>; | ||
export type Parameter3 = Parameter; | ||
export interface Path { | ||
$ref?: string; | ||
get?: Operation; | ||
put?: Operation; | ||
post?: Operation; | ||
delete?: Operation; | ||
options?: Operation; | ||
head?: Operation; | ||
patch?: Operation; | ||
parameters?: Parameter2[]; | ||
} | ||
export interface Path3 { | ||
$ref?: string; | ||
get?: Operation3; | ||
put?: Operation3; | ||
post?: Operation3; | ||
delete?: Operation3; | ||
options?: Operation3; | ||
head?: Operation3; | ||
patch?: Operation3; | ||
parameters?: Parameter3[]; | ||
} | ||
export interface Operation { | ||
tags?: string[]; | ||
summary?: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
operationId: string; | ||
consumes?: string[]; | ||
produces?: string[]; | ||
parameters?: Parameter2[]; | ||
responses: { | ||
[name: string]: Response; | ||
}; | ||
schemes?: Protocol[]; | ||
deprecated?: boolean; | ||
security?: Security[]; | ||
[key: string]: unknown; | ||
} | ||
export interface Operation3 { | ||
tags?: string[]; | ||
summary?: string; | ||
description?: string; | ||
externalDocs?: ExternalDocs; | ||
operationId: string; | ||
consumes?: string[]; | ||
parameters?: Parameter3[]; | ||
responses: { | ||
[name: string]: Response3; | ||
}; | ||
schemes?: Protocol[]; | ||
deprecated?: boolean; | ||
security?: Security[]; | ||
requestBody?: RequestBody; | ||
} | ||
export interface RequestBody { | ||
content: { | ||
[name: string]: MediaType; | ||
}; | ||
description?: string; | ||
required?: boolean; | ||
} | ||
export interface MediaType { | ||
schema?: Schema3; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
encoding?: { | ||
[name: string]: any; | ||
}; | ||
} | ||
export interface Response { | ||
description: string; | ||
schema?: Schema; | ||
headers?: { | ||
[name: string]: Header; | ||
}; | ||
examples?: Example; | ||
} | ||
export interface Response3 { | ||
description: string; | ||
content?: { | ||
[name: string]: Schema & Example; | ||
}; | ||
headers?: { | ||
[name: string]: Header3; | ||
}; | ||
} | ||
export interface BaseSchema { | ||
type?: string; | ||
format?: DataFormat; | ||
$ref?: string; | ||
title?: string; | ||
description?: string; | ||
default?: string | boolean | number | any; | ||
multipleOf?: number; | ||
maximum?: number; | ||
exclusiveMaximum?: number; | ||
minimum?: number; | ||
exclusiveMinimum?: number; | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
maxProperties?: number; | ||
minProperties?: number; | ||
enum?: Array<string | number | null>; | ||
'x-enum-varnames'?: string[]; | ||
items?: BaseSchema; | ||
} | ||
export interface Schema3 extends Omit<Schema, 'type'> { | ||
type?: DataType; | ||
nullable?: boolean; | ||
anyOf?: BaseSchema[]; | ||
allOf?: BaseSchema[]; | ||
deprecated?: boolean; | ||
} | ||
export interface Schema2 extends Schema { | ||
properties?: { | ||
[propertyName: string]: Schema2; | ||
}; | ||
['x-nullable']?: boolean; | ||
['x-deprecated']?: boolean; | ||
} | ||
export interface Schema extends BaseSchema { | ||
type?: DataType; | ||
format?: DataFormat; | ||
additionalProperties?: boolean | BaseSchema; | ||
properties?: { | ||
[propertyName: string]: Schema3; | ||
}; | ||
discriminator?: string; | ||
readOnly?: boolean; | ||
xml?: XML; | ||
externalDocs?: ExternalDocs; | ||
example?: unknown; | ||
required?: string[]; | ||
} | ||
export interface Header { | ||
description?: string; | ||
type: 'string' | 'number' | 'integer' | 'boolean' | 'array'; | ||
format?: string; | ||
items?: BaseSchema; | ||
collectionFormat?: 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'; | ||
default?: string | boolean | number | any; | ||
maximum?: number; | ||
exclusiveMaximum?: boolean; | ||
minimum?: number; | ||
exclusiveMinimum?: boolean; | ||
maxLength?: number; | ||
minLength?: number; | ||
pattern?: string; | ||
maxItems?: number; | ||
minItems?: number; | ||
uniqueItems?: boolean; | ||
enum?: Array<string | number | null>; | ||
multipleOf?: number; | ||
} | ||
export interface Header3 extends BaseSchema { | ||
required?: boolean; | ||
description?: string; | ||
example?: unknown; | ||
examples?: { | ||
[name: string]: Example3 | string; | ||
}; | ||
schema: Schema; | ||
type?: DataType; | ||
format?: DataFormat; | ||
} | ||
export interface XML { | ||
type?: string; | ||
namespace?: string; | ||
prefix?: string; | ||
attribute?: string; | ||
wrapped?: boolean; | ||
} | ||
interface BaseSecurity { | ||
description?: string; | ||
} | ||
interface BaseOAuthSecurity extends BaseSecurity { | ||
scopes?: OAuthScope; | ||
} | ||
export interface BasicSecurity3 extends BaseSecurity { | ||
type: 'http'; | ||
scheme: 'basic'; | ||
} | ||
export interface BasicSecurity extends BaseSecurity { | ||
type: 'basic'; | ||
} | ||
export interface ApiKeySecurity extends BaseSecurity { | ||
type: 'apiKey'; | ||
name: string; | ||
in: 'query' | 'header'; | ||
} | ||
export interface OAuth2Security3 extends BaseSecurity { | ||
type: 'oauth2'; | ||
flows: OAuthFlow; | ||
} | ||
export interface OAuth2SecurityFlow3 extends BaseSecurity { | ||
tokenUrl?: string; | ||
authorizationUrl?: string; | ||
scopes?: OAuthScope; | ||
} | ||
export interface OAuth2ImplicitSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
description?: string; | ||
flow: 'implicit'; | ||
authorizationUrl: string; | ||
} | ||
export interface OAuth2PasswordSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'password'; | ||
tokenUrl: string; | ||
} | ||
export interface OAuth2ApplicationSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'application'; | ||
tokenUrl: string; | ||
} | ||
export interface OAuth2AccessCodeSecurity extends BaseOAuthSecurity { | ||
type: 'oauth2'; | ||
flow: 'accessCode'; | ||
tokenUrl: string; | ||
authorizationUrl: string; | ||
} | ||
export interface OAuthScope { | ||
[scopeName: string]: string; | ||
} | ||
export type OAuthFlow = { | ||
[flowName in OAuth2FlowTypes]?: OAuth2SecurityFlow3; | ||
}; | ||
export type OAuth2FlowTypes = 'authorizationCode' | 'implicit' | 'password' | 'clientCredentials'; | ||
export type Security = BasicSecurity | BasicSecurity3 | ApiKeySecurity | OAuth2AccessCodeSecurity | OAuth2ApplicationSecurity | OAuth2ImplicitSecurity | OAuth2PasswordSecurity | OAuth2Security3; | ||
export {}; | ||
} |
@@ -1,3 +0,11 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=swagger.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.Swagger = void 0; | ||
var Swagger; | ||
(function (Swagger) { | ||
function isQueryParameter(parameter) { | ||
return parameter.in === 'query'; | ||
} | ||
Swagger.isQueryParameter = isQueryParameter; | ||
})((Swagger = exports.Swagger || (exports.Swagger = {}))); | ||
//# sourceMappingURL=swagger.js.map |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.assertNever = void 0; | ||
@@ -8,5 +8,5 @@ /** | ||
function assertNever(value) { | ||
throw new Error("Unhandled discriminated union member: " + JSON.stringify(value)); | ||
throw new Error('Unhandled discriminated union member: ' + JSON.stringify(value)); | ||
} | ||
exports.assertNever = assertNever; | ||
//# sourceMappingURL=assertNever.js.map | ||
//# sourceMappingURL=assertNever.js.map |
@@ -5,2 +5,6 @@ /** | ||
*/ | ||
export declare type IsValidHeader<Header> = keyof Header extends string | number ? Header[keyof Header] extends string | string[] | undefined ? {} : 'Header values must be string or string[]' : 'Header names must be of type string'; | ||
export declare type IsValidHeader<Header> = keyof Header extends string | number | ||
? Header[keyof Header] extends string | string[] | undefined | ||
? {} | ||
: 'Header values must be string or string[]' | ||
: 'Header names must be of type string'; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=isHeaderType.js.map | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
//# sourceMappingURL=isHeaderType.js.map |
{ | ||
"name": "@tsoa/runtime", | ||
"description": "Build swagger-compliant REST APIs using TypeScript and Node", | ||
"version": "3.7.0", | ||
"version": "3.8.0", | ||
"main": "./dist/index.js", | ||
@@ -28,7 +28,7 @@ "typings": "./dist/index.d.ts", | ||
"dependencies": { | ||
"moment": "^2.24.0", | ||
"validator": "^12.2.0" | ||
"validator": "^13.6.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.11.1", | ||
"@types/validator": "^13.1.3", | ||
"typescript": "^4.1.2" | ||
@@ -48,3 +48,3 @@ }, | ||
}, | ||
"gitHead": "8f0e7f93acf822cadf54463613170dfaaa017ea1" | ||
"gitHead": "641f12c32440b1b146c59ba7fc74f7f54cf1d383" | ||
} |
@@ -44,2 +44,3 @@ import { ExtensionType } from '../decorators/extension'; | ||
validators: Validators; | ||
deprecated: boolean; | ||
} | ||
@@ -87,2 +88,3 @@ | ||
validators: Validators; | ||
deprecated: boolean; | ||
} | ||
@@ -253,2 +255,3 @@ | ||
example?: unknown; | ||
deprecated: boolean; | ||
} | ||
@@ -255,0 +258,0 @@ |
@@ -1,2 +0,1 @@ | ||
import * as moment from 'moment'; | ||
import validator from 'validator'; | ||
@@ -258,4 +257,3 @@ import { assertNever } from '../utils/assertNever'; | ||
public validateDate(name: string, value: any, fieldErrors: FieldErrors, validators?: DateValidator, parent = '') { | ||
const momentDate = moment(String(value), moment.ISO_8601, true); | ||
if (!momentDate.isValid()) { | ||
if (!validator.isISO8601(String(value), { strict: true })) { | ||
const message = validators && validators.isDate && validators.isDate.errorMsg ? validators.isDate.errorMsg : `invalid ISO 8601 date format, i.e. YYYY-MM-DD`; | ||
@@ -297,4 +295,3 @@ fieldErrors[parent + name] = { | ||
public validateDateTime(name: string, value: any, fieldErrors: FieldErrors, validators?: DateTimeValidator, parent = '') { | ||
const momentDateTime = moment(String(value), moment.ISO_8601, true); | ||
if (!momentDateTime.isValid()) { | ||
if (!validator.isISO8601(String(value), { strict: true })) { | ||
const message = validators && validators.isDateTime && validators.isDateTime.errorMsg ? validators.isDateTime.errorMsg : `invalid ISO 8601 datetime format, i.e. YYYY-MM-DDTHH:mm:ss`; | ||
@@ -301,0 +298,0 @@ fieldErrors[parent + name] = { |
@@ -24,3 +24,3 @@ export namespace Swagger { | ||
paths: { [name: string]: Path }; | ||
definitions?: { [name: string]: Schema }; | ||
definitions?: { [name: string]: Schema2 }; | ||
parameters?: { [name: string]: Parameter }; | ||
@@ -47,3 +47,3 @@ responses?: { [name: string]: Response }; | ||
responses?: { [name: string]: Response }; | ||
schemas?: { [name: string]: Schema | Schema3 }; | ||
schemas?: { [name: string]: Schema3 }; | ||
securitySchemes?: { [name: string]: Security }; | ||
@@ -107,2 +107,3 @@ } | ||
format?: DataFormat; | ||
deprecated?: boolean; | ||
} | ||
@@ -120,2 +121,6 @@ | ||
export function isQueryParameter(parameter: BaseParameter): parameter is QueryParameter { | ||
return parameter.in === 'query'; | ||
} | ||
export interface PathParameter extends BaseParameter { | ||
@@ -135,2 +140,4 @@ in: 'path'; | ||
export type Parameter = BodyParameter | FormDataParameter | QueryParameter | PathParameter | HeaderParameter; | ||
export type Parameter2 = Omit<Parameter & { 'x-deprecated'?: boolean }, 'deprecated'>; | ||
export type Parameter3 = Parameter; | ||
@@ -146,3 +153,3 @@ export interface Path { | ||
patch?: Operation; | ||
parameters?: Parameter[]; | ||
parameters?: Parameter2[]; | ||
} | ||
@@ -159,3 +166,3 @@ | ||
patch?: Operation3; | ||
parameters?: Parameter[]; | ||
parameters?: Parameter3[]; | ||
} | ||
@@ -171,3 +178,3 @@ | ||
produces?: string[]; | ||
parameters?: Parameter[]; | ||
parameters?: Parameter2[]; | ||
responses: { [name: string]: Response }; | ||
@@ -188,3 +195,3 @@ schemes?: Protocol[]; | ||
consumes?: string[]; | ||
parameters?: Parameter[]; | ||
parameters?: Parameter3[]; | ||
responses: { [name: string]: Response3 }; | ||
@@ -253,6 +260,9 @@ schemes?: Protocol[]; | ||
allOf?: BaseSchema[]; | ||
deprecated?: boolean; | ||
} | ||
export interface Schema2 extends Schema { | ||
properties?: { [propertyName: string]: Schema2 }; | ||
['x-nullable']?: boolean; | ||
['x-deprecated']?: boolean; | ||
} | ||
@@ -259,0 +269,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
4423
230421
3
+ Addedvalidator@13.12.0(transitive)
- Removedmoment@^2.24.0
- Removedmoment@2.30.1(transitive)
- Removedvalidator@12.2.0(transitive)
Updatedvalidator@^13.6.0