You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose that we add some extra metadata to the various validation helpers. With the addition to customizing the error responses. (#1321) This would aide in further customizing the error response.
It would include adding an extra key to the various validation helpers. For example,
// InvalidParamTypeError is the error produced when the type of a parameter does not match the type
// defined in the design.
func InvalidParamTypeError(name string, val interface{}, expected string) error {
msg := fmt.Sprintf("invalid value %#v for parameter %#v, must be a %s", val, name, expected)
return ErrInvalidRequest(msg, "validation_code", "invalid_param_type, "param", name, "value", val, "expected", expected)
}
It would be preferable to include variables or constants (whether editing these should be allowed) for easier consumption of this change.
This isn't mission critical, but the idea is to provide codes for every error in the response.
{
"code": "unprocessable_entity",
"details": {
"username": [
{
"Code": "invalid_format",
"Message": "username must match the regexp \"^[A-Za-z0-9'_-]+(?:[.][A-Za-z0-9]+)*$\" but got value \"!aaaa\""
},
{
"Code": "invalid_length",
"Message": "length of username must be greater than or equal to 6 but got value \"!aaaa\" (len=5)"
}
]
},
"id": "Fa8iKyff",
"message": "Invalid user input.",
"status": 422
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I propose that we add some extra metadata to the various validation helpers. With the addition to customizing the error responses. (#1321) This would aide in further customizing the error response.
It would include adding an extra key to the various validation helpers. For example,
It would be preferable to include variables or constants (whether editing these should be allowed) for easier consumption of this change.
The text was updated successfully, but these errors were encountered: