Does Legend PURE language support applying common validation across properties in multiple classes?
Description: Consider a scenario in which there is a similar property in 2 classes ex: email property in Employee Class and Customer Class. The type & pattern for email is same in both employee and customer class.
Current Legend Solution: We can create a function called emailValidation and validate the email. We can apply this constraint in Employee and Customer classes by passing email as a parameter to emailValidationFunction.
emailValidation function Code snippet: if($email->indexOf('@') > 1->minus(), |true, |false) && if($email->indexOf('.') > 1->minus(), |true, |false)
Consider if there are more common properties like phone number, employeeID etc, in this case we need to create multiple functions for each of the property. Also if the solution can cater for applying the common function to say all properties with certain Stereotypes only
Expected Solution: To have single function which can handle multiple property validation by accepting the input parameter as an object instead of primitive types or specific class type. In this way, we can build a common validation logic and it can be used across the project.
Thanks @AJ73! @erwin-jeanlouis-gs would you mind taking a look here? Does this function exist already?
This issue is stale because it has been open for 30 days with no activity. Please remove stale label or add any comment to keep this open. Otherwise this will be closed in 5 days.
This issue was closed because it has been inactive for 35 days. Please re-open if this issue is still relevant.