Validation Module Documentation Reference
Validation Module v2.0
The Validation module can verify that the contents of a message in a Mule flow match specific criteria. The module provides explicit messages about the cause of an exception in a flow. Based on the specific data you are validating, you can customize the exception message that is displayed in the logs.
A module that performs data validations. If the validation fails, an error is thrown. The error type might vary but it will always be a child of VALIDATION:VALIDATION.
If a message does not meet the defined validation criteria, the validation fails and returns a VALIDATION
error (such as VALIDATION:INVALID_URL
), which is a ValidationException
. By default, this message includes a meaningful message that you can customize.
Release Notes: Validation Module Release Notes
Configurations
Config
Default configuration
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Name |
String |
Name for this configuration. Connectors reference the configuration with this name. |
x |
|
I18n |
Allows to configure I18n for the standard error messages |
|||
Name |
String |
ID used to reference this configuration. |
x |
|
Expiration Policy |
Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. |
Is Allowed Ip
<validation:is-allowed-ip>
Validates that an IP address is present in the IP list.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Ip Address |
String |
Address to validate. |
x |
|
Allow List |
List of allowed addresses. |
x |
||
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings.. |
Is Blank String
<validation:is-blank-string>
Validates that value is a blank String.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
String |
Value to check. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Elapsed
<validation:is-elapsed>
Validates that a given time has elapsed since the specified initial time.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Time |
Number |
the interval size |
x |
|
Time Unit |
Enumeration, one of:
|
the interval unit (as a TimeUnit) |
x |
|
Since |
DateTime |
the time to validate |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Email
<validation:is-email>
Validates that the email address is valid.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
String |
an email address |
x |
||
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Empty Collection
<validation:is-empty-collection>
Validates that value is an empty collection.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Values |
Array of Any |
the value to check |
#[payload] |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is False
<validation:is-false>
Validates that the given value is false
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Expression |
Boolean |
The boolean to test. |
false |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is IP
<validation:is-ip>
Validates that an IP address represented as a String is valid.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Ip |
String |
IP address to validate. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Not Blank String
<validation:is-not-blank-string>
Validates that value is not a blank String.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
String |
String to check. |
#[payload] |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Not Denied Ip
<validation:is-not-denied-ip>
Validates that an IP address is not present in the IP list.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Ip Address |
String |
Address to validate. |
x |
|
Deny List |
List of denied addresses. |
x |
||
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Not Elapsed
<validation:is-not-elapsed>
Validates that a given time has not elapsed since the specified initial time.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Time |
Number |
Interval size |
x |
|
Time Unit |
Enumeration, one of:
|
Interval unit (as a TimeUnit). |
x |
|
Since |
DateTime |
Time to validate. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Not Empty Collection
<validation:is-not-empty-collection>
Validates that value is not an empty collection.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Values |
Array of Any |
Value to check. |
#[payload] |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Not Null
<validation:is-not-null>
Validates that the given value is not null
. Keep in mind that the definition of null
can vary depending on the mimeType value. For example, for an application/java
mimeType, null
means a blank pointer. However, if the mimeType is application/json
then the String null
is also a null
value.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
Any |
Value to test. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Null
<validation:is-null>
Validates that the given value is null
. Keep in mind that the definition of null
can vary depending on the mimeType value. For example, for an application/java
mimeType, null
means a blank pointer. However, if the mimeType is application/json
, then the String null
is also a null
value.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
Any |
Value to test. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Number
<validation:is-number>
Receives a numeric value as a String and validates that it can be parsed per the rules of a numberType.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
String |
Value to test. |
x |
|
Locale |
String |
Locale used for the format. If not provided it defaults to the system Locale. |
||
Pattern |
String |
Pattern used to format the value. |
||
Min Value |
String |
If provided, check that the parsed value is greater or equal than this valu.e |
||
Max Value |
String |
If provided, check that the parsed value is less or equal than this value. |
||
Number Type |
Enumeration, one of:
|
Type of number to test value against. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is Time
<validation:is-time>
Validates that a time in String format is valid for the given pattern and locale. If no pattern is provided, then the locale’s default is used.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Time |
String |
A date in String format. |
x |
|
Locale |
String |
Locale of the String |
||
Pattern |
String |
Pattern for the date. |
||
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is True
<validation:is-true>
Validates that the given value is true
.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Expression |
Boolean |
Boolean to test. |
false |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Is URL
<validation:is-url>
Validates that url is valid.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
URL |
String |
URL to validate as a String. |
x |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Matches Regex
<validation:matches-regex>
Validates that the value matches to the regex regular expression.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
String |
Value to check |
x |
|
Regex |
String |
Regular expression to check against the value. |
x |
|
Case Sensitive |
Boolean |
When |
true |
|
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Validate Size
<validation:validate-size>
Validates that value has a size between certain inclusive boundaries. This validator is capable of handling instances of String, collection, map and arrays.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
Name of the configuration to use. |
x |
|
Value |
Any |
Value to validate. |
x |
|
Min |
Number |
Minimum expected length (inclusive, defaults to zero) |
0 |
|
Max |
Number |
Maximum expected length (inclusive). Leave unspecified or null to allow any max length. |
||
Config Ref |
ConfigurationProvider |
Name of the configuration to use to execute this component. |
||
Message |
String |
Specifies the message to notify the user if the validation fails. The message is marked as not dynamic to allow eager evaluation of the expression in case the validation is successful and the message is not required. Components consuming this value check if this is an expression and evaluate it in case the validation failed. |
||
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
All
<validation:all>
Perform a list of nested validation operations and informs only one VALIDATION:MULTIPLE error which summarizes all of the found errors (if any).
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Any
<validation:any>
Perform a list of nested validation operations and informs only one VALIDATION:MULTIPLE error which summarizes all of the found errors (if all failed).
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Error Mappings |
Array of Error Mapping |
Set of error mappings. |
Types
I18n
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Bundle Path |
String |
Path to a bundle file containing the messages. If null then the platform chooses a default one. |
x |
|
Locale |
String |
Locale of the null the platform chooses the system default. |
Expiration Policy
Configures an expiration policy strategy.
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max Idle Time |
Number |
Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration. |
||
Time Unit |
Enumeration, one of:
|
Time unit for the Max Idle Time field. |