How lukeautry/tsoa works
Main Components
a. Core Components:
• CLI Package (Command Line Interface)
• Runtime Package
• Main TSOA Package
• Framework Integration Layer (Express, Hapi, Koa)
b. Key Processing Components:
• Metadata Generation System
• Route Generation System
• Swagger/OpenAPI Spec Generation
• Decorator System
┌─ Input Layer ─────────────────────────────┐
• TypeScript Controllers & Decorators │
• ┬─────────────────────┘
• ↓
┌─ Processing Layer ────────────────────────┐
• ┌─────────────────┐ ┌─────────────────┐ │
• Metadata │ │Route │ │
• Generation │←→│Generation │ │
• ┘ └─────────────────┘ │
• ┌─────────────────┐ ┌─────────────────┐ │
• Swagger/OpenAPI │ │Template │ │
• Generation │ │Processing │ │
• ┘ └─────────────────┘ │
• ┬─────────────────────┘
• ↓
┌─ Output Layer ──────────────────────────┐
• ┌─────────────┐ ┌────────┐ ┌─────────┐ │
• Express │ │Hapi │ │Koa │ │
• Routes │ │Routes │ │Routes │ │
• ┘ └────────┘ └─────────┘ │
• ┘
Key Relationships
a. Data Flow:
• TypeScript controllers → Metadata Generation
• Metadata → Route Generation
• Metadata → Swagger/OpenAPI Spec Generation
• Route Generation → Framework-specific routes
b. Dependencies:
• How the CLI package orchestrates the process
• How the Runtime package provides core functionality
• Demonstrate framework adapter relationships
Important Subsystems to Detail
a. Metadata Generation:
• Controller Generator
• Method Generator
• Parameter Generator
• Type Resolution System
b. Route Generation:
• Template System
• Framework-specific adapters
• Middleware handling
c. Swagger/OpenAPI Generation:
• Spec Generator (v2 & v3)
• Schema Generation
• Path Generation
Additional Elements
• Version compatibility information
• Configuration flow
• Test coverage and validation points
Implementation Details
Use standardized UML or C4 notation:
• Diamonds for aggregation relationships