Element <assert>¶
Purpose: Enforce a boolean data-quality invariant and stop execution when it is false.
Why: Use it to stop execution when a setup- or row-level data invariant is false.
Example¶
1 | |
Decision guide¶
Business value: Turns a data or setup requirement into a hard executable quality gate.
-
Use when
- Execution must stop if a boolean invariant is false.
-
Choose another approach when
- Invalid rows should be filtered or transformed instead of failing the run.
-
Prerequisites
- Provide a boolean condition and a message that explains the violated requirement.
-
Alternatives
- Use sourceConstraints to reject individual loaded rows before mapping. (See:
<sourceConstraints>) - Use targetConstraints to reject individual completed rows before export. (See:
<targetConstraints>)
- Use sourceConstraints to reject individual loaded rows before mapping. (See:
Complete examples¶
Stop before generation when a requirement invariant is false
Use assert to make a business precondition executable and fail before an invalid artifact is emitted.
| positive-batch-invariant/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 | |
Rules and invalid combinations¶
No additional element-specific rules. Required attributes, types, and supported values are shown below.
Allowed parents / Allowed children¶
Allowed parents: else, else-if, generate, if, iterate, nestedKey, setup, while
Allowed children:
None
Attributes¶
Show all 2 attributes
condition
Boolean expression the record (or setup context) must satisfy.
required; string.
message
Optional explanation surfaced when the assertion fails.
optional; string; Default: null.