Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid error message for ScalePrecision validation #1791

Closed
SatsunkevichAlex opened this issue Aug 3, 2021 · 1 comment · Fixed by #1790
Closed

Invalid error message for ScalePrecision validation #1791

SatsunkevichAlex opened this issue Aug 3, 2021 · 1 comment · Fixed by #1790
Milestone

Comments

@SatsunkevichAlex
Copy link
Contributor

SatsunkevichAlex commented Aug 3, 2021

FluentValidation version

10.3.0

ASP.NET version

No response

Summary

For number 0.01 and validation setting ScalePrecision(1, 3) error message will be
Exp: 'Discount' must not be more than 3 digits in total, with allowance for 1 decimal. 0 digits and 2 decimals were found.
Act: 'Discount' must not be more than 3 digits in total, with allowance for 1 decimals. -1 digits and 2 decimals were found.

I created pull request with possible way to fix it.
#1790

Steps to Reproduce

add this case to Scale_precision_should_not_be_valid test

result = validator.Validate(new Person { Discount = 0.01M });
result.IsValid.ShouldBeFalse();
result.Errors[0].ErrorMessage.ShouldEqual("'Discount' must not be more than 3 digits in total, with allowance for 1 decimal. 0 digits and 2 decimals were found.");
@JeremySkinner
Copy link
Member

10.3.1 has been released with this fix

@JeremySkinner JeremySkinner added this to the 10.3.1 milestone Aug 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants