A schema-based object validation library for JavaScript, currently at version 2.0.1. It provides synchronous and asynchronous (Promise-based) validation, supports custom types, one-of type validation, custom validators, and nested schema definitions. Features include validating required/optional fields, object structure, keys, and custom error messages. It is commonly used for form validation but can validate any object. The library offers a simple API with a Schema class and validate method, and allows control over key validation via the validateKeys flag. It is maintained intermittently with low release cadence.
npm install form-schema-validationNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic synchronous validation: define schema with type and required constraints, validate an object, and check for errors.
Ensure the model argument is an object before calling validate().
const errors = await schema.validate(model);
Set { validateKeys: false } in constructor options to allow extra keys.Ensure all schema fields are defined or use optional chaining.
Handle the promise returned by validate() and catch errors.
Coerce or convert the model value to match the schema type.
No dependency data recorded yet.