Validator Metadata

A validator metadata specifies all what a validator needs in order to be called and executed: the validation function name and the validation key as well as the default message to be shown in case of a validation violation and the related message translation identifier.

  • validatorID: the validator function name ex. required, email,emailAlreadyExistsValidator. The validator could be either predefined (i.e angular predefined validator that are accessible from the class Validators), or a custom user defined validator (implementation of angular ValidatorFn or AsyncValidatorFn).
  • validatorKey: the key used for validation ex. required, email, emailNotAvailable. This is the key used in the validation function.
  • parameters: the list of parameters needed by the validation function. Ex. 3 for maxLenght(3)
  • type: the validator type could be either predefined (i.e. Validators class) or custom validator (i.e. GlobalCustomValidationService a custom global averos validator)
  • nature:
    • sync : for synchronous validator
    • async : for asynchronous validator
  • validationDefaultMessage: the validation default message to be displayed in case the validation is violated
  • validationMessageTranslationID: the validation message translation identifier which will mapp to the related validation message translation in the current language