Create a new RoutesScanner instance
The root directory of the application
Collection of rules to apply during scanning
CLI UI instance to log colorful messages and progress information
The paths resolver is used to convert subpath and package imports to absolute paths
The rules to apply when scanning routes
Register a callback to self compute the response types for a given route. The callback will be executed for all the routes and you must return undefined to fallback to the default behavior of detecting types
Function to compute response types for routes
This RoutesScanner instance for method chaining
Register a callback to self compute the request types for a given route. The callback will be executed for all the routes and you must return undefined to fallback to the default behavior of detecting types
Function to compute request types for routes
This RoutesScanner instance for method chaining
Register a callback to extract validators from the route controller
Function to extract validators from controllers
This RoutesScanner instance for method chaining
Returns an array of controllers bound to the provided routes
Array of controller's absolute paths
Invalidating a controller will trigger computing the validators, request types and the response types.
Path to the controller file to invalidate
Scans an array of Route list items and fetches their validators, controllers, and request/response types.
This is the main method that processes all routes and extracts their type information for code generation purposes.
Array of route list items to scan
RoutesScanner is responsible for scanning application routes, extracting their controllers, validators, request and response types.
The RoutesScanner analyzes route definitions to extract TypeScript type information for request validation, response types, and controller methods. It supports custom rules for overriding default behavior and provides hooks for extending functionality.
Example