Data Validator

Snap type:

Transform

Description:

This Snap provides the functionality to validate incoming data against a set of defined constraints.
Available constraints are:

  • Pattern
  • Minimum
  • Maximum
  • MinLength
  • MaxLength
  • Required
  • Type

An example of a pattern can be seen in the following image:

The pattern constraint in the screenshot above validates all incoming documents and their attributes a.c.b against the regular expression ^abc, expecting that all attribute values of a.c.b start with abc. If they do, the document is routed to the output view; otherwise, the document is routed to the error view.

  • Pattern is a regular expression, defined as a string value.
  • Minimum and Maximum can only be defined for number values. Allowed constraint values are numbers. 
  • MinLength and MaxLength can only be defined for string values. Allowed constraint values are integers. 
  • Required can be defined for any value and will verify that a value exists. The Constraint value field is ignored for the Required constraint.
  • Type can be defined for any source path. The default is object. Valid type definitions are: string, number, object, array, boolean, date, time, date-time, local-date-time, any.

The type constraint should be defined last in case there are multiple constraints defined for a source path.

Prerequisites:

N/A

Support and limitations:

Works in Ultra Tasks.

The Data