Overview
tsoa v7.0.0 introduces OpenAPI 3.1.0 support, enhanced TypeScript compatibility, and several improvements to validation and type handling. This guide will help you migrate from v6.x to v7.x.Prerequisites
Before upgrading, ensure your project meets these requirements:- Node.js: v18.0.0 or higher (unchanged from v6)
- TypeScript: v5.2.2 or higher
- Yarn: v1.9.4 or higher (if using Yarn)
Breaking Changes
OpenAPI 3.1.0 Support
tsoa v7 adds support for OpenAPI 3.1.0, which is now the default specification version whenspecVersion is set to 3.1 in your configuration.
Update specVersion configuration
If you want to use OpenAPI 3.1.0, update your
tsoa.json configuration:tsoa.json
Validation Improvements
Circular Reference Handling
v7 includes improved handling of circular references in validation schemas.Before (v6)
After (v7)
Deep Model Error Output
Validation error messages for deeply nested models have been trimmed to prevent output explosion:Type System Enhancements
Zod Infer Type Support
tsoa v7 adds support for Zod’sinfer type on response types:
Generic Type Resolution
Improved generic type resolution for query parameters:New Features
OpenAPI 3.1.0 Schema Generation
When usingspecVersion: 3.1, tsoa generates OpenAPI 3.1.0-compliant schemas:
Tuple Type Support
OpenAPI 3.1.0 introduces better tuple support usingprefixItems:
Enhanced Status Code Support
Support for HTTP 425 Too Early status code:Base Path Slash Options
Improved handling of base path slashes for more flexible routing:tsoa.json
/api/v1 and api/v1 configurations.
Migration Steps
Update TypeScript configuration
Ensure your
tsconfig.json uses TypeScript 5.x features:tsconfig.json
Choose your OpenAPI version
Decide whether to use OpenAPI 3.0.x or 3.1.0:
Using OpenAPI 3.0.x (Recommended for compatibility)
Using OpenAPI 3.0.x (Recommended for compatibility)
Keep your existing configuration:
tsoa.json
Using OpenAPI 3.1.0 (New features)
Using OpenAPI 3.1.0 (New features)
Update to OpenAPI 3.1.0:
tsoa.json
Test validation
Test your API thoroughly, especially:
- Circular reference models
- Deep nested object validation
- Generic type parameters
- Tuple types (if using OpenAPI 3.1.0)
Deprecated Features
Multer Options in Config
ThemulterOpts configuration option in tsoa.json is now deprecated:
Deprecated (Still works in v7)
Recommended
Package Structure
tsoa v7 maintains the same package structure as v6:tsoa: Main package (includes both CLI and runtime)@tsoa/cli: CLI tools for code generation@tsoa/runtime: Runtime decorators and types
7.0.0-alpha.0.
Dependency Updates
Key dependency updates in v7:| Package | v6 | v7 |
|---|---|---|
| TypeScript | ^5.3.3 | ^5.7.2 |
| Node.js | >=18.0.0 | >=18.0.0 |
| validator | ^13.11.0 | ^13.12.0 |
| glob | ^10.3.10 | ^10.4.5+ |
| reflect-metadata | ^0.1.13 | ^0.2.2 |
Rollback Plan
If you encounter issues with v7, you can rollback to v6:package.json
Getting Help
If you encounter migration issues:- Check the GitHub Issues
- Review the v7.0.0-alpha.0 release notes
- Join the discussion on GitHub Discussions
Next Steps
Configuration Reference
Review all configuration options for tsoa v7
OpenAPI Versions
Learn about OpenAPI 3.0.x vs 3.1.0 differences
Validation
Understand validation improvements in v7
GitHub Releases
View all release notes and changelogs