FluentValidation: Request: Add ObjectInstance to ValidationFailure
The Microsoft Blazor front-end uses an ObjectInstance/PropertyName combination to identify errors, whereas FluentValidation uses a RootObject/PathToProperty.
Could we have some way of retrieving the actual object + property name (rather than path)?
For example. A ValidationFailure for Person.HomeAddress.City would give us
object Person.HomeAddress, string "City"
Take a look here for more information in a blog by Steve Sanderson - https://chrissainty.com/using-fluentvalidation-for-forms-validation-in-razor-components/
I’d be happy to submit a PR if you are open to the idea of this improvement and would like to discuss an approach you are happy with?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 18 (7 by maintainers)
PropertyValidator
to pass the parent rule instance to theValidationFailure
Custom
validators where the user can create theValidationFailure
instance directly.