class-validator is a TypeScript class validation library that uses decorators to define constraints and rules for object properties. It functions as a decorator-based schema validator that ensures data integrity and structural correctness through a combination of synchronous checks and promise-based asynchronous rules.
The library provides a recursive validation system for checking complex data hierarchies, including nested classes and individual elements within collections. It includes an object property whitelist utility capable of stripping undocumented properties or blocking unknown fields from entering a validated class instance.
The framework covers a broad range of capabilities, including custom validation rule definition, conditional execution, and validation grouping for context-specific schemas. It also supports dynamic error message interpolation and the integration of external services via dependency injection for custom constraints.