BaseValidationType

Abstract class, used to create custom validation types (see the validation accessor).


Constructor

This class constructor takes no argument.


Properties

Property Type Description
allowChildren
boolean
If false, the field must be a scalar
allowedTypeOptions
string[]
The list of allowed data type options
typeName
string
Data type name

validate (abstract)

Validates a field against this implemented data type.

This is an abstract method. If not overloaded, it always returns true

Arguments

Copied to clipboard!
validate(opts, field, errors);

Arguments Type Description
opts
object
Data type options. The provided object can only contain the keys defined in the allowedTypeOptions property
field
*
Data to validate
errors
string[]
If the provided field is not valid, the reason must be pushed in that array

Return

The validate function returns a boolean telling whether the field is valid.


validateFieldSpecification (abstract)

Validates a new configuration for this data type.

This is an abstract method. If not overloaded, it always returns true

Arguments

Copied to clipboard!
validateFieldSpecification(opts);

Arguments Type Description
opts
object
Data type options. The provided object can only contain the keys defined in the allowedTypeOptions property

Return

The validateFieldSpecification returns a copy of the opts object, updated with interpreted values.

If the provided options are not valid, this function is expected to throw a KuzzleError error.