Validation

Rules Framework Validations are used to check the validity of business data without needing to call out to a domain function or external domain.

Overview

A validation takes a single input value. For each context the rules are applied in order, each returning the result. Each rule can be annotated with an error code and description.

An example validation on a pain.001 is shown below:

example validation

Input Data

Input data can refer to Java classes.

When referring to a Java class, a Java Record Link is automatically generated and imported. The link is required to bridge the Java class with an equivalent Kernel F record, which can be used in expressions.

Rules

Each set of rules is composed of an input context, some rulesets, and the rules themselves.

Input Context

The input context determines which component of the input the validation should apply to. This can be any fields on the input class. For instance, on the CustomerCreditTransferInitiationV09 this can be the grpHdr, pmtInf, or splmtryData. If the field is a list, the rules are applied to each instance. If no input context is provided, the root is used by default

Rulesets

Rulesets allow validations to call other validations. They consist of a reference to the 'sub' validation, a condition that must pass in order for that validation to be called, and the component of the input to call the validation on.

Rules

Rules define the checks that are performed on the input to determine its validity. Each rule contains a condition, an expression and an error code and description. The rules are applied in order.

If the condition for the rule is false, it is skipped. Conditions by default are true but can be set to any expression or can be conditional on previous rules.

Each rule has an error code and a description for if the rule fails. They can be found by opening the inspector and selecting the rule.

To open the inspector, either right-click and choose Inspect Node or use the shortcut alt+2
validation inspector

Output Data

The validation returns a ValidationReport which contains the status of the validation and a list of results for each rule.

Additional Resources