wadofgum-validation
A validation mixin for wadofgum based on joi.
Usage
After extending your model with this mixin, instances of your class will have a validate
method. This method returns a promise that resolves when validation is complete, or throws if validation fails.
To provide a schema for validation, assign it to the schema
property on your class. Most Joi features are covered, including type coercion, required keys, renaming keys, and more.
const Wadofgum = ;const Validation = ;const Joi = ; {};Modelschema = Joiobject name: Joi age: Joi; let model = name: 'test' age: '45' ;model;
If the wadofgum-events mixin is also loaded, this module will emit preValidate
and postValidate
events.