Joi Schema
Last updated
Was this helpful?
Last updated
Was this helpful?
If you need more advanced schema validation gstore-node support Joi types and validator for your properties. is a powerful schema description language with a to validate your fields. It it specially useful for complex embedded entities validation or if you need more precision on your validation.
Important: if you decide to use Joi, you have to use it for all your properties. You cannot mix joi and gstore types and validation.
First make sure you have Joi installed
You can define a Joi type and validator by setting a joi setting on your schema property and set the Schema joi option to true.
Joi types can replace all the following settings of a property:
type
validate
default
values
required
But you still need to configure the following settings
excludeFromIndexes
read
write
If you need even more control over the schema validation you can define an extra **setting for joi. This will be applied on the complete Joi Schema object type.
The validate() method in Joi . You can pass it in the Schema options.