For declarative data schemas, the strongest matches are ianstormtaylor/superstruct (Superstruct is a TypeScript-first library that allows you to), samuelcolvin/pydantic (Pydantic is a comprehensive, industry-standard library for defining data) and ajv-validator/ajv (Ajv is a high-performance, code-first validation library that uses). pydantic/pydantic and colinhacks/zod round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Explore the best declarative data schema libraries. Compare top-rated tools by features and activity to find the best fit for your project.
Superstruct is a JavaScript and TypeScript data validation library used to verify that data structures match defined shapes and types. It functions as a composable schema builder and a TypeScript schema validator, ensuring that runtime data checks remain synchronized with static type definitions. The library features a data coercion engine that transforms input values or injects default values before the validation process is executed. It enables the creation of complex validation rules by nesting, merging, or omitting properties from existing structures. Its capabilities cover the validatio
Superstruct is a TypeScript-first library that allows you to define complex, nested data schemas declaratively while providing runtime validation and automatic type inference, perfectly matching the requirements for a code-first validation tool.
Pydantic is a data validation library and parsing framework for Python. It functions as a type-based schema validator that uses standard Python type annotations to ensure input data conforms to predefined structural schemas. The project provides capabilities for parsing raw data into typed objects through automatic type conversion and validation. This includes the serialization of data and the validation of data structures to enforce correctness. The framework covers several application areas, including the verification of API requests and the management of application configurations. It all
Pydantic is a comprehensive, industry-standard library for defining data schemas and enforcing runtime validation using Python type annotations, perfectly matching the requirement for declarative, code-first data modeling.
Ajv is a high-performance data validation framework that compiles JSON schemas into optimized, standalone JavaScript functions. By transforming declarative schema definitions into executable code, it eliminates runtime interpretation overhead and provides a secure, efficient way to enforce data integrity across both browser and server environments. The library distinguishes itself through its focus on performance and type safety. It employs advanced compilation techniques, including abstract syntax tree optimization and function caching, to ensure rapid validation. Beyond standard checks, it
Ajv is a high-performance, code-first validation library that uses declarative JSON schemas to generate optimized, type-safe validation functions for both browser and server environments.
Pydantic is a data validation and serialization library that enforces schema constraints and performs type conversion on complex data structures. It utilizes standard Python type annotations to define data models, allowing developers to establish structured schemas that automatically enforce business rules and constraints without the need for custom domain-specific languages. The library distinguishes itself by transforming high-level model definitions into optimized code during initialization to minimize runtime overhead. It supports recursive validation for nested data structures and employ
Pydantic is a comprehensive, industry-standard library that uses Python type annotations to define declarative schemas, providing robust runtime validation, nested object support, and detailed error reporting.
Zod is a TypeScript-first schema declaration and validation library designed to ensure end-to-end data integrity. It functions as a runtime type guard, allowing developers to define complex data structures through a declarative, chainable syntax. By using these schema definitions, the library automatically derives static TypeScript types, eliminating the need for manual type duplication and ensuring that runtime data matches expected application contracts. The library distinguishes itself through functional schema composition, which enables the creation of hierarchical structures by nesting a
Zod is a TypeScript-first library that allows you to define complex, nested data schemas declaratively, providing both static type inference and robust runtime validation with detailed error reporting.
ow is a type-safe schema validation library for TypeScript that verifies data integrity at runtime. It functions as a runtime validation framework and type guard utility, ensuring that JavaScript values match expected types and schemas before they are processed. The library synchronizes runtime data checks with static TypeScript type definitions, allowing users to extract type definitions directly from validation predicates. This integration enables type narrowing, where a successful validation result refines the variable type for safer usage in the code. The framework uses a chainable API t
This library provides a declarative, chainable API for defining runtime validation rules and schema enforcement in TypeScript, making it a direct fit for code-first data validation.
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
Joi is a comprehensive, code-first schema validation library that provides a fluent API for defining complex, nested data structures with robust support for runtime validation, sanitization, and detailed error reporting.
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
Yup is a declarative, code-first schema validation library that provides type-safe definitions, runtime validation, and robust support for nested objects and detailed error reporting.
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
This library provides a declarative, code-first approach to data validation in Go, supporting nested structures and custom validation rules without relying on struct tags.
Valibot is a modular, type-safe schema library for validating and parsing structural data in TypeScript environments.
Valibot is a modular, code-first schema validation library that provides type-safe definitions and runtime validation for TypeScript, fitting the core requirements for declarative data structure management.
Joi is a JavaScript data validation library used to define schemas that ensure the structure and data types of objects remain consistent. It functions as a schema-based validator and object schema definition tool, preventing invalid information from entering an application by checking data against predefined constraints and rules. The library employs a chainable fluent interface and a constraint-based validation engine to build complex validation pipelines. It utilizes recursive tree traversal to validate nested data structures and a type-coercion pipeline to transform input values into the t
Joi is a comprehensive, code-first validation library that allows you to define complex, nested data schemas with a fluent interface and provides robust runtime validation and error reporting.
Ajv is a JSON Schema validator and schema compilation engine used to verify that JavaScript objects conform to specific JSON Schema definitions. It functions as a data coercer and localization tool, allowing for the application of default values and the translation of validation error messages into different languages. The project converts declarative JSON Schema definitions into optimized JavaScript functions to increase validation speed. It supports the extension of validation logic through custom keywords and the generation of standalone validation code that executes without external depen
Ajv is a high-performance JSON Schema validator that allows you to define data structures and validation rules declaratively, providing robust runtime validation, nested object support, and detailed error reporting.
Marshmallow is a Python data serialization library and validation framework. It functions as a bridge that transforms complex application objects into primitive data types for storage or network transmission and vice versa. The library utilizes a schema-based approach to validate that incoming data conforms to specific types and constraints. It employs a two-way transformation pipeline consisting of separate load and dump phases to handle deserialization and serialization. The framework supports class-based schema definitions with declarative field validation and recursive schema nesting for
Marshmallow is a declarative, schema-based library for Python that provides robust tools for defining data structures, performing runtime validation, and handling nested objects with detailed error reporting.
Arktype is a TypeScript runtime validation library and schema orchestrator. It synchronizes TypeScript types with runtime data validation, allowing users to define type-safe schemas that ensure unknown data adheres to specific structures during application execution. The project distinguishes itself by using set-theory type analysis to determine intersections and subtype compatibility, alongside JIT-compiled validation functions for optimized performance. It supports advanced type modeling through branded type constraints, recursive alias resolution, and the ability to generate runtime valida
Arktype is a declarative, code-first validation library that provides type-safe schema definitions and high-performance runtime validation, perfectly matching the requirements for structured data validation in TypeScript.
CUE is a constraint-based configuration language designed for data validation, schema definition, and code generation. At its core, it unifies types and values into a single concept, enabling compile-time validation that catches structural and value errors before runtime. The language treats data and constraints as the same thing, allowing a single definition to serve as both a schema and concrete configuration data. CUE distinguishes itself through its constraint-based unification engine, which combines multiple configuration sources into a single coherent result by merging their constraints
CUE is a powerful, constraint-based language specifically designed for declarative schema definition and data validation, offering robust support for nested structures, type safety, and detailed error reporting.
protobuf.js is a JavaScript and TypeScript library for encoding and decoding structured data using the Protocol Buffers binary format. It functions as a dynamic parser that can load and process schemas at runtime, a JSON transcoder for converting messages to human-readable formats, and a framework for building transport-agnostic remote procedure call clients. The project distinguishes itself by offering both dynamic message handling and a static code generator that produces TypeScript declarations and JavaScript modules to reduce runtime overhead. It also provides a reflection API for definin
This library provides a robust way to define data structures and perform runtime validation using Protocol Buffers, offering both dynamic schema parsing and static type generation for TypeScript.
Protocol Buffers is a language-neutral, platform-agnostic mechanism for serializing structured data. It provides a schema-driven toolchain that compiles declarative data definitions into type-safe source code, enabling consistent communication and strongly typed API contracts across services written in different programming languages. The project distinguishes itself through a highly efficient binary wire format that utilizes tag-based encoding and variable-width integer compression to minimize payload size and processing overhead. It supports robust evolutionary schema management, allowing d
Protocol Buffers is a schema-driven toolchain that allows you to define data structures declaratively and generate type-safe code for runtime validation and serialization across multiple languages.
Typia is a compile-time code generator that transforms TypeScript type annotations into runtime validation, serialization, and schema functions without requiring decorators or separate schema files. It generates optimized validation and serialization code during TypeScript compilation, producing dedicated functions for each type that eliminate runtime schema objects for faster execution. The project extends this core capability into several integrated areas. It generates fully typed client SDKs from NestJS controller source code, keeping server and client types synchronized automatically. It
Typia is a high-performance library that enables declarative, code-first data validation by transforming TypeScript types into optimized runtime validation functions, directly addressing the need for type-safe schema definition and validation.
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 field
This library provides a declarative, decorator-based approach to defining validation rules and schema constraints for TypeScript classes, making it a direct fit for code-first data validation.
Ent is a statically typed entity framework for Go that models database structures as a graph of nodes and edges. It functions as a code generation engine that transforms schema definitions into type-safe database clients, query builders, and migration scripts. By representing data as interconnected entities, the framework enables intuitive traversal of complex relationships and ensures that database interactions remain consistent with the application model at compile time. The framework distinguishes itself through its graph-based approach to data modeling and its reliance on compile-time cod
Ent is a code-first entity framework that allows you to define complex data schemas and validation rules in Go, which are then used to generate type-safe clients and enforce constraints at both the application and database levels.
SQLModel is a type-safe object-relational mapping library for Python that integrates database schema definitions with data validation logic. By combining these two roles into a single class, it allows developers to manage relational data structures and enforce data integrity for web APIs simultaneously. The framework is built to support asynchronous database operations, enabling high-performance applications to execute queries and transactions without blocking the main execution thread. The library distinguishes itself by leveraging Python type hints to provide IDE autocompletion and compile-
SQLModel allows you to define data structures and validation rules declaratively using Python type hints, serving as a robust tool for schema definition and runtime validation within the Python ecosystem.
Schema validation just got Pythonic
This library provides a declarative, code-first approach to defining data structures and performing runtime validation in Python, though it lacks the cross-language support requested.
This library provides a comprehensive system for defining data schemas and enforcing structural integrity within JavaScript applications. It enables developers to construct declarative rules for complex, nested objects, ensuring that data conforms to expected types and constraints before it is processed or stored. By integrating directly with the Meteor framework, it serves as a central tool for maintaining consistent data structures across collections and remote procedure calls. The project distinguishes itself through its deep integration with reactive data systems, allowing validation stat
This library provides a declarative way to define schemas and perform runtime validation for JavaScript objects, though it is specifically designed for the Meteor ecosystem rather than being a general-purpose, cross-language tool.
This library provides a framework for defining typed, immutable data structures in PHP. It enables developers to construct structured objects from raw input arrays, ensuring consistent data shapes and schema integrity across different layers of an application. By enforcing strict property types and validation rules during instantiation, the library prevents invalid data states and simplifies the handling of complex information. The project distinguishes itself through its use of attribute-driven metadata, which allows for property renaming, custom validation, and serialization logic directly
This library provides a declarative, code-first approach to defining data structures in PHP with built-in support for type safety, nested objects, and runtime validation.
Clojure(Script) library for declarative data description and validation
This library provides a declarative, code-first approach to defining data schemas and performing runtime validation in Clojure, directly addressing the core requirements for schema-based data integrity.
Schema-Inspector is a simple JavaScript object sanitization and validation module.
This library provides a declarative, code-first approach to defining validation rules and sanitization for JavaScript objects, directly addressing the need for runtime schema enforcement.
JSON Schema for PHP
This library provides a declarative way to define and validate JSON data structures against schemas in PHP, fulfilling the core requirement for runtime validation and nested object support.
| المستودع | النجوم | اللغة | الترخيص | آخر تحديث |
|---|---|---|---|---|
| ianstormtaylor/superstruct | 7.1K | TypeScript | MIT | |
| samuelcolvin/pydantic | 28K | Python | MIT | |
| ajv-validator/ajv | 14.7K | TypeScript | MIT | |
| pydantic/pydantic | 26.9K | Python | mit | |
| colinhacks/zod | 43K | TypeScript | MIT | |
| sindresorhus/ow | 3.9K | TypeScript | MIT | |
| hapijs/joi | 21.2K | JavaScript | NOASSERTION | |
| jquense/yup | 23.7K | TypeScript | MIT | |
| go-ozzo/ozzo-validation | 4.1K | Go | mit | |
| open-circle/valibot | 8.8K | TypeScript | MIT |