Data Validation

Kuzzle natively provides a way to validate the documents you want to create, replace, update or publish against a validation specification. You can specify the validation rules in the kuzzle configuration file in validation.

A specification is always attached to the collection of an index.

The API offers several actions to perform on specifications, allowing to get, update, delete or validate them. You can refer to the API documentation for more information.

A specification is composed of three properties:

  • The fields property: this property is intended to describe the document's fields. It includes the definition of their type, boundaries, if they're required or not etc. depending on the type of the field.
  • The validators property: this property is intended to match the document using DSL filters. It allows to build conditionnal filters, acceptance criterias, etc.
  • The strict property: this property specifies if the field specification is strict. If it is, the addition of unknown fields (i.e. not defined in the fields property) is forbidden and will be rejected.