Enhancement: Add propertyName to ValidationError
Presently the property name is added to the debugMessage. It would be useful to have the propertyName in the ValidationError. I am sending a list of errors to a client that maps them to inputs with the same name. I need to slice the property name out of the message, e.g. "planName: name must be at least 3 characters long".
Thanks, will add in the next version.
Do you mean changing the error message from :
Length validator, expected text length between: 0 - 6, received value: Patrick, property name: name
to
name: Length validator, expected text length between: 0 - 6, received value: Patrick
?
The message was generated using the following code (Inspired from LengthValidatorTests):
validator.forProperty { t -> t.name }
.length(6)
.onError()
.propertyName("name")
testObject.name = "Patrick"
result = validator.validate()
(I'm asking the quetion, coz, I'm planing to make a PR for this issue)