
A strapi plugin to tunning strapi validations
The strapi-plugin-validator is a plugin created on top of the Indicative project, maintained by Adonis.js. Its purpose is to simplify the management of validations on Strapi projects and enhance the standard validation of Strapi content-types. It provides a better response structure to the frontend.
validators.jsonTo integrate the plugin with your project, create a new file called validators.json inside your content-types, extensions, or plugins folders. Here is an example structure for the file:
{
"validators": {
"user": {
"message": "Bad Request",
"rules": {
// Validation rules here
}
}
}
}
The validators property is mandatory and serves to configure the plugin. You can have multiple validators inside it for different purposes. The user property in this example is an identifier for your validator, and it can be any name you want. It will be used to relate validators to each other if necessary.
Inside the user validator, you can provide a message property (optional) with a generic fail message for the request. If not provided, the default message is "Bad Request". The rules property should contain the validation rules for the validator.
The rules property supports three types of value structure: Array, Object, or String.
For more information on available validation rules and customization, refer to the Indicative project documentation.
The strapi-plugin-validator is a plugin that simplifies the management of validations in Strapi projects. It enhances the standard validation of Strapi content-types and provides a better response structure to the frontend. By creating a validators.json file and configuring validators with the desired rules, developers can easily enforce validation in their Strapi applications.

Strapi is an open source headless CMS that provides a customizable content management system and API for your projects. It allows you to manage content in a visual interface and use a REST or GraphQL API to retrieve the data.