Creates a new instance of validation schema and sets its values.
a type of map keys. Null means that keys may have any type.
a type of map values. Null means that values may have any type.
(optional) true to always require non-null values.
(optional) a list with validation rules.
Gets the type of map keys. Null means that keys may have any type.
the type of map keys.
Gets validation rules to check values against.
a list with validation rules.
Gets the type of map values. Null means that values may have any type.
the type of map values.
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 the type of map keys. Null means that keys may have any type.
a type of map keys.
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 map values. Null means that values may have any type.
a type of map values.
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 maps.
Example
let schema = new MapSchema(TypeCode.String, TypeCode.Integer); schema.validate({ "key1": "A", "key2": "B" }); // Result: no errors schema.validate({ "key1": 1, "key2": 2 }); // Result: element type mismatch schema.validate([ 1, 2, 3 ]); // Result: type mismatch