ValidationMetadata.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.ValidationMetadata = void 0;
  4. /**
  5. * This metadata contains validation rules.
  6. */
  7. class ValidationMetadata {
  8. // -------------------------------------------------------------------------
  9. // Constructor
  10. // -------------------------------------------------------------------------
  11. constructor(args) {
  12. /**
  13. * Validation groups used for this validation.
  14. */
  15. this.groups = [];
  16. /**
  17. * Specifies if validated value is an array and each of its item must be validated.
  18. */
  19. this.each = false;
  20. /*
  21. * A transient set of data passed through to the validation result for response mapping
  22. */
  23. this.context = undefined;
  24. this.type = args.type;
  25. this.name = args.name;
  26. this.target = args.target;
  27. this.propertyName = args.propertyName;
  28. this.constraints = args === null || args === void 0 ? void 0 : args.constraints;
  29. this.constraintCls = args.constraintCls;
  30. this.validationTypeOptions = args.validationTypeOptions;
  31. if (args.validationOptions) {
  32. this.message = args.validationOptions.message;
  33. this.groups = args.validationOptions.groups;
  34. this.always = args.validationOptions.always;
  35. this.each = args.validationOptions.each;
  36. this.context = args.validationOptions.context;
  37. }
  38. }
  39. }
  40. exports.ValidationMetadata = ValidationMetadata;
  41. //# sourceMappingURL=ValidationMetadata.js.map