Joi is the most powerful schema description language and data validator for JavaScript. Version 18.2.1 is the current stable release, with regular updates and a comprehensive API for defining schemas using a fluent, chainable syntax. It provides detailed error messages, custom validation, and extensive type support. Joi is widely used for validating API inputs, configuration objects, and form data, and offers a rich plugin ecosystem. It stands out with its expressive API and strong community support.
npm install joiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines and validates a user object schema with string, number, and boolean fields, demonstrating async validation.
Use import instead of require; upgrade Node to >=12.
Replace .keys() with direct object definition.
Upgrade Node to >=20.
Use Joi.any().allow(null).allow('') to allow null/empty strings explicitly.Use Joi.string().email({ tlds: false }) to allow TLD-less emails if needed.Change require('joi') to import Joi from 'joi'; or use dynamic import().Use Joi.object({...}).unknown(true) to allow unknown keys, or add the field to the schema.Upgrade to Joi v17+ or use .validate() with callback (deprecated).
No dependency data recorded yet.