Invalid error message when using ScalePrecisionValidator
See original GitHub issueSystem Details
- FluentValidation version: 8.1.2
- Web Framework version: .Net Core 2.1
Issue Description
When using the ScalePrecisionValadator to validate the scale and precision of a decimal type property, I am getting this error message when submitting any whole digit number that violates the precision length portion of the validation.
'Decimal Property' may not be more than 9 digits in total, with allowance for 2 decimals. 9 digits and 1 decimals were found.
Shouldn’t the dynamic portion stating, “1 decimals were found.” be 0 decimals found?
i.e ‘123456789’
RuleFor(x => x.DecimalProperty)
.SetValidator(new ScalePrecisionValidator(2, 9)).WithName("Decimal Property");
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Invalid error message when using ScalePrecisionValidator
When using the ScalePrecisionValadator to validate the scale and precision of a decimal type property, I am getting this error message when ...
Read more >Validate only the scale in a decimal value (FluentValidator)
I found the ScalePrecisionValidator but it is validating both. Any method to validate only the scale using the FluentValidator ? c# .net-core ....
Read more >Built-in Validators — FluentValidation documentation
FluentValidation ships with several built-in validators. The error message for each validator can contain special placeholders that will be filled in when ...
Read more >Declarative Validation
For each property validator above you can use a Typed Property Validation ... Type Validators can also specify custom Error Codes and Error...
Read more >Consistent Validation Response for Invalid Value ...
In this case, controller method gets null as input because of invalid type value during the model biding phase. In this case, format...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can’t you use the IgnoreTrailingZeros option on the ScalePrecisionValidator?
That should make it ignore any trailing zeros in the value it is validating.
Setting the IgnoreTrailingZeros property to true is fixing this issue. Thanks!