Simple validation framework using function references to execute validation process. Executed using validate() function which throws a ValidationError or passing with no result. The process executes all validation, even when first fails, allowing to extract all results from provided ValidationError, through ValidationError.errors.

Example:

void someValidation(String param) {
    throw Exception("INVALID ``param``");
}

validate {
    validations = {
        Single(`someValidation`, ["Abc"])
    };
};

[[validate]] has thrown and whenever caught result can be extracted.
Packages
herd.validx
Functions
validateshared void validate({Validation+} validations)

Entry point, executes validation process. If ValidationError is thrown has failed one or more verifications has been invalidated.

Parameters:
  • validations

    Validations to be executed

See also Single, Multi
Interfaces
Validationshared Validation

Defines a way to execute verification for validation.

Classes
Multishared Multi<Parameters>
given Parameters satisfies Anything[]

Multi verification, provides ability to execute verification over iterable parameters . Use default constructor if Parameters are provided eagerly, else Multi.extracted() to extract them lazily, when Multi.verify is called rather than durring Multi creation.

Singleshared Single<Parameters>
given Parameters satisfies Anything[]

Single verification, provides ability to execute once over all provided parameters. Use default constructor if Parameters are provided eagerly, else Single.extracted() to extract them lazily, when Single.verify is called rather than durring Single creation.

Validxshared Validx

Creatates validator for further use.

Exceptions
ValidationErrorshared ValidationError

Thrown whenever validation has invalidated