awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
typestack avatar

typestack/class-validator

0
View on GitHub↗
11,796 stars·845 forks·TypeScript·MIT·45 views

Class Validator

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.

Features

  • Data Validation - Ensures TypeScript class properties meet specific criteria using decorators to maintain data integrity and type safety.
  • Class Property Validation - Checks that class properties meet specific criteria using decorators to ensure data integrity before processing.
  • Property Whitelisting - Compares object keys against decorated class properties to strip or block non-whitelisted data.
  • Asynchronous Validators - Supports promise-based asynchronous rules for verifying data against external sources or databases.
  • Contextual Validation Groups - Assigns decorators to specific groups to apply different validation schemas to the same object in different contexts.
  • Recursive Hierarchy Validation - Provides a recursive validation system for checking complex data hierarchies and individual elements within collections.
  • Strict Schema Enforcers - Blocks objects containing properties not defined in the class to ensure strict adherence to the data schema.
  • Asynchronous Validation - Wraps validation checks in promises to allow for network requests or database lookups before returning results.
  • Schema Tree Traversers - Recursively walks through nested objects and collections to apply validation rules across deep data hierarchies.
  • Custom Validation Rules - Allows defining reusable validation logic by implementing constraint interfaces and registering them globally.
  • Nested Object Validation - Recursively checks properties that are instances of other decorated classes or multi-dimensional arrays.
  • Recursive Object Validation - Implements a recursive validation system for verifying complex data hierarchies, including nested classes and collections.
  • Decorator-Based Validation - Uses TypeScript decorators to define constraints and rules for object properties as metadata.
  • Validation Grouping - Filters which validation constraints to run by matching active group names against metadata tags.
  • Validation Libraries - Offers a comprehensive library of decorator-driven rules for verifying data integrity and structural correctness in TypeScript classes.
  • Additional Property Filtering - Removes properties without decorators from an object or triggers errors when non-whitelisted properties are found.
  • Metadata Collection - Uses TypeScript decorators to store validation constraints as metadata for runtime retrieval.
  • Conditional Validation Rules - Allows skipping specific property checks based on boolean condition functions or property-level triggers.
  • Conditional Enforcement - Supports applying specific sets of validation constraints based on active group tags for context-dependent schemas.
  • Dependency-Injected Constraints - Enables providing external tools and data to custom validation constraint classes via a service container.
  • Input Sanitization - Includes an object property whitelist utility to strip undocumented properties and prevent unknown fields from entering the system.
  • Property Strictness - Provides a whitelist utility that ensures objects contain only specified keys by stripping or prohibiting extra properties.
  • Array Schema Validation - Applies validation rules to every individual element within arrays, sets, or maps.
  • Dependency Injection Containers - Integrates a service container to resolve custom validation logic and provide external dependencies to validators.
  • Request Validation - Provides utilities to validate incoming request data against class-based schemas to ensure security and correctness.
  • External Data Validation - Processes properties that return promises to allow for validation requiring external data or API calls.
  • Data Validation - Decorator-based class property validation.

Star history

Star history chart for typestack/class-validatorStar history chart for typestack/class-validator

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Open-source alternatives to Class Validator

Similar open-source projects, ranked by how many features they share with Class Validator.
  • hapijs/joihapijs avatar

    hapijs/joi

    21,192View on GitHub↗

    Joi is a JavaScript data validation library used to define schemas that validate, cast, and sanitize data objects. It functions as an object schema validator and parser, ensuring that input data matches specific types and formats before it is processed by an application. The library features a conditional validation engine capable of dynamic schema enforcement, where validation logic and dependencies change based on the values of other keys within an object. It also serves as a data casting and sanitization tool, transforming input values into target types and removing sensitive keys from the

    JavaScripthapijavascriptschema
    View on GitHub↗21,192
  • open-circle/valibotopen-circle avatar

    open-circle/valibot

    8,769View on GitHub↗

    Valibot is a modular, type-safe schema library for validating and parsing structural data in TypeScript environments.

    TypeScriptbundle-sizemodularparsing
    View on GitHub↗8,769
  • jquense/yupjquense avatar

    jquense/yup

    23,673View on GitHub↗

    Yup is a JavaScript schema validation library used to define data shapes and validate runtime values. It functions as an object schema validator and a data coercion engine, allowing developers to transform raw input values into desired types before performing validation checks. The library is distinguished by its support for dynamic schema validation, where rules can be adjusted at runtime based on sibling field values or external context. It also enables recursive data structuring for polymorphic fields and provides a system for extracting static TypeScript interfaces from runtime schema def

    TypeScript
    View on GitHub↗23,673
  • go-ozzo/ozzo-validationgo-ozzo avatar

    go-ozzo/ozzo-validation

    4,072View on GitHub↗

    ozzo-validation is a programmable data validation library for Go that verifies structs, maps, and primitive types using a declarative, rule-based approach. It functions as an interface-based validator, allowing for the recursive checking of nested data structures and custom types without the use of struct tags. The framework distinguishes itself as a context-aware validation engine, supporting the propagation of request-scoped data to rules that depend on external state. It provides extensive extensibility through custom rule definitions and the ability to override default failure text with l

    Gogogolangozzo
    View on GitHub↗4,072
See all 30 alternatives to Class Validator→

Frequently asked questions

What does typestack/class-validator do?

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.

What are the main features of typestack/class-validator?

The main features of typestack/class-validator are: Data Validation, Class Property Validation, Property Whitelisting, Asynchronous Validators, Contextual Validation Groups, Recursive Hierarchy Validation, Strict Schema Enforcers, Asynchronous Validation.

What are some open-source alternatives to typestack/class-validator?

Open-source alternatives to typestack/class-validator include: hapijs/joi — Joi is a JavaScript data validation library used to define schemas that validate, cast, and sanitize data objects. It… open-circle/valibot — Valibot is a modular, type-safe schema library for validating and parsing structural data in TypeScript environments. jquense/yup — Yup is a JavaScript schema validation library used to define data shapes and validate runtime values. It functions as… go-ozzo/ozzo-validation — ozzo-validation is a programmable data validation library for Go that verifies structs, maps, and primitive types… yiminghe/async-validator — async-validator is a JavaScript schema validation library and asynchronous data validation engine. It verifies complex… neoremind/fluent-validator — Fluent-validator is a Java validation framework designed to enforce data integrity through declarative constraints and…