Improve validation error messages for oneof failures.
Return a clear allowed-values message for oneof tags so issue status updates no longer surface empty field errors. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3b08a07c85
commit
2c107cf35a
|
|
@ -60,6 +60,8 @@ func errorMsgs(tag string, value string) string {
|
||||||
return "length should be equal to " + value
|
return "length should be equal to " + value
|
||||||
case "email":
|
case "email":
|
||||||
return "must be a valid email address"
|
return "must be a valid email address"
|
||||||
|
case "oneof":
|
||||||
|
return "must be one of: " + value
|
||||||
}
|
}
|
||||||
return ""
|
return "failed " + tag + " validation"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user