awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
hapijs avatar

hapijs/joi

0
View on GitHub↗
21,192 星标·1,506 分支·JavaScript·9 次浏览

Joi

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 resulting output.

Its broader capabilities include enforcing primitive and complex data types, validating specific string formats, and implementing custom validation logic. The system supports the definition of alternative schemas, the application of default values, and the enforcement of collection size limits.

The engine is extensible via a plugin system that allows for the injection of custom types and validation logic.

Features

  • Data Validation Schemas - Implements a library for defining data structures and enforcing strict type safety and validation rules on input data.
  • Data Type Coercion - Provides built-in mechanisms to coerce input values into target types before applying validation rules.
  • Data Type Casting - Converts input values into required types, such as transforming numeric strings into numbers, before validation.
  • Data Validation - Enforces type safety and constraints on JavaScript data objects before processing.
  • Data Validation Libraries - Defines schemas to validate, cast, and sanitize data objects in JavaScript environments.
  • Conditional Validation Rules - Enforces validation rules dynamically based on the values of other keys within the object.
  • Conditional Enforcement - Applies conditional validation rules that change based on other values present in a data object.
  • Type Conversion and Casting - Transforms input values into target types and applies default values during validation.
  • Schema Tree Traversers - Traverses hierarchical schema structures using a depth-first process to validate nested objects and arrays.
  • Data Validation and Sanitization - Converts input types to required formats and removes sensitive keys from validated objects.
  • Context-Aware State Engines - Uses a shared internal context to evaluate rules based on the state of other object keys.
  • Cross-Field Dependencies - Links validation rules to the values of other keys within the same object or context.
  • Cross-Field Dependency Validations - Enforces complex relationships between object keys, such as requiring specific pairs or forbidding certain combinations.
  • Data Schema Validation - Enforces type safety and data consistency by validating objects against predefined rules.
  • Data Type Validation - Enforces that values match specific primitive or complex types according to a defined schema.
  • Object Schema Definitions - Provides utilities for defining and manipulating complex object structures and their properties through a schema-based approach.
  • Recursive Validation Engines - Employs a recursive engine to handle nested data structures by dispatching validation logic across type hierarchies.
  • Dependency Resolution - Resolves dependencies between fields to conditionally update validation requirements based on runtime input.
  • Length Constraints - Constrains the number of items in arrays or keys in objects using length requirements.
  • Complex Data Modeling - Defines strict relationships and dependencies between fields in large objects to maintain integrity.
  • Alternative - Supports flexible input types by matching values against multiple possible schema definitions.
  • Fluent Interface Patterns - Implements a fluent interface pattern for defining complex validation schemas via method chaining.
  • Input Sanitization - Cleans and transforms raw input values by casting types and removing sensitive keys.
  • Format Validators - Enforces specific string patterns for common formats like emails, URIs, and ISO dates.
  • Custom Validation Extensions - Allows the addition of user-defined methods to base schema types to implement domain-specific validation logic.
  • Custom Validation Rules - Provides a framework for extending validation logic with custom, domain-specific checks.
  • Schema Default Values - Assigns fallback values to fields when input data is missing or undefined.
  • Extensible Plugin Architectures - Features an extensible architecture that allows the injection of custom types and logic via plugins.
  • Request Validation - Validates incoming HTTP request bodies and parameters to ensure data integrity.
  • Data Utilities and Libraries - Powerful data validation library for JavaScript.
  • Data Validation - Object schema description and validation language.

Star 历史

hapijs/joi 的 Star 历史图表hapijs/joi 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

Joi 的开源替代方案

相似的开源项目,按与 Joi 的功能重合度排序。
  • jquense/yupjquense 的头像

    jquense/yup

    23,673在 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
    在 GitHub 上查看↗23,673
  • open-circle/valibotopen-circle 的头像

    open-circle/valibot

    8,769在 GitHub 上查看↗

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

    TypeScriptbundle-sizemodularparsing
    在 GitHub 上查看↗8,769
  • typestack/class-validatortypestack 的头像

    typestack/class-validator

    11,796在 GitHub 上查看↗

    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

    TypeScriptdecoratorstypescriptvalidation
    在 GitHub 上查看↗11,796
  • ianstormtaylor/superstructianstormtaylor 的头像

    ianstormtaylor/superstruct

    7,141在 GitHub 上查看↗

    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

    TypeScriptinterfacejavascriptschema
    在 GitHub 上查看↗7,141
查看 Joi 的所有 30 个替代方案→

常见问题解答

hapijs/joi 是做什么的?

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.

hapijs/joi 的主要功能有哪些?

hapijs/joi 的主要功能包括:Data Validation Schemas, Data Type Coercion, Data Type Casting, Data Validation, Data Validation Libraries, Conditional Validation Rules, Conditional Enforcement, Type Conversion and Casting。

hapijs/joi 有哪些开源替代品?

hapijs/joi 的开源替代品包括: jquense/yup — Yup is a JavaScript schema validation library used to define data shapes and validate runtime values. It functions as… open-circle/valibot — Valibot is a modular, type-safe schema library for validating and parsing structural data in TypeScript environments. typestack/class-validator — class-validator is a TypeScript class validation library that uses decorators to define constraints and rules for… ianstormtaylor/superstruct — Superstruct is a JavaScript and TypeScript data validation library used to verify that data structures match defined… ajv-validator/ajv — Ajv is a high-performance data validation framework that compiles JSON schemas into optimized, standalone JavaScript… elysiajs/elysia — Elysia is a high-performance TypeScript web framework designed for building type-safe backend services. It provides a…