Creates a new instance of validation schema and sets its values.
a type of array elements. Null means that elements may have any type.
(optional) true to always require non-null values.
(optional) a list with validation rules.
Gets validation rules to check values against.
a list with validation rules.
Gets the type of array elements. Null means that elements may have any type.
the type of array elements.
Gets a flag that always requires non-null values. For null values it raises a validation error.
true to always require non-null values and false to allow null values.
Makes validated values optional. Validation for null values will be skipped.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
this validation schema
Makes validated values always required (non-null). For null values the schema will raise errors.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
this validation schema
Validates a given value to match specified type. The type can be defined as a Schema, type, a type name or TypeCode When type is a Schema, it executes validation recursively against that Schema.
a dot notation path to the value.
a type to match the value type
a value to be validated.
a list with validation results to add new results.
Validates a given value against the schema and configured validation rules.
a dot notation path to the value.
a value to be validated.
a list with validation results to add new results.
Sets a flag that always requires non-null values.
true to always require non-null values and false to allow null values.
Sets validation rules to check values against.
a list with validation rules.
Sets the type of array elements. Null means that elements may have any type.
a type of array elements.
Validates the given value and results validation results.
a value to be validated.
a list with validation results.
Validates the given value and returns a ValidationException if errors were found.
(optional) transaction id to trace execution through call chain.
a value to be validated.
true to treat warnings as errors.
Validates the given value and throws a ValidationException if errors were found.
(optional) transaction id to trace execution through call chain.
a value to be validated.
true to treat warnings as errors.
Adds validation rule to this schema.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
a validation rule to be added.
this validation schema.
Generated using TypeDoc
Schema to validate arrays.
Example
let schema = new ArraySchema(TypeCode.String); schema.validate(["A", "B", "C"]); // Result: no errors schema.validate([1, 2, 3]); // Result: element type mismatch schema.validate("A"); // Result: type mismatch