What Now?
- Added new helper method for StructLevel validations "ReportValidationErrors"
Why do I care?
Because you can do the following in a struct level validation
func StructValidationTestStructReturnValidationErrors(v *Validate, structLevel *StructLevel) {
// TestStructReturnValidationErrors is a triple nested struct
// see tests for full code
s := structLevel.CurrentStruct.Interface().(TestStructReturnValidationErrors)
errs := v.Struct(s.Inner1.Inner2)
if errs == nil {
return
}
structLevel.ReportValidationErrors("Inner1.", errs.(ValidationErrors))
}