Overview of Ajv JSON Schema Validator
masterAjv is a high-performance JSON validator for Node.js and the browser. It works by generating optimized code that turns JSON Schemas into highly efficient validation functions, making it suitable for performance-critical applications.
Supported Schema Standards
- JSON Schema Drafts: Supports
draft-06,draft-07,2019-09, and2020-12.- Note: Support for
draft-04requires the separateajv-draft-04package.
- Note: Support for
- JSON Type Definition (JTD): Supports RFC8927 including all JTD keywords, meta-schemas, and the
unionkeyword. - OpenAPI Extensions: Includes support for
discriminatorandnullablekeywords.
Key Features
- Remote & Recursive References: Full support for remote schemas (via
addSchema) and recursive references between schemas. - Data Modification: Supports removing additional properties, assigning defaults to missing properties, and coercing data types to match schema specifications.
- Validation Modes: Supports "All errors" mode via the
allErrorsoption and asynchronous validation for user-defined formats and keywords. - Extensibility: Supports user-defined keywords,
$datareferences, and additional extension keywords via theajv-keywordspackage. - Error Handling: Provides parameterized error messages for custom error generation and supports i18n via the
ajv-i18npackage.