-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
[Bug] All RuleSets firing, even though only one specific in component options #180
Comments
We're seeing the same thing here. Updating to the newest version didn't fix the problem. It's as if all rulesets were firing whenever we updated an input's contents. |
Update on this (because it's a pretty big problem on our end): I think I may have found the issue.
|
I have the same issue.
is it possible to implement your ValidateField method something like this? |
Back in March, when I looked into this, the issue was that FluentValidation didn't expose enough information for Admittedly, this may have changed since then (I don't know, we fixed it and moved on), but taking a look at their release page, they don't seem to have added this functionality since. Unfortunately, our solution was to drop this library and write our own validation component that:
We found a way to map the FluentValidation paths (which are string paths) to what Blazor's There a few downsides with this, of course. We're now maintaining our own validation library (though this one doesn't seem to have had a release in a while, so that may end-up being good for us). By validating the whole model, we run into the risk of having slow validation code trigger when an unrelated field changes, though this should only happen if we did something silly like have some long-running async code in our validation, which we don't do (we've forbidden async validation altogether through code reviews). |
Hi @UniMichael I've put together a PR which sounds like it's doing something similar to what you described (though the reverse) - would you mind weighing in over at #205 ? I'm curious if it also helps with your use case |
Describe the bug
I am specifying an explicit RuleSet to include when using the FluentValidationValidator component in my component, e.g.
<FluentValidationValidator Options="@(options => options.IncludeRuleSets(CreateUserModelValidator.ModifyUserRuleSet))" @ref="fluentValidationValidator" />
. However, all RuleSets are firing which is printing duplicate validation messages on the screen.NOTE: I am not explicitly calling Validate(), Fluent Validation seems to be checking for valid fields when those fields are updated.
Expected behavior
Only the specified RuleSet is executed when updating any fields.
Screenshots
Duplicate validation messages:
Redacated validator class with RuleSets:
Hosting Model (is this issue happening with a certain hosting model?):
The text was updated successfully, but these errors were encountered: