Skip to main content
Advanced validation rules let you react to contextual data, enforce dependencies between properties, and design predictable nested schemas.

Conditional rules

Use the when clause to activate a rule only if a condition evaluates to true. The condition uses the same operators as the search DSL on the profile’s property paths.

Supported operators

Combine multiple rules in the same array to express complex validation logic.

Nested objects

when clauses reference properties from the root of the profile. For nested structures, use dot notation:

Arrays of objects

Similar to the above, when using an operator on a property that is inside of an array, two choices are possible:
  1. If you want to test if at least one object/property of the array follows the clause, refer directly to the property (Inside or outside the array).
  2. If you want to test against another property in the same object (Property with the rule must also be in the same object), you can use the [current] clause.
This could result in profile definitions such as: Testing for the condition: “emailCC is required if ANY contact point system is of type "email"”:
Creating the following resource is valid: since no contact point has a system of type “email”, emailCC is not required.
Creating the following resource is not valid: since one contact point has a system of type “email”, emailCC is required.
Testing for the condition: “value must be defined if the contact system value is of type "email"”. The key contacts[current].system refers to the current item being evaluated in the contacts array.

Cardinality

Cardinality expresses how many instances of a property are allowed within a complex type.
Cardinality rules are enforced during validation. Missing required properties or over-populated single-valued properties will fail ingestion.

Continue with vocabulary binding to link fields to controlled concept sets.