EntityValidations
The entityValidations section allows you to create the business rules validations using an entity, ensuring, for example, data consistency before persistence.
This validation type doesn't depend on a context and execution order and can be used in one or more service, if needed.
Fields
An entityValidation contains the following fields to be defined:
Name
The name of entityValidation to be created.
Requirements Rules:
- Is Required;
- Must not be a Reserved Keyword;
- Must start with a letter;
- Must contains only letters, numbers and the underline char ('_');
- Max length of 50 chars
Example:
1 2 |
|
Type
The type of validation to be created.
Possible types are:
- PropertyValidation: Allows you to validate the entity properties values, ensuring data consistency;
- ExistsReferenceById: Allows you to validate whether the value entered for a foreign key property in your entity exists in the database through the Id
Requirements Rules:
- Is Required;
- Must be an Allowed valid type, according to the types informed above
Example:
1 2 3 |
|
EntityName
The name of business entity to which validation will be applied.
Requirements Rules:
- Is Required;
- The name must exist in Entities list in the current model;
- See Entity section for more details.
Example:
1 2 3 4 |
|
PropertyValidationParams
The list of validation rules for the entity properties linked to the current entityValidation. Required to configure PropertyValidation type validation.
Requirements Rules:
- Must be filled out only for the PropertyValidation type;
- Each item on list must follows rules as specified in PropertyValidationParam
Example:
1 2 3 4 5 6 7 8 9 |
|
ExistsReferenceByIdParams
Information regarding foreign key property and repository for record validation. Required to configure ExistsReferenceById type validation.
Requirements Rules:
- Must be filled out only for the ExistsReferenceById type;
- Must follow the rules as specified in ExistsReferenceByIdParams
Example:
1 2 3 4 5 6 7 |
|
Complete Example
See below for a complete example, containing all the properties for the EntityValidations section.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|