typestack / class-validator

Decorator-based property validation for classes.
MIT License
10.92k stars 787 forks source link

feature: accsess eachPrefix in error messages #2461

Open MR-Mostafa opened 5 months ago

MR-Mostafa commented 5 months ago

Description

When validating an object, we cannot directly access the eachPrefix in the error message. Consequently, when we modify the error message, the value of eachPrefix always appears at the beginning of the message. For example, if we change the validation message forIsNotEmpty to The The value of field $property should not be empty., the resulting output will be: eachPrefix The value of field $property should not be empty. But the truth is that it should be like this: The value of field $eachPrefix.$property should not be empty.

Proposed solution

Accsess to eachPrefix like $property or in ValidationArguments.