Using older version of Indicative or @adonisjs/validator?. Click here to access the old version documentation.

guides

validate

The validate method performs the data validation using the schema object.

The API for validateAll method is also identical.

data

The data object to validate.

rules

An object of rules schema.

messages

An object of messages schema

options

The optional options receives the same configure options, along with the cacheKey.

The optional cacheKey can be defined to cache the compiled schema, which results in huge performance gains.

If you are using Indicative with a Web server, then we recommend using the current request url as the cache key and Indicative will parse the schema only once for that request url.