ozzo-validation
ozzo-validation copied to clipboard
Multiple errors in the same field
Hi, is it possible to get all the errors of a field in an array instead just the first? The code I'm trying right now:
func (r Request) Valid() error {
return validation.ValidateStruct(&r,
validation.Field(&r.Name,
validation.Length(MIN, MAX).Error("Length must be between 1 and 10),
validation.In("nerock").Error("Must be my name"),
),
validation.Field(&r.Email,
validation.Required.Error("You need email"),
),
)
}
If anyone is interested I forked it to do just that, https://github.com/nerock/ozzo-validation
@qiangxue Hi. Could you implement such behavior?)
It's been nearly 3 years. Is there no possibility to support this? @nerock Creating a fork is an option, surely, but it needs to be updated constantly, so not a great option. @voodoo-dn What did you end up using?
OFFTOPIC: Is this library even maintained? Or are you already using alternatives?