#[derive(Debug, Clone, Deserialize, Validate)]
pub struct SignUp {
#[validate(
length(min = 4, message = "Name must be greater than 4 chars"),
regex(
path = "REGEX_USERNAME",
message = "Name must be alphanumeric and/or dashes only"
)
)]
pub name: String,
#[validate(
length(min = 4, message = "Username must be greater than 4 chars"),
regex(
path = "REGEX_USERNAME",
message = "Username must be alphanumeric and/or dashes only"
)
)]
pub username: String,
#[validate(
length(min = 4, message = "Password must be more than 4 letters"),
custom(
function = "validate_password",
message = "Password must be 4-50 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji"
)
)]
pub password: String,
#[validate(must_match(other = "password", message = "Passwords are not identical"))]
pub password2: String,
}
But why every error starts with Error: ?
This is the resulted errors
Error: Password must be 4-50 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji
Error: Name must be alphanumeric and/or dashes only
I have this validation
But why every error starts with
Error:
?This is the resulted errors
?