Indicate field on validation error

This commit is contained in:
Yann Hamon 2020-12-28 13:03:36 +01:00
parent f6e6f7584c
commit 9a56fc4176

View file

@ -175,7 +175,8 @@ func (val *v) ValidateResource(res resource.Resource) Result {
if msg != "" {
msg += " - "
}
msg += errMsg.Description()
details := errMsg.Details()
msg += fmt.Sprintf("For field %s: %s", details["field"].(string), errMsg.Description())
}
return Result{Resource: res, Status: Invalid, Err: fmt.Errorf("%s", msg)}