Cutelyst  2.13.0
Modules | Classes
Validator

Provides an API to validate input values. More...

Collaboration diagram for Validator:

Modules

 Rules
 Classes providing rules to validate input data.
 

Classes

class  Cutelyst::Validator
 Validation processor for input data. More...
 
class  Cutelyst::ValidatorMessages
 Stores custom error messages and the input field label. More...
 
class  Cutelyst::ValidatorResult
 Provides information about performed validations. More...
 
class  Cutelyst::ValidatorReturnType
 Contains the result of a single input parameter validation. More...
 
class  Cutelyst::ValidatorRule
 Base class for all validator rules. More...
 

Detailed Description

The Validator plugin provides an API to validate input values that are send by a user to the application, typically in the request body if it is a POST request or the URL query if it is a GET request. The plugin already provides validator rules for common tasks and input types but can be extended by deriving a new rule class from ValidatorRule. Validator rules are not meant to be used on their own but as part of the Validator class that processes the input data. However some validator rules export their validation logic in a static member function that can be used without Validator directly on a value. See the documentation of Validator to learn more about how to use it.

Logging

Information is logged to the cutelyst.utils.validator logging category. Failed validation will only be logged if debug output is enabled. Other errors like failed parsing and missing validation data will be logged to the warning category.

Building and using

The plugin is linked to Cutelyst Core API and the QtNetwork module. To use it in your application, link your application to Cutelyst::Utils::Validator.

Optional validators

ValidatorPwQuality relies on libpwquality and will not be included and build by default. Use either -DPLUGIN_VALIDATOR_PWQUALITY:BOOL=ON or -DBUILD_ALL:BOOL=ON when configuring Cutelyst for build with cmake.