Validation
A validate()
method will be added to the prototype of structures, this method will validate the structure based on its schema. The method will return an object with the property valid
(with the value true
if it's valid, and false
if invalid). If valid
is false
the returned object will also have a property errors
, with an array of validation errors.
Validations require you to use the complete type descriptor:
Structure has a set of built-in validations built on top of the awesome joi package:
Observations
Validations marked with * accept a value, an attribute reference, or an array of values and attribute references mixed.
Validations marked with ** accept a value or an attribute reference.
Last updated