A flexible schema validation library for JavaScript objects, designed for REST APIs and beyond. Version 1.0.16 supports Node >=18.0.0. Key features include type casting (e.g., string to number), data transformation (trimming whitespace), and a pluggable architecture for custom rules. Unlike many validators, it offers create/replace/patch semantics, nested object and array validation, recursive runtime validation, and adapters for React Hook Form, Vue+Vuetify, and VeeValidate. The library returns a flat error map with dotted paths for nested fields, making it easy to associate errors with UI components.
npm install json-rest-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a schema, validate user input with type casting and transformation, and handle errors.
Use import syntax (ESM) or dynamic import().
Upgrade Node.js to version 18 or later.
Use Object.keys(errors) or for...in to iterate errors, not .get/.set methods.
Always use the full dot-separated path as the key in errors.
Manually cast non-primitive types in custom rules or preprocess data.
Change to import statement or use dynamic import().
Upgrade Node.js to >=18.0.0.
Check that the error object exists and has the expected structure before accessing properties like .field.
Register a custom type handler using the plugin API before using it in a schema.
No dependency data recorded yet.