ValidationSteps in Entities
Last updated
Last updated
The validationSteps of an Entity should contain exactly one contentValidation.
Internally, the ValidationStep that contains the contentValidation is refered to as the "contentValidationStep", or the "mid validationStep".
The validationSteps that are before the contentValidationStep are refered to as the "early validationSteps".
The validationSteps that are after the contentValidationStep are refered to as the "late validationSteps"..
Example : An Entity that has 5 validationSteps, and the third one contains the contentValidation :
The name
parameter of the ValidationStep is optional. If you omit it, it will be replaced by a default name :
Default name | Example | |
---|---|---|
1 | Early1 | InvalidPersonEarly1 |
2 | Early2 | InvalidPersonEarly2 |
3 | Early3 | InvalidPersonEarly3 |
... | ... | ... |
If there's only one early validationStep, then its default name is 'Early' (instead of 'Early1').
Default name | Example |
---|---|
Mid | InvalidPersonMid |
Default name | Example | |
---|---|---|
1 | Late1 | InvalidPersonLate1 |
2 | Late2 | InvalidPersonLate2 |
3 | Late3 | InvalidPersonLate3 |
... | ... | ... |
If there's only one late validationStep, then its default name is 'Late' (instead of 'Late1').
During the contentValidationStep, the contentValidation is processed. So, if the Entity passes the contentValidationStep, it means that all the modddels it holds are valid.
As a result, the union-cases that come after the contentValidationStep all hold the valid version of the modddels. We call this the Valid param transformations.
For example : Let's say we have a Person
SimpleEntity that has two fields : Age age
and FullName name
. This entity has 4 validationSteps named from 'Step1' to 'Step4', the second being the contentValidationStep.
All the union-cases after InvalidPersonStep2
will hold the valid version of the modddels : ValidAge age
and ValidFullName name
. These union-cases are :
The ones matching the "late" validationSteps : InvalidPersonStep3
and InvalidPersonStep4
The "valid" union-case : ValidPerson
.