Learn about different types of properties validation
Validators help ensure that user input meets certain criteria or constraints. Below are some examples of validator functions:
Checks if the processed value matches a specific regular expression.
Verifies if the processed string length is within a specified maximum limit.
Verifies if the processed string length is within a specified minimum limit.
Ensures that the processed numeric value is greater than or equal to a specified minimum.
Ensures that the processed numeric value is less than or equal to a specified maximum.
Checks if the processed numeric value falls within a specified range.
Validates whether the processed value is one of the specified values.
Validates whether the processed value is a valid number.
Validates whether the processed value is strictly NOT zero. Designed to be used with Validators.number
Verifies whether the processed value is a valid image file based on its extension.
Ensures that the processed value is a valid file.
Validates whether the processed value is a valid email address.
Ensures that the processed value is a valid URL.
Validates whether the processed value is a valid ISO-formatted date and time.
Example:
Note: The custom validator allows you to define your own validation logic and error message. It can be used to perform complex validations beyond the provided built-in validators.
Processors act as data transformers, enabling you to transform or process user input before further processing.
To add a custom processor, you can define a function with this type ProcessorFn
that takes two parameters: The function should return the processed value. Here’s an example:
Learn about different types of properties validation
Validators help ensure that user input meets certain criteria or constraints. Below are some examples of validator functions:
Checks if the processed value matches a specific regular expression.
Verifies if the processed string length is within a specified maximum limit.
Verifies if the processed string length is within a specified minimum limit.
Ensures that the processed numeric value is greater than or equal to a specified minimum.
Ensures that the processed numeric value is less than or equal to a specified maximum.
Checks if the processed numeric value falls within a specified range.
Validates whether the processed value is one of the specified values.
Validates whether the processed value is a valid number.
Validates whether the processed value is strictly NOT zero. Designed to be used with Validators.number
Verifies whether the processed value is a valid image file based on its extension.
Ensures that the processed value is a valid file.
Validates whether the processed value is a valid email address.
Ensures that the processed value is a valid URL.
Validates whether the processed value is a valid ISO-formatted date and time.
Example:
Note: The custom validator allows you to define your own validation logic and error message. It can be used to perform complex validations beyond the provided built-in validators.
Processors act as data transformers, enabling you to transform or process user input before further processing.
To add a custom processor, you can define a function with this type ProcessorFn
that takes two parameters: The function should return the processed value. Here’s an example: