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 a PropertyPath
placeholder
#2134
Comments
Thank you for adding this. I think it will be a nice addition. I cannot reply to #2132 because it is locked, but I just wanted to say this is an awesome library and I doubt there is a better one out there. So, forgive my poor choice of words when I said that having to add WithFullName to every rule stinks in previous post. Also, are you sure adding PropertyPath to ValidatorOptions.Global.DisplayNameResolver would be difficult? It looks like the full property path (variable
|
I am certain. As I explained in the other thread, the DisplayNameResolver needs to support being executed without a property path, which is why it's not passed in. There are several scenarios where this happens but the most common is for our integration with ASP.NET's client-side validation. We need to generate messages without invoking the validator. There is no validation context available in that scenario, no property path, no model being validated. The property name is being generated completely outside of a validation run - it can't rely on things that are only available during validation. So adding the property path as a parameter to DisplayNameResolver is not something that can happen. |
I see now. Thank you for the explanation. |
11.7.0 is now released with this change |
Is your feature request related to a problem? Please describe.
Allow access to the full property path inside error message templates.
Describe the solution you'd like
ValidationContext.PropertyName
ValidationContext.PropertyPath
as a better-named replacementRuleBase.PrepareMessageFormatterForValidationError
Describe alternatives you've considered
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: