Skip to content

CONSOLIDATED - IN SET

Description

The IN SET validator is designed to check if a field's value is within a provided set of values. This validator supports both STRING and INTEGER data types, making it versatile for various data validation needs. It is particularly useful for ensuring that data conforms to a predefined list of acceptable values.


Config Location

To configure the IN SET validator, you need to define it within the consDPValidators section of your data point configuration within the schema. This involves specifying the validator name and entity.


Supported Data Types

  • STRING
  • INTEGER

Config Requirements

Config ({}) options are required for the IN SET validator. If no configuration is provided or if the configuration is improperly set up, a block violation will be thrown. For more information on Apiro violations and their appearance in the Apiro UI or logs, refer to the violations section.


Example Config

Below is an example of how to configure the IN SET validator in XML format. This example demonstrates a validator that checks if the "NAME" data point is within a specified set of values, with the option to ignore case sensitivity.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<dataPoint name="NAME" dataType="STRING">
    <consDPValidators>
        <consDPValidator name="GET_IN_SET" entity="IN_SET">
            <config>
                <![CDATA[
                    {
                        "options" : ["Tom","tom","Thomas","thomas"],
                        "ignoreCase" : false
                    }
                ]]>
            </config>
        </consDPValidator>
    </consDPValidators>
</dataPoint>

Example Result

  • the IN SET validator will compare the current "NAME" value against the specified set of values
  • If the value is not found within the set then
  • a violation will be triggered, indicating that the value does not meet the criteria for acceptability.

Config Parameters

name acceptable values comment
options An array of strings or integers representing the set of acceptable values. This defines the set of values that the field's value must be within.
ignoreCase A boolean value indicating whether to ignore case sensitivity in the comparison. If set to true, the validator will ignore case when comparing values.

Common Mistakes

  • Ensure that the validator name and entity are correctly defined in the configuration to ensure that the validator is correctly identified and applied during the data processing pipeline.
  • Verify that the configuration parameters within the <config> tag are correctly written and match the expected format and values.
  • Remember that the configuration for the IN SET validator is required. If no configuration, or improper configuration is provided then a block violation will be thrown.