API: improve validation message greater/lower than
Add translation and return a better error for lower than
This commit is contained in:
@@ -79,10 +79,12 @@ func computeValidationMessage(ac *appcontext.AppContext, fe *validator.FieldErro
|
||||
return i18nresource.GetTranslatedMessage(ac, "ValidationRequired")
|
||||
case "min":
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, "ValidationTooShort"), (*fe).Param())
|
||||
case "gte":
|
||||
return fmt.Sprintf("Should be greater than %s", (*fe).Param())
|
||||
case "max":
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, "ValidationTooLong"), (*fe).Param())
|
||||
case "lte":
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, "ValidationLowerThan"), (*fe).Param())
|
||||
case "gte":
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, "ValidationGreaterThan"), (*fe).Param())
|
||||
default:
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, "ValidationPropertyFail"), tag)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user