fix: incorrect property name in validation messages when using @Expose() #1705
Labels
status: needs triage
Issues which needs to be reproduced to be verified report.
type: fix
Issues describing a broken feature.
Description
When using the @expose decorator from class-transformer in combination with the @IsString decorator from class-validator, the validation message returns the original property name instead of the exposed name.
Lets take this below example:
If I pass a number or an invalid value to secretKey, the validation message returned is 'password must be a string'. However, it should be 'secretKey must be a string' based on the exposed name.
Expected behavior
The validation message should use the exposed name defined by the @expose decorator. For example, if the secretKey field is incorrectly set, the error message should be 'secretKey must be a string'.
Actual behavior
The validation message returns the original property name. In the provided example, it returns 'password must be a string' instead of 'secretKey must be a string'.
The text was updated successfully, but these errors were encountered: