Contact Us 1-800-596-4880

Validation Module Documentation Reference

Validation Module v1.4

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.

Configurations


Default Configuration

Default configuration

Parameters

Name Type Description Default Value Required

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

I18n

Allows to configure I18n for the standard error messages

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. The runtime actually purge the instances as it sees fit.

Operations

Is Blank String

<validation:is-blank-string>

Validates that value is a blank String.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Value

String

the value to check

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:NOT_BLANK_STRING

Is Elapsed

<validation:is-elapsed>

Validates the amount of time that has elapsed since the moment in the since parameter is greater than an specified amount of time.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Time

Number

the interval size

x

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

the interval unit (as a TimeUnit)

x

Since

DateTime

the time to validate

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:NOT_ELAPSED_TIME

Is Email

<validation:is-email>

Validates that the email address is valid

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Email

String

an email address

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_EMAIL

Is Empty Collection

<validation:is-empty-collection>

Validates that value is an empty collection.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Values

Array of Any

the value to check

#[payload]

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:NOT_EMPTY_COLLECTION

Is False

<validation:is-false>

Validates that the given value is false

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Expression

Boolean

the boolean to test

false

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_BOOLEAN

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

The name of the configuration to use.

x

Ip

String

the ip address to validate

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_IP

Is Not Blacklisted Ip

<validation:is-not-blacklisted-ip>

Validates that a ipAddress is not present in the ipList.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Ip Address

String

the address to validate

x

Black List

the list of disallowed addresses

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_IP

  • VALIDATION:REJECTED_IP

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

The name of the configuration to use.

x

Value

String

the String to check

#[payload]

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:BLANK_STRING

Is Not Elapsed

<validation:is-not-elapsed>

Validates the amount of time that has elapsed since the moment in the since parameter is greater than an specified amount of time.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Time

Number

the interval size

x

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

the interval unit (as a TimeUnit)

x

Since

DateTime

the time to validate

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:ELAPSED_TIME

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

The name of the configuration to use.

x

Values

Array of Any

the value to check

#[payload]

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:EMPTY_COLLECTION

Is Not Null

<validation:is-not-null>

Validates that the given value is not null.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Value

Any

the value to test

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:NULL

Is Null

<validation:is-null>

Validates that the given value is null.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Value

Any

the value to test

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:NOT_NULL

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

The name of the configuration to use.

x

Value

String

the value to be tested

x

Locale

String

The locale to use for the format. If not provided it defaults to the system Locale

Pattern

String

The pattern used to format the value

Min Value

String

If provided, check that the parsed value is greater or equal than this value

Max Value

String

If provided, check that the parsed value is less or equal than this value

Number Type

Enumeration, one of:

  • INTEGER

  • LONG

  • SHORT

  • DOUBLE

  • FLOAT

the type of number to test value against

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_NUMBER

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 will be used

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Time

String

A date in String format

x

Locale

String

the locale of the String

Pattern

String

the pattern for the date

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_TIME

Is True

<validation:is-true>

Validates that the given value is true

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Expression

Boolean

the boolean to test

false

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_BOOLEAN

Is URL

<validation:is-url>

Validates that url is a valid one

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

URL

String

the URL to validate as a String

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_URL

Is Whitelisted Ip

<validation:is-whitelisted-ip>

Validates that a ipAddress is present in the ipList.

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Ip Address

String

the address to validate

x

White List

the list of allowed addresses

x

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_IP

  • VALIDATION:REJECTED_IP

Matches Regex

<validation:matches-regex>

Validates that value matches the regex regular expression

Parameters

Name Type Description Default Value Required

Configuration

String

The name of the configuration to use.

x

Value

String

the value to check

x

Regex

String

the regular expression to check against

x

Case Sensitive

Boolean

when true matching is case sensitive, otherwise matching is case in-sensitive

true

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:MISMATCH

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

The name of the configuration to use.

x

Value

Any

the value to validate

x

Min

Number

the minimum expected length (inclusive, defaults to zero)

0

Max

Number

the maximum expected length (inclusive). Leave unspecified or null to allow any max length

Message

String

Specifies the message that is to be notified to the user if the validation fails. It’s marked as not dynamic to allow eager evaluation of the expression in case that the validation is successful and the message is not needed. Components consuming this value are to manually check if this is an expression and evaluate it in case that the validation failed

For Configurations.

Throws

  • VALIDATION:INVALID_SIZE

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).

Throws

  • VALIDATION:MULTIPLE

Any

Available since version 1.3

<validation:any>

Perform a list of nested validation operations and informs one VALIDATION:MULTIPLE error which summarizes all of the found errors if none of the inner validations were successful.

Throws

  • VALIDATION:MULTIPLE

Types

I18n

Field Type Description Default Value Required

Bundle Path

String

The path to a bundle file containing the messages. If null then the platform will choose a default one

x

Locale

String

The locale of the null the platform will choose the system default

Expiration Policy

Field Type Description Default Value Required

Max Idle Time

Number

A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the maxIdleTime attribute

IP Filter List

Field Type Description Default Value Required

Ips

Array of String

x

View on GitHub