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
Currently the error message that you're returning is basically tabbed, new lined and with some special characters.
It'd be nice for us to use our own messages, it'd help with translation and customization.
The API I feel like would help is something like this:
validator:=vjson.NewSchema(
vjson.String("name").Required("{field} is required").MinLength(2, "{field} should be at least {value} characters").MaxLength(3, "{field} should be less than {value} characters"),
vjson.String("email").Required("{field} is required").Email("{field} must be a valid email"),
vjson.Integer("subscriptionMonths").Required("{field} is required").Min(0, "{field} can't be negative"),
vjson.String("plan").Required().Choices([]string{"GOLD", "SILVER"}, "{field} can only be either `GOLD` or `SILVER`"),
)
When I retrieve an error, we could just get a []ValidationError, I can either use the message provided by you, or I could use my own logic.
The text was updated successfully, but these errors were encountered:
Currently the error message that you're returning is basically tabbed, new lined and with some special characters.
It'd be nice for us to use our own messages, it'd help with translation and customization.
The API I feel like would help is something like this:
When I retrieve an error, we could just get a
[]ValidationError
, I can either use the message provided by you, or I could use my own logic.The text was updated successfully, but these errors were encountered: