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
add property resolver for include properties #2003
Conversation
@JeremySkinner Have a look, please |
Hi @sergeivalko thanks for the suggestion. Does this cause issues with including full chains inside the expression? Eg if you do |
Ah, no, ignore my previous comment. I was misremembering how PropertyNameResolver worked. I think this should be fine - I'll try and do a bit more testing on it later this week and will then try and do a release, probably on Friday. |
@JeremySkinner yes everything is working fine I've just checked so looking forward to feedback, thanks. |
@JeremySkinner any updates? |
No, I haven't had time to look at this any further. I only work on FluentValidation in my spare time, and real-life takes priority. Please be patient and I'll try and get to it as quickly as I can. |
thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this.
The MemberFromExpression
can be simplified as the chain variable is no longer needed. If you could make that change then I'll get this merged. Thanks!
I've pushed out 11.2.2 with this change |
Fix
This pull request fixes how the resolver works with
IncludeProperties
.For example we have property resolver camelCase and when we are using
validator.Validate(new Person(), strategy => strategy.IncludeProperties(x=>x.Surname))
then validator will not validate our surname property cause our resolver resolve it as "surname"
IncludeProperties
= "Surname" but resolver (RuleFor(x=>x.Surname)) = "surname" and it can't find the right property for validate