Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Validation Module

The Validation module can verify that the contents of a message in a Mule flow match a 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.

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.

Supported Validation Operations

The following types of validation are supported:

Is Blank String

Verifies that value is a blank String.

Is Email

Checks that a given email is valid. The value defaults to the payload.

Is Empty Collection

Verifies that value is an empty collection.

Is False

Verifies that an expression is false.

Is IP

Checks that a given IP address is valid. It supports both IPV4 and IPV6. In the case of IPV6, both full and collapsed addresses are supported, but addresses containing ports are not.

Is Not Blank String

Verifies that value is not a blank String.

Is Not Empty Collection

Verifies that a value is not an empty collection. The value defaults to the payload.

Is Not Null

Fails if the value is null or is an instance of NullPayload.

Is Null

Fails if the value is not null and is not an instance of NullPayload.

Is Number

Verifies that a String can be parsed as a number of a specified numeric type.

Is Time

Verifies that a time is valid for the given pattern and locale. If no pattern is provided, then the locale’s default will be used.

Is True

Verifies that an expression is true.

Is URL

Validates that a given String can be interpreted as a URL. This is done by invoking the URL(String) constructor in the java.net.URL class. If this constructor throws exception, then the validation fails. Any String that this constructor accepts is considered valid.

Matches Regex

Validates that a given expression matches a Java regular expression.

Validate Size

Validates that the input’s size is between given min and max boundaries. It is valid for inputs of type String, Collection, Map, and Array. In the case of a String, the size refers to the length in characters.

Is Whitelisted IP

Validates that a given IP is in the whitelisted ip list.

Is Blacklisted IP

Validates that a given IP is not in the blacklisted ip list.

Is Elapsed Time

Validates that a given time has elapsed some specified time.

Is Not Elapsed Time

Validates that a given time has not elapsed some specified time.