Overview
This guide provides general strategies and best practices for upgrading tsoa between major versions. For specific version migrations, see the dedicated migration guides.Upgrade Strategy
Pre-Upgrade Checklist
Before upgrading tsoa, ensure you have:Review release notes
Always read the release notes for the target version:
- Breaking changes
- New features
- Deprecated features
- Known issues
Check Node.js compatibility
Verify your Node.js version meets the requirements:
Check your Node.js version:
| tsoa Version | Minimum Node.js |
|---|---|
| v7.x | 18.0.0 |
| v6.x | 18.0.0 |
| v5.x | 14.0.0 |
| v4.x | 12.0.0 |
Verify TypeScript version
Ensure your TypeScript version is compatible:
| tsoa Version | Minimum TypeScript |
|---|---|
| v7.x | 5.2.2 |
| v6.x | 5.3.3 |
| v5.x | 4.9.5 |
| v4.x | 4.x |
Upgrade Process
Fix compilation errors
Address any TypeScript compilation errors:Common issues:
- Decorator imports may have changed
- Type definitions may have been refined
- Configuration options may have been renamed
Testing Your Upgrade
Automated Testing
Create tests to verify the upgrade:test/upgrade.spec.ts
Manual Testing
Test API endpoints
Test API endpoints
Test all your endpoints manually:
Validate OpenAPI spec
Validate OpenAPI spec
Use online validators to check your spec:Or use online tools:
Test authentication
Test authentication
Verify security configurations:
Test file uploads
Test file uploads
If using file uploads:
Common Issues
Import Errors
Problem: Decorators or types cannot be importedError
Fixed
Configuration Changes
Problem: Configuration file not recognized Solution: Check for deprecated configuration options:Validation Errors
Problem: Runtime validation behaves differently Solution: Review validation decorators:Generated Code Issues
Problem: Generated routes have syntax errors Solution:- Delete generated files
- Clear tsoa cache:
rm -rf node_modules/.tsoa - Regenerate:
npx tsoa spec-and-routes
OpenAPI Spec Validation
Problem: Generated spec is invalid Solution: UseadditionalProperties correctly:
Version-Specific Guides
For detailed migration instructions:v6 to v7 Migration
OpenAPI 3.1.0 support and validation improvements
v5 to v6 Migration
Node.js 18 requirement and TypeScript 5 support
Major Version Changes Summary
tsoa v7 (2025)
- OpenAPI 3.1.0 support
- Enhanced circular reference handling
- Zod infer type support
- TypeScript 5.7+ support
- Improved generic type resolution
tsoa v6 (2023)
- Node.js 18+ required
- TypeScript 5+ support
- ESM improvements (.mts, .cts support)
- OpenID Connect security
- Enhanced validation for intersections and unions
tsoa v5 (2022)
- Improved metadata generation
- Better type inference
- Enhanced route generation
Rollback Procedure
If the upgrade fails:Best Practices
1. Incremental Upgrades
Don’t skip major versions. Upgrade incrementally:2. Use Lock Files
Always commit yourpackage-lock.json or yarn.lock:
3. Test in Staging
Never upgrade directly in production:- Test in local development
- Deploy to staging environment
- Run full test suite
- Deploy to production
4. Monitor After Upgrade
Watch for issues after upgrading:- Response times
- Error rates
- Validation failures
- OpenAPI spec compatibility
5. Document Changes
Keep a migration log:MIGRATION_LOG.md
Getting Help
GitHub Issues
Report bugs or search existing issues
Discussions
Ask questions and share experiences
Configuration Reference
Review configuration options
API Reference
Explore decorator and API documentation
Next Steps
After successfully upgrading:- Update documentation: Refresh your API documentation with the new OpenAPI spec
- Notify consumers: Inform API consumers of any changes
- Monitor logs: Watch for unexpected behavior
- Update CI/CD: Ensure deployment pipelines work with the new version
- Review new features: Explore new capabilities introduced in the upgrade