New Reference Documentation
Remaining planned breaking changes:
-
@ symbol in @example for types causes Swagger generation problems
-
Default output name for the spec
- swagger.(json|yaml)
+ openapi.(json|yaml)
We are planning to offer a setting to change the name of the generated OAS file.
Track the Status of the overall progress towards a stable 3.0 here
Fixed bugs:
- Aliased void Api Response types document 200 response instead of 204 #629 (WoH)
- ValidateError should extend Error #661 (aldenquimby)
New Features:
- feat: ignore class methods #643 (Eywek)
- feat: handle enum members #656 (Eywek)
- deps: add glob #654 (Eywek)
- fix: refType with {}, [] and { foo: number } #652 (Eywek)
- Upgrade koa-router to @koa/router, fix type errors #646 (michaelbeaumont)
- Remove object type #642 (dimitor115)
- Fix adding static properties to model definition #639 (dimitor115)
- feat: handle indexed types #636 (Eywek)
- feat: handle
typeof
#635 (Eywek) @format
support for type aliases #620 (jfrconley)
Breaking Changes:
- Use Spec instead of Swagger (
tsoa swagger
is still available for now, but will be removed eventually) #664 (WoH)
Calling the tsoa command
- tsoa swagger
+ tsoa spec
- tsoa swagger-and-routes
+ tsoa spec-and-routes
Manually calling spec generation
- await generateSwaggerSpec(swaggerConfig, routesConfig, compilerOptions, config.ignore);
+ await generateSpec(openapiConfig, compilerOptions, config.ignore);
tsoa.json:
{
"swagger": {}
}
becomes
{
"spec": {}
}
Instead of duplicating config and handling a lot of edge cases, the new config is a lot simpler.
Config settings, that impact both routes and spec are now located at the top level of the config object.
{
"entryFile": "./tests/fixtures/express/server.ts",
"noImplicitAdditionalProperties": "silently-remove-extras",
"routes": {},
"spec": {}
}
This means if your settings are different (for example the entry file), you'll have to call the generateRoutes()
and generateSpec()
yourself.
Note that these methods now have a simpler config aswell:
- await generateSwaggerSpec(swaggerConfig, routesConfig, compilerOptions, config.ignore);
+ await generateSpec(openapiConfig, compilerOptions, config.ignore);
- await generateRoutes(routesConfig, swaggerConfig, compilerOptions, config.ignore);
+ await generateRoutes(routesConfig, compilerOptions, config.ignore);
EntryFile and noImplicitAdditionalProperties can now be set on the swagger/routesConfig.
Also, boolean settings for noImplicitAdditionalProperties have been removed: #503
Valid settings are now: 'throw-on-extras' | 'silently-remove-extras' | 'ignore'
, everything else falls back to 'ignore'
.
For reference, see the TS interface of the entire config here