improve package gvalid by adding extra internal variable for error message template, changing :xxx varibale name to {xxx} format

This commit is contained in:
John Guo
2021-11-14 21:00:34 +08:00
parent 4cdd98dbf5
commit e23704d694
19 changed files with 407 additions and 389 deletions

View File

@ -452,8 +452,8 @@ func Test_Params_Struct(t *testing.T) {
t.Assert(client.PostContent(ctx, "/struct1", `id=1&name=john&password1=123&password2=456`), `1john123456`)
t.Assert(client.PostContent(ctx, "/struct2", `id=1&name=john&password1=123&password2=456`), `1john123456`)
t.Assert(client.PostContent(ctx, "/struct2", ``), ``)
t.Assert(client.PostContent(ctx, "/struct-valid", `id=1&name=john&password1=123&password2=0`), `The password2 value length must be between 2 and 20; 密码强度不足`)
t.Assert(client.PostContent(ctx, "/parse", `id=1&name=john&password1=123&password2=0`), `The password2 value length must be between 2 and 20; 密码强度不足`)
t.Assert(client.PostContent(ctx, "/struct-valid", `id=1&name=john&password1=123&password2=0`), "The password2 value `0` length must be between 2 and 20; 密码强度不足")
t.Assert(client.PostContent(ctx, "/parse", `id=1&name=john&password1=123&password2=0`), "The password2 value `0` length must be between 2 and 20; 密码强度不足")
t.Assert(client.PostContent(ctx, "/parse", `{"id":1,"name":"john","password1":"123Abc!@#","password2":"123Abc!@#"}`), `1john123Abc!@#123Abc!@#`)
})
}

View File

@ -538,7 +538,7 @@ func Test_Params_Parse_DefaultValueTag(t *testing.T) {
func Test_Params_Parse_Validation(t *testing.T) {
type RegisterReq struct {
Name string `p:"username" v:"required|length:6,30#请输入账号|账号长度为:min到:max位"`
Name string `p:"username" v:"required|length:6,30#请输入账号|账号长度为{min}到{max}位"`
Pass string `p:"password1" v:"required|length:6,30#请输入密码|密码长度不够"`
Pass2 string `p:"password2" v:"required|length:6,30|same:password1#请确认密码|密码长度不够|两次密码不一致"`
}

View File

@ -186,52 +186,51 @@ var (
// defaultMessages is the default error messages.
// Note that these messages are synchronized from ./i18n/en/validation.toml .
defaultMessages = map[string]string{
"required": "The :attribute field is required",
"required-if": "The :attribute field is required",
"required-unless": "The :attribute field is required",
"required-with": "The :attribute field is required",
"required-with-all": "The :attribute field is required",
"required-without": "The :attribute field is required",
"required-without-all": "The :attribute field is required",
"date": "The :attribute value is not a valid date",
"datetime": "The :attribute value is not a valid datetime",
"date-format": "The :attribute value does not match the format :format",
"email": "The :attribute value must be a valid email address",
"phone": "The :attribute value must be a valid phone number",
"telephone": "The :attribute value must be a valid telephone number",
"passport": "The :attribute value is not a valid passport format",
"password": "The :attribute value is not a valid passport format",
"password2": "The :attribute value is not a valid passport format",
"password3": "The :attribute value is not a valid passport format",
"postcode": "The :attribute value is not a valid passport format",
"resident-id": "The :attribute value is not a valid resident id number",
"bank-card": "The :attribute value must be a valid bank card number",
"qq": "The :attribute value must be a valid QQ number",
"ip": "The :attribute value must be a valid IP address",
"ipv4": "The :attribute value must be a valid IPv4 address",
"ipv6": "The :attribute value must be a valid IPv6 address",
"mac": "The :attribute value must be a valid MAC address",
"url": "The :attribute value must be a valid URL address",
"domain": "The :attribute value must be a valid domain format",
"length": "The :attribute value length must be between :min and :max",
"min-length": "The :attribute value length must be equal or greater than :min",
"max-length": "The :attribute value length must be equal or lesser than :max",
"size": "The :attribute value length must be :size",
"between": "The :attribute value must be between :min and :max",
"min": "The :attribute value must be equal or greater than :min",
"max": "The :attribute value must be equal or lesser than :max",
"json": "The :attribute value must be a valid JSON string",
"xml": "The :attribute value must be a valid XML string",
"array": "The :attribute value must be an array",
"integer": "The :attribute value must be an integer",
"float": "The :attribute value must be a float",
"boolean": "The :attribute value field must be true or false",
"same": "The :attribute value must be the same as field :field",
"different": "The :attribute value must be different from field :field",
"in": "The :attribute value is not in acceptable range",
"not-in": "The :attribute value is not in acceptable range",
"regex": "The :attribute value is invalid",
internalDefaultRuleName: "The :attribute value is invalid",
"required": "The {attribute} field is required",
"required-if": "The {attribute} field is required",
"required-unless": "The {attribute} field is required",
"required-with": "The {attribute} field is required",
"required-with-all": "The {attribute} field is required",
"required-without": "The {attribute} field is required",
"required-without-all": "The {attribute} field is required",
"date": "The {attribute} value `{value}` is not a valid date",
"datetime": "The {attribute} value `{value}` is not a valid datetime",
"date-format": "The {attribute} value `{value}` does not match the format: {pattern}",
"email": "The {attribute} value `{value}` is not a valid email address",
"phone": "The {attribute} value `{value}` is not a valid phone number",
"telephone": "The {attribute} value `{value}` is not a valid telephone number",
"passport": "The {attribute} value `{value}` is not a valid passport format",
"password": "The {attribute} value `{value}` is not a valid password format",
"password2": "The {attribute} value `{value}` is not a valid password format",
"password3": "The {attribute} value `{value}` is not a valid password format",
"postcode": "The {attribute} value `{value}` is not a valid postcode format",
"resident-id": "The {attribute} value `{value}` is not a valid resident id number",
"bank-card": "The {attribute} value `{value}` is not a valid bank card number",
"qq": "The {attribute} value `{value}` is not a valid QQ number",
"ip": "The {attribute} value `{value}` is not a valid IP address",
"ipv4": "The {attribute} value `{value}` is not a valid IPv4 address",
"ipv6": "The {attribute} value `{value}` is not a valid IPv6 address",
"mac": "The {attribute} value `{value}` is not a valid MAC address",
"url": "The {attribute} value `{value}` is not a valid URL address",
"domain": "The {attribute} value `{value}` is not a valid domain format",
"length": "The {attribute} value `{value}` length must be between {min} and {max}",
"min-length": "The {attribute} value `{value}` length must be equal or greater than {min}",
"max-length": "The {attribute} value `{value}` length must be equal or lesser than {max}",
"size": "The {attribute} value `{value}` length must be {size}",
"between": "The {attribute} value `{value}` must be between {min} and {max}",
"min": "The {attribute} value `{value}` must be equal or greater than {min}",
"max": "The {attribute} value `{value}` must be equal or lesser than {max}",
"json": "The {attribute} value `{value}` is not a valid JSON string",
"xml": "The {attribute} value `{value}` is not a valid XML string",
"array": "The {attribute} value `{value}` is not an array",
"integer": "The {attribute} value `{value}` is not an integer",
"boolean": "The {attribute} value `{value}` field must be true or false",
"same": "The {attribute} value `{value}` must be the same as field {pattern}",
"different": "The {attribute} value `{value}` must be different from field {pattern}",
"in": "The {attribute} value `{value}` is not in acceptable range: {pattern}",
"not-in": "The {attribute} value `{value}` must not be in range: {pattern}",
"regex": "The {attribute} value `{value}` must be in regex of: {pattern}",
internalDefaultRuleName: "The {attribute} value `{value}` is invalid",
}
// markedRuleMap defines all rules that are just marked rules which have neither functional meaning
// nor error messages.

View File

@ -9,7 +9,6 @@ package gvalid
import (
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/text/gstr"
"strings"
)
@ -40,17 +39,12 @@ type validationError struct {
// newValidationError creates and returns a validation error.
func newValidationError(code gcode.Code, rules []fieldRule, fieldRuleErrorMap map[string]map[string]error) *validationError {
var (
s string
)
for field, ruleErrorMap := range fieldRuleErrorMap {
for rule, err := range ruleErrorMap {
if !gerror.HasStack(err) {
s = strings.Replace(err.Error(), ":attribute", field, -1)
s, _ = gregex.ReplaceString(`\s{2,}`, ` `, s)
ruleErrorMap[rule] = gerror.NewOption(gerror.Option{
Stack: false,
Text: gstr.Trim(s),
Text: gstr.Trim(err.Error()),
Code: code,
})
}

View File

@ -117,8 +117,9 @@ func (v *Validator) doCheckMap(ctx context.Context, params interface{}) Error {
}); validatedError != nil {
_, errorItem := validatedError.FirstItem()
// ===========================================================
// Only in map and struct validations, if value is nil or empty
// string and has no required* rules, it clears the error message.
// Only in map and struct validations:
// If value is nil or empty string and has no required* rules,
// it clears the error message.
// ===========================================================
if gconv.String(value) == "" {
required := false
@ -129,11 +130,6 @@ func (v *Validator) doCheckMap(ctx context.Context, params interface{}) Error {
required = true
break
}
// Custom rules are also required in default.
if f := v.getRuleFunc(ruleKey); f != nil {
required = true
break
}
}
if !required {
continue
@ -142,8 +138,8 @@ func (v *Validator) doCheckMap(ctx context.Context, params interface{}) Error {
if _, ok := errorMaps[checkRuleItem.Name]; !ok {
errorMaps[checkRuleItem.Name] = make(map[string]error)
}
for ruleKey, errorItemMsgMap := range errorItem {
errorMaps[checkRuleItem.Name][ruleKey] = errorItemMsgMap
for ruleKey, ruleError := range errorItem {
errorMaps[checkRuleItem.Name][ruleKey] = ruleError
}
if v.bail {
break

View File

@ -178,7 +178,7 @@ func (v *Validator) doCheckStruct(ctx context.Context, object interface{}) Error
}
if _, ok := nameToRuleMap[name]; !ok {
if _, ok := nameToRuleMap[fieldName]; ok {
if _, ok = nameToRuleMap[fieldName]; ok {
// If there's alias name,
// use alias name as its key and remove the field name key.
nameToRuleMap[name] = nameToRuleMap[fieldName]
@ -254,10 +254,11 @@ func (v *Validator) doCheckStruct(ctx context.Context, object interface{}) Error
DataMap: inputParamMap,
}); validatedError != nil {
_, errorItem := validatedError.FirstItem()
// ===================================================================
// Only in map and struct validations, if value is nil or empty string
// and has no required* rules, it clears the error message.
// ===================================================================
// ============================================================
// Only in map and struct validations:
// If value is nil or empty string and has no required* rules,
// it clears the error message.
// ============================================================
if value == nil || gconv.String(value) == "" {
required := false
// rule => error
@ -267,11 +268,6 @@ func (v *Validator) doCheckStruct(ctx context.Context, object interface{}) Error
required = true
break
}
// Custom rules are also required in default.
if f := v.getRuleFunc(ruleKey); f != nil {
required = true
break
}
}
if !required {
continue

View File

@ -69,12 +69,12 @@ func (v *Validator) doCheckValue(ctx context.Context, input doCheckValueInput) E
msgArray = make([]string, 0)
customMsgMap = make(map[string]string)
)
switch v := input.Messages.(type) {
switch messages := input.Messages.(type) {
case string:
msgArray = strings.Split(v, "|")
msgArray = strings.Split(messages, "|")
default:
for k, v := range gconv.Map(input.Messages) {
customMsgMap[k] = gconv.String(v)
for k, message := range gconv.Map(input.Messages) {
customMsgMap[k] = gconv.String(message)
}
}
// Handle the char '|' in the rule,
@ -108,8 +108,8 @@ func (v *Validator) doCheckValue(ctx context.Context, input doCheckValueInput) E
err error
match = false // whether this rule is matched(has no error)
results = ruleRegex.FindStringSubmatch(ruleItems[index]) // split single rule.
ruleKey = strings.TrimSpace(results[1]) // rule name like "max" in rule "max: 6"
rulePattern = strings.TrimSpace(results[2]) // rule value if any like "6" in rule:"max:6"
ruleKey = gstr.Trim(results[1]) // rule key like "max" in rule "max: 6"
rulePattern = gstr.Trim(results[2]) // rule pattern is like "6" in rule:"max:6"
customRuleFunc RuleFunc
)
@ -158,7 +158,7 @@ func (v *Validator) doCheckValue(ctx context.Context, input doCheckValueInput) E
}
} else {
// It checks build-in validation rules if there's no custom rule.
match, err = v.doCheckBuildInRules(
match, err = v.doCheckSingleBuildInRules(
ctx,
doCheckBuildInRulesInput{
Index: index,
@ -182,6 +182,19 @@ func (v *Validator) doCheckValue(ctx context.Context, input doCheckValueInput) E
if _, ok := ruleErrorMap[ruleKey]; !ok {
ruleErrorMap[ruleKey] = errors.New(v.getErrorMessageByRule(ctx, ruleKey, customMsgMap))
}
// Error variable replacement for error message.
if err = ruleErrorMap[ruleKey]; !gerror.HasStack(err) {
var s string
s = gstr.ReplaceByMap(err.Error(), map[string]string{
"{value}": gconv.String(input.Value),
"{pattern}": rulePattern,
"{attribute}": input.Name,
})
s, _ = gregex.ReplaceString(`\s{2,}`, ` `, s)
ruleErrorMap[ruleKey] = errors.New(s)
}
// If it is with error and there's bail rule,
// it then does not continue validating for left rules.
if hasBailRule {
@ -203,16 +216,16 @@ func (v *Validator) doCheckValue(ctx context.Context, input doCheckValueInput) E
}
type doCheckBuildInRulesInput struct {
Index int
Value interface{}
RuleKey string
RulePattern string
RuleItems []string
DataMap map[string]interface{}
CustomMsgMap map[string]string
Index int // Index of RuleKey in RuleItems.
Value interface{} // Value to be validated.
RuleKey string // RuleKey is like the "max" in rule "max: 6"
RulePattern string // RulePattern is like "6" in rule:"max:6"
RuleItems []string // RuleItems are all the rules that should be validated on single field, like: []string{"required", "min:1"}
DataMap map[string]interface{} // Parameter map.
CustomMsgMap map[string]string // Custom error message map.
}
func (v *Validator) doCheckBuildInRules(ctx context.Context, input doCheckBuildInRulesInput) (match bool, err error) {
func (v *Validator) doCheckSingleBuildInRules(ctx context.Context, input doCheckBuildInRulesInput) (match bool, err error) {
valueStr := gconv.String(input.Value)
switch input.RuleKey {
// Required rules.
@ -292,7 +305,6 @@ func (v *Validator) doCheckBuildInRules(ctx context.Context, input doCheckBuildI
msg string
)
msg = v.getErrorMessageByRule(ctx, input.RuleKey, input.CustomMsgMap)
msg = strings.Replace(msg, ":format", input.RulePattern, -1)
return match, errors.New(msg)
}
@ -307,7 +319,6 @@ func (v *Validator) doCheckBuildInRules(ctx context.Context, input doCheckBuildI
if !match {
var msg string
msg = v.getErrorMessageByRule(ctx, input.RuleKey, input.CustomMsgMap)
msg = strings.Replace(msg, ":field", input.RulePattern, -1)
return match, errors.New(msg)
}
@ -323,7 +334,6 @@ func (v *Validator) doCheckBuildInRules(ctx context.Context, input doCheckBuildI
if !match {
var msg string
msg = v.getErrorMessageByRule(ctx, input.RuleKey, input.CustomMsgMap)
msg = strings.Replace(msg, ":field", input.RulePattern, -1)
return match, errors.New(msg)
}
@ -461,13 +471,13 @@ func (v *Validator) doCheckBuildInRules(ctx context.Context, input doCheckBuildI
// Integer.
case "integer":
if _, err := strconv.Atoi(valueStr); err == nil {
if _, err = strconv.Atoi(valueStr); err == nil {
match = true
}
// Float.
case "float":
if _, err := strconv.ParseFloat(valueStr, 10); err == nil {
if _, err = strconv.ParseFloat(valueStr, 10); err == nil {
match = true
}

View File

@ -41,8 +41,8 @@ func (v *Validator) checkLength(ctx context.Context, value, ruleKey, ruleVal str
}
if valueLen < min || valueLen > max {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":min", strconv.Itoa(min), -1)
msg = strings.Replace(msg, ":max", strconv.Itoa(max), -1)
msg = strings.Replace(msg, "{min}", strconv.Itoa(min), -1)
msg = strings.Replace(msg, "{max}", strconv.Itoa(max), -1)
return msg
}
@ -50,21 +50,21 @@ func (v *Validator) checkLength(ctx context.Context, value, ruleKey, ruleVal str
min, err := strconv.Atoi(ruleVal)
if valueLen < min || err != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":min", strconv.Itoa(min), -1)
msg = strings.Replace(msg, "{min}", strconv.Itoa(min), -1)
}
case "max-length":
max, err := strconv.Atoi(ruleVal)
if valueLen > max || err != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":max", strconv.Itoa(max), -1)
msg = strings.Replace(msg, "{max}", strconv.Itoa(max), -1)
}
case "size":
size, err := strconv.Atoi(ruleVal)
if valueLen != size || err != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":size", strconv.Itoa(size), -1)
msg = strings.Replace(msg, "{size}", strconv.Itoa(size), -1)
}
}
return msg

View File

@ -34,8 +34,8 @@ func (v *Validator) checkRange(ctx context.Context, value, ruleKey, ruleVal stri
valueF, err := strconv.ParseFloat(value, 10)
if valueF < min || valueF > max || err != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":min", strconv.FormatFloat(min, 'f', -1, 64), -1)
msg = strings.Replace(msg, ":max", strconv.FormatFloat(max, 'f', -1, 64), -1)
msg = strings.Replace(msg, "{min}", strconv.FormatFloat(min, 'f', -1, 64), -1)
msg = strings.Replace(msg, "{max}", strconv.FormatFloat(max, 'f', -1, 64), -1)
}
// Min value.
@ -46,7 +46,7 @@ func (v *Validator) checkRange(ctx context.Context, value, ruleKey, ruleVal stri
)
if valueN < min || err1 != nil || err2 != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":min", strconv.FormatFloat(min, 'f', -1, 64), -1)
msg = strings.Replace(msg, "{min}", strconv.FormatFloat(min, 'f', -1, 64), -1)
}
// Max value.
@ -57,7 +57,7 @@ func (v *Validator) checkRange(ctx context.Context, value, ruleKey, ruleVal stri
)
if valueN > max || err1 != nil || err2 != nil {
msg = v.getErrorMessageByRule(ctx, ruleKey, customMsgMap)
msg = strings.Replace(msg, ":max", strconv.FormatFloat(max, 'f', -1, 64), -1)
msg = strings.Replace(msg, "{max}", strconv.FormatFloat(max, 'f', -1, 64), -1)
}
}

View File

@ -13,6 +13,7 @@ import (
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/gvalid"
"math"
@ -26,8 +27,8 @@ func ExampleCheckMap() {
"password2": "1234567",
}
rules := []string{
"passport@required|length:6,16#账号不能为空|账号长度应当在:min到:max之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等",
"passport@required|length:6,16#账号不能为空|账号长度应当在{min}到{max}之间",
"password@required|length:6,16|same{password}2#密码不能为空|密码长度应当在{min}到{max}之间|两次密码输入不相等",
"password2@required|length:6,16#",
}
if e := gvalid.CheckMap(gctx.New(), params, rules); e != nil {
@ -48,8 +49,8 @@ func ExampleCheckMap2() {
"password2": "1234567",
}
rules := []string{
"passport@length:6,16#账号不能为空|账号长度应当在:min到:max之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等",
"passport@length:6,16#账号不能为空|账号长度应当在{min}到{max}之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在{min}到{max}之间|两次密码输入不相等",
"password2@required|length:6,16#",
}
if e := gvalid.CheckMap(gctx.New(), params, rules); e != nil {
@ -68,7 +69,7 @@ func ExampleCheckStruct() {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId string `v:"between:1,10000 # project id must between :min, :max"`
ProjectId string `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,
@ -85,7 +86,7 @@ func ExampleCheckStruct2() {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId *gvar.Var `v:"between:1,10000 # project id must between :min, :max"`
ProjectId *gvar.Var `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,
@ -102,7 +103,7 @@ func ExampleCheckStruct3() {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId int `v:"between:1,10000 # project id must between :min, :max"`
ProjectId int `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,
@ -229,7 +230,7 @@ func ExampleValidator_CheckMap() {
"password2": "required|length:6,16",
}
messages := map[string]interface{}{
"passport": "账号不能为空|账号长度应当在:min到:max之间",
"passport": "账号不能为空|账号长度应当在{min}到{max}之间",
"password": map[string]string{
"required": "密码不能为空",
"same": "两次密码输入不相等",
@ -460,11 +461,13 @@ func ExampleValidator_Date() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Date3 value is not a valid date; The Date4 value is not a valid date; The Date5 value is not a valid date
// The Date3 value `2021-Oct-31` is not a valid date
// The Date4 value `2021 Octa 31` is not a valid date
// The Date5 value `2021/Oct/31` is not a valid date
}
func ExampleValidator_Datetime() {
@ -485,11 +488,13 @@ func ExampleValidator_Datetime() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Date2 value is not a valid datetime; The Date3 value is not a valid datetime; The Date4 value is not a valid datetime
// The Date2 value `2021-11-01 23:00` is not a valid datetime
// The Date3 value `2021/11/01 23:00:00` is not a valid datetime
// The Date4 value `2021/Dec/01 23:00:00` is not a valid datetime
}
func ExampleValidator_DateFormat() {
@ -510,11 +515,12 @@ func ExampleValidator_DateFormat() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Date2 value does not match the format Y-m-d; The Date4 value does not match the format Y-m-d H:i:s
// The Date2 value `2021-11-01 23:00` does not match the format: Y-m-d
// The Date4 value `2021-11-01 23:00` does not match the format: Y-m-d H:i:s
}
func ExampleValidator_Email() {
@ -535,11 +541,12 @@ func ExampleValidator_Email() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The MailAddr2 value must be a valid email address; The MailAddr4 value must be a valid email address
// The MailAddr2 value `gf@goframe` is not a valid email address
// The MailAddr4 value `gf#goframe.org` is not a valid email address
}
func ExampleValidator_Phone() {
@ -560,11 +567,13 @@ func ExampleValidator_Phone() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The PhoneNumber2 value must be a valid phone number; The PhoneNumber3 value must be a valid phone number; The PhoneNumber4 value must be a valid phone number
// The PhoneNumber2 value `11578912345` is not a valid phone number
// The PhoneNumber3 value `17178912345` is not a valid phone number
// The PhoneNumber4 value `1357891234` is not a valid phone number
}
func ExampleValidator_PhoneLoose() {
@ -585,11 +594,12 @@ func ExampleValidator_PhoneLoose() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The PhoneNumber2 value must be a valid phone number; The PhoneNumber4 value must be a valid phone number
// The PhoneNumber2 value `11578912345` is invalid
// The PhoneNumber4 value `1357891234` is invalid
}
func ExampleValidator_Telephone() {
@ -610,11 +620,12 @@ func ExampleValidator_Telephone() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Telephone3 value must be a valid telephone number; The Telephone4 value must be a valid telephone number
// The Telephone3 value `20-77542145` is not a valid telephone number
// The Telephone4 value `775421451` is not a valid telephone number
}
func ExampleValidator_Passport() {
@ -635,11 +646,13 @@ func ExampleValidator_Passport() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Passport2 value is not a valid passport format; The Passport3 value is not a valid passport format; The Passport4 value is not a valid passport format
// The Passport2 value `1356666` is not a valid passport format
// The Passport3 value `goframe#` is not a valid passport format
// The Passport4 value `gf` is not a valid passport format
}
func ExampleValidator_Password() {
@ -660,7 +673,7 @@ func ExampleValidator_Password() {
}
// Output:
// The Password2 value is not a valid passport format
// The Password2 value `gofra` is not a valid password format
}
func ExampleValidator_Password2() {
@ -681,11 +694,13 @@ func ExampleValidator_Password2() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Password2 value is not a valid passport format; The Password3 value is not a valid passport format; The Password4 value is not a valid passport format
// The Password2 value `gofra` is not a valid password format
// The Password3 value `Goframe` is not a valid password format
// The Password4 value `goframe123` is not a valid password format
}
func ExampleValidator_Password3() {
@ -704,11 +719,12 @@ func ExampleValidator_Password3() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Password2 value is not a valid passport format; The Password3 value is not a valid passport format
// The Password2 value `gofra` is not a valid password format
// The Password3 value `Goframe123` is not a valid password format
}
func ExampleValidator_Postcode() {
@ -727,11 +743,12 @@ func ExampleValidator_Postcode() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Postcode2 value is not a valid passport format; The Postcode3 value is not a valid passport format
// The Postcode2 value `10000` is not a valid postcode format
// The Postcode3 value `1000000` is not a valid postcode format
}
func ExampleValidator_ResidentId() {
@ -750,7 +767,7 @@ func ExampleValidator_ResidentId() {
}
// Output:
// The ResidentID1 value is not a valid resident id number
// The ResidentID1 value `320107199506285482` is not a valid resident id number
}
func ExampleValidator_BankCard() {
@ -769,7 +786,7 @@ func ExampleValidator_BankCard() {
}
// Output:
// The BankCard1 value must be a valid bank card number
// The BankCard1 value `6225760079930218` is not a valid bank card number
}
func ExampleValidator_QQ() {
@ -788,11 +805,12 @@ func ExampleValidator_QQ() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The QQ2 value must be a valid QQ number; The QQ3 value must be a valid QQ number
// The QQ2 value `9999` is not a valid QQ number
// The QQ3 value `514258412a` is not a valid QQ number
}
func ExampleValidator_IP() {
@ -813,11 +831,12 @@ func ExampleValidator_IP() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The IP3 value must be a valid IP address; The IP4 value must be a valid IP address
// The IP3 value `520.255.255.255` is not a valid IP address
// The IP4 value `ze80::812b:1158:1f43:f0d1` is not a valid IP address
}
func ExampleValidator_IPV4() {
@ -838,7 +857,7 @@ func ExampleValidator_IPV4() {
}
// Output:
// The IP2 value must be a valid IPv4 address
// The IP2 value `520.255.255.255` is not a valid IPv4 address
}
func ExampleValidator_IPV6() {
@ -859,7 +878,7 @@ func ExampleValidator_IPV6() {
}
// Output:
// The IP2 value must be a valid IPv6 address
// The IP2 value `ze80::812b:1158:1f43:f0d1` is not a valid IPv6 address
}
func ExampleValidator_Mac() {
@ -880,7 +899,7 @@ func ExampleValidator_Mac() {
}
// Output:
// The Mac2 value must be a valid MAC address
// The Mac2 value `Z0-CC-6A-D6-B1-1A` is not a valid MAC address
}
func ExampleValidator_Url() {
@ -903,7 +922,7 @@ func ExampleValidator_Url() {
}
// Output:
// The URL3 value must be a valid URL address
// The URL3 value `ws://goframe.org` is not a valid URL address
}
func ExampleValidator_Domain() {
@ -924,11 +943,12 @@ func ExampleValidator_Domain() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Domain3 value must be a valid domain format; The Domain4 value must be a valid domain format
// The Domain3 value `goframe#org` is not a valid domain format
// The Domain4 value `1a.2b` is not a valid domain format
}
func ExampleValidator_Size() {
@ -949,7 +969,7 @@ func ExampleValidator_Size() {
}
// Output:
// The Size2 value length must be 5
// The Size2 value `goframe` length must be 5
}
func ExampleValidator_Length() {
@ -970,7 +990,7 @@ func ExampleValidator_Length() {
}
// Output:
// The Length2 value length must be between 10 and 15
// The Length2 value `goframe` length must be between 10 and 15
}
func ExampleValidator_MinLength() {
@ -991,7 +1011,7 @@ func ExampleValidator_MinLength() {
}
// Output:
// The MinLength2 value length must be equal or greater than 8
// The MinLength2 value `goframe` length must be equal or greater than 8
}
func ExampleValidator_MaxLength() {
@ -1012,7 +1032,7 @@ func ExampleValidator_MaxLength() {
}
// Output:
// The MaxLength2 value length must be equal or lesser than 5
// The MaxLength2 value `goframe` length must be equal or lesser than 5
}
func ExampleValidator_Between() {
@ -1033,11 +1053,12 @@ func ExampleValidator_Between() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Age2 value must be between 1 and 100; The Score2 value must be between 0 and 10
// The Age2 value `101` must be between 1 and 100
// The Score2 value `-0.5` must be between 0 and 10
}
func ExampleValidator_Min() {
@ -1058,11 +1079,12 @@ func ExampleValidator_Min() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Age1 value must be equal or greater than 100; The Score1 value must be equal or greater than 10
// The Age1 value `50` must be equal or greater than 100
// The Score1 value `9.8` must be equal or greater than 10
}
func ExampleValidator_Max() {
@ -1083,11 +1105,12 @@ func ExampleValidator_Max() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Age2 value must be equal or lesser than 100; The Score2 value must be equal or lesser than 10
// The Age2 value `101` must be equal or lesser than 100
// The Score2 value `10.1` must be equal or lesser than 10
}
func ExampleValidator_Json() {
@ -1108,7 +1131,7 @@ func ExampleValidator_Json() {
}
// Output:
// The JSON2 value must be a valid JSON string
// The JSON2 value `{"name":"goframe","author":"郭强","test"}` is not a valid JSON string
}
func ExampleValidator_Integer() {
@ -1127,11 +1150,12 @@ func ExampleValidator_Integer() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Float value must be an integer; The Str value must be an integer
// The Float value `10.0` is not an integer
// The Str value `goframe` is not an integer
}
func ExampleValidator_Float() {
@ -1154,7 +1178,7 @@ func ExampleValidator_Float() {
}
// Output:
// The Str value must be a float
// The Str value `goframe` is invalid
}
func ExampleValidator_Boolean() {
@ -1179,11 +1203,12 @@ func ExampleValidator_Boolean() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Print(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Float value field must be true or false; The Str3 value field must be true or false
// The Float value `10` field must be true or false
// The Str3 value `goframe` field must be true or false
}
func ExampleValidator_Same() {
@ -1205,7 +1230,7 @@ func ExampleValidator_Same() {
}
// Output:
// The Password value must be the same as field Password2
// The Password value `goframe.org` must be the same as field Password2
}
func ExampleValidator_Different() {
@ -1227,7 +1252,7 @@ func ExampleValidator_Different() {
}
// Output:
// The OtherMailAddr value must be different from field MailAddr
// The OtherMailAddr value `gf@goframe.org` must be different from field MailAddr
}
func ExampleValidator_In() {
@ -1249,7 +1274,7 @@ func ExampleValidator_In() {
}
// Output:
// The Gender value is not in acceptable range
// The Gender value `3` is not in acceptable range: 0,1,2
}
func ExampleValidator_NotIn() {
@ -1271,7 +1296,7 @@ func ExampleValidator_NotIn() {
}
// Output:
// The InvalidIndex value is not in acceptable range
// The InvalidIndex value `1` must not be in range: -1,0,1
}
func ExampleValidator_Regex() {
@ -1289,9 +1314,10 @@ func ExampleValidator_Regex() {
}
)
if err := g.Validator().CheckStruct(ctx, req); err != nil {
fmt.Println(err)
fmt.Print(gstr.Join(err.Strings(), "\n"))
}
// Output:
// The Regex1 value is invalid; The Regex2 value is invalid
// The Regex1 value `1234` must be in regex of: [1-9][0-9]{4,14}
// The Regex2 value `01234` must be in regex of: [1-9][0-9]{4,14}
}

View File

@ -693,7 +693,7 @@ func Test_Length(t *testing.T) {
func Test_MinLength(t *testing.T) {
rule := "min-length:6"
msgs := map[string]string{
"min-length": "地址长度至少为:min位",
"min-length": "地址长度至少为{min}位",
}
if m := gvalid.CheckValue(context.TODO(), "123456", rule, nil); m != nil {
t.Error(m)
@ -714,7 +714,7 @@ func Test_MinLength(t *testing.T) {
func Test_MaxLength(t *testing.T) {
rule := "max-length:6"
msgs := map[string]string{
"max-length": "地址长度至大为:max位",
"max-length": "地址长度至大为{max}位",
}
if m := gvalid.CheckValue(context.TODO(), "12345", rule, nil); m != nil {
t.Error(m)

View File

@ -30,8 +30,8 @@ func Test_CheckMap1(t *testing.T) {
t.Error("CheckMap校验失败")
} else {
t.Assert(len(m.Maps()), 2)
t.Assert(m.Maps()["id"]["between"], "The id value must be between 1 and 100")
t.Assert(m.Maps()["name"]["length"], "The name value length must be between 6 and 16")
t.Assert(m.Maps()["id"]["between"], "The id value `0` must be between 1 and 100")
t.Assert(m.Maps()["name"]["length"], "The name value `john` length must be between 6 and 16")
}
})
}
@ -53,10 +53,10 @@ func Test_CheckMap2(t *testing.T) {
"name": "required|length:6,16",
}
msgs := gvalid.CustomMsg{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules, msgs); m == nil {
@ -72,10 +72,10 @@ func Test_CheckMap2(t *testing.T) {
"name": "required|length:4,16",
}
msgs = map[string]interface{}{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules, msgs); m != nil {
@ -91,10 +91,10 @@ func Test_CheckMap2(t *testing.T) {
"name": "",
}
msgs = map[string]interface{}{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules, msgs); m != nil {
@ -110,10 +110,10 @@ func Test_CheckMap2(t *testing.T) {
"@required|length:4,16",
}
msgs = map[string]interface{}{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules2, msgs); m != nil {
@ -129,10 +129,10 @@ func Test_CheckMap2(t *testing.T) {
"name@required|length:4,16#名称不能为空|",
}
msgs = map[string]interface{}{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules2, msgs); m != nil {
@ -148,10 +148,10 @@ func Test_CheckMap2(t *testing.T) {
"name@required|length:4,16#名称不能为空",
}
msgs = map[string]interface{}{
"id": "ID不能为空|ID范围应当为:min到:max",
"id": "ID不能为空|ID范围应当为{min}到{max}",
"name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
}
if m := gvalid.CheckMap(context.TODO(), kvmap, rules2, msgs); m != nil {
@ -181,8 +181,8 @@ func Test_Sequence(t *testing.T) {
"password2": "1234567",
}
rules := []string{
"passport@required|length:6,16#账号不能为空|账号长度应当在:min到:max之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等",
"passport@required|length:6,16#账号不能为空|账号长度应当在{min}到{max}之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在{min}到{max}之间|两次密码输入不相等",
"password2@required|length:6,16#",
}
err := gvalid.CheckMap(context.TODO(), params, rules)
@ -221,8 +221,8 @@ func Test_Map_Bail(t *testing.T) {
"password2": "1234567",
}
rules := []string{
"passport@required|length:6,16#账号不能为空|账号长度应当在:min到:max之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等",
"passport@required|length:6,16#账号不能为空|账号长度应当在{min}到{max}之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在{min}到{max}之间|两次密码输入不相等",
"password2@required|length:6,16#",
}
err := g.Validator().Bail().Rules(rules).CheckMap(ctx, params)
@ -237,8 +237,8 @@ func Test_Map_Bail(t *testing.T) {
"password2": "1234567",
}
rules := []string{
"passport@bail|required|length:6,16#|账号不能为空|账号长度应当在:min到:max之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在:min到:max之间|两次密码输入不相等",
"passport@bail|required|length:6,16#|账号不能为空|账号长度应当在{min}到{max}之间",
"password@required|length:6,16|same:password2#密码不能为空|密码长度应当在{min}到{max}之间|两次密码输入不相等",
"password2@required|length:6,16#",
}
err := g.Validator().Bail().Rules(rules).CheckMap(ctx, params)

View File

@ -31,7 +31,7 @@ func Test_CheckStruct(t *testing.T) {
msgs := map[string]interface{}{
"Name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
"Age": "年龄为18到30周岁",
}
@ -52,7 +52,7 @@ func Test_CheckStruct(t *testing.T) {
msgs := map[string]interface{}{
"Name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
"Age": "年龄为18到30周岁",
}
@ -77,7 +77,7 @@ func Test_CheckStruct(t *testing.T) {
msgs := map[string]interface{}{
"Name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
"Age": "年龄为18到30周岁",
}
@ -102,7 +102,7 @@ func Test_CheckStruct(t *testing.T) {
msgs := map[string]interface{}{
"Name": map[string]string{
"required": "名称不能为空",
"length": "名称长度为:min到:max个字符",
"length": "名称长度为{min}到{max}个字符",
},
"Age": "年龄为18到30周岁",
}
@ -336,7 +336,7 @@ func Test_CheckStruct_Optional(t *testing.T) {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId string `v:"between:1,10000 # project id must between :min, :max"`
ProjectId string `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,
@ -349,7 +349,7 @@ func Test_CheckStruct_Optional(t *testing.T) {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId *gvar.Var `v:"between:1,10000 # project id must between :min, :max"`
ProjectId *gvar.Var `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,
@ -362,7 +362,7 @@ func Test_CheckStruct_Optional(t *testing.T) {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId int `v:"between:1,10000 # project id must between :min, :max"`
ProjectId int `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,

View File

@ -22,7 +22,7 @@ func Test_Map(t *testing.T) {
val = "0.0.0"
err = gvalid.CheckValue(context.TODO(), val, rule, nil)
msg = map[string]string{
"ipv4": "The value must be a valid IPv4 address",
"ipv4": "The value `0.0.0` is not a valid IPv4 address",
}
)
t.Assert(err.Map(), msg)
@ -36,7 +36,7 @@ func Test_FirstString(t *testing.T) {
val = "0.0.0"
err = gvalid.CheckValue(context.TODO(), val, rule, nil)
)
t.Assert(err.FirstError(), "The value must be a valid IPv4 address")
t.Assert(err.FirstError(), "The value `0.0.0` is not a valid IPv4 address")
})
}

View File

@ -38,7 +38,7 @@ func TestValidator_I18n(t *testing.T) {
type Params struct {
Page int `v:"required|min:1 # page is required"`
Size int `v:"required|between:1,100 # size is required"`
ProjectId int `v:"between:1,10000 # project id must between :min, :max"`
ProjectId int `v:"between:1,10000 # project id must between {min}, {max}"`
}
obj := &Params{
Page: 1,

View File

@ -1,47 +1,47 @@
"gf.gvalid.rule.required" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-if" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-unless" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-with" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-with-all" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-without" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-without-all" = ":attribute 字段不能为空"
"gf.gvalid.rule.date" = ":attribute 日期格式不满足Y-m-d格式例如: 2001-02-03"
"gf.gvalid.rule.datetime" = ":attribute 日期格式不满足Y-m-d H:i:s格式例如: 2001-02-03 12:00:00"
"gf.gvalid.rule.date-format" = ":attribute 日期格式不满足:format"
"gf.gvalid.rule.email" = ":attribute 邮箱地址格式不正确"
"gf.gvalid.rule.phone" = ":attribute 手机号码格式不正确"
"gf.gvalid.rule.phone-loose" = ":attribute 手机号码格式不正确"
"gf.gvalid.rule.telephone" = ":attribute 电话号码格式不正确"
"gf.gvalid.rule.passport" = ":attribute 账号格式不合法必需以字母开头只能包含字母、数字和下划线长度在6~18之间"
"gf.gvalid.rule.password" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符"
"gf.gvalid.rule.password2" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母和数字"
"gf.gvalid.rule.password3" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母、数字和特殊字符"
"gf.gvalid.rule.postcode" = ":attribute 邮政编码不正确"
"gf.gvalid.rule.resident-id" = ":attribute 身份证号码格式不正确"
"gf.gvalid.rule.bank-card" = ":attribute 银行卡号格式不正确"
"gf.gvalid.rule.qq" = ":attribute QQ号码格式不正确"
"gf.gvalid.rule.ip" = ":attribute IP地址格式不正确"
"gf.gvalid.rule.ipv4" = ":attribute IPv4地址格式不正确"
"gf.gvalid.rule.ipv6" = ":attribute IPv6地址格式不正确"
"gf.gvalid.rule.mac" = ":attribute MAC地址格式不正确"
"gf.gvalid.rule.url" = ":attribute URL地址格式不正确"
"gf.gvalid.rule.domain" = ":attribute 域名格式不正确"
"gf.gvalid.rule.length" = ":attribute 字段长度为:min到:max个字符"
"gf.gvalid.rule.min-length" = ":attribute 字段最小长度为:min"
"gf.gvalid.rule.max-length" = ":attribute 字段最大长度为:max"
"gf.gvalid.rule.size" = ":attribute 字段长度必须为:size"
"gf.gvalid.rule.between" = ":attribute 字段大小为:min到:max"
"gf.gvalid.rule.min" = ":attribute 字段最小值为:min"
"gf.gvalid.rule.max" = ":attribute 字段最大值为:max"
"gf.gvalid.rule.json" = ":attribute 字段应当为JSON格式"
"gf.gvalid.rule.xml" = ":attribute 字段应当为XML格式"
"gf.gvalid.rule.array" = ":attribute 字段应当为数组"
"gf.gvalid.rule.integer" = ":attribute 字段应当为整数"
"gf.gvalid.rule.float" = ":attribute 字段应当为浮点数"
"gf.gvalid.rule.boolean" = ":attribute 字段应当为布尔值"
"gf.gvalid.rule.same" = ":attribute 字段值必须和:field相同"
"gf.gvalid.rule.different" = ":attribute 字段值不能与:field相同"
"gf.gvalid.rule.in" = ":attribute 字段值不合法"
"gf.gvalid.rule.not-in" = ":attribute 字段值不合法"
"gf.gvalid.rule.regex" = ":attribute 字段值不合法"
"gf.gvalid.rule.__default__" = ":attribute 字段值不合法"
"gf.gvalid.rule.required" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-if" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-unless" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-with" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-with-all" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-without" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-without-all" = "{attribute}字段不能为空"
"gf.gvalid.rule.date" = "{attribute}字段值`{value}`日期格式不满足Y-m-d格式例如: 2001-02-03"
"gf.gvalid.rule.datetime" = "{attribute}字段值`{value}`日期格式不满足Y-m-d H:i:s格式例如: 2001-02-03 12:00:00"
"gf.gvalid.rule.date-format" = "{attribute}字段值`{value}`日期格式不满足{format}"
"gf.gvalid.rule.email" = "{attribute}字段值`{value}`邮箱地址格式不正确"
"gf.gvalid.rule.phone" = "{attribute}字段值`{value}`手机号码格式不正确"
"gf.gvalid.rule.phone-loose" = "{attribute}字段值`{value}`手机号码格式不正确"
"gf.gvalid.rule.telephone" = "{attribute}字段值`{value}`电话号码格式不正确"
"gf.gvalid.rule.passport" = "{attribute}字段值`{value}`账号格式不合法必需以字母开头只能包含字母、数字和下划线长度在6~18之间"
"gf.gvalid.rule.password" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符"
"gf.gvalid.rule.password2" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母和数字"
"gf.gvalid.rule.password3" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母、数字和特殊字符"
"gf.gvalid.rule.postcode" = "{attribute}字段值`{value}`邮政编码不正确"
"gf.gvalid.rule.resident-id" = "{attribute}字段值`{value}`身份证号码格式不正确"
"gf.gvalid.rule.bank-card" = "{attribute}字段值`{value}`银行卡号格式不正确"
"gf.gvalid.rule.qq" = "{attribute}字段值`{value}`QQ号码格式不正确"
"gf.gvalid.rule.ip" = "{attribute}字段值`{value}`IP地址格式不正确"
"gf.gvalid.rule.ipv4" = "{attribute}字段值`{value}`IPv4地址格式不正确"
"gf.gvalid.rule.ipv6" = "{attribute}字段值`{value}`IPv6地址格式不正确"
"gf.gvalid.rule.mac" = "{attribute}字段值`{value}`MAC地址格式不正确"
"gf.gvalid.rule.url" = "{attribute}字段值`{value}`URL地址格式不正确"
"gf.gvalid.rule.domain" = "{attribute}字段值`{value}`域名格式不正确"
"gf.gvalid.rule.length" = "{attribute}字段值`{value}`字段长度应当为{min}到{max}个字符"
"gf.gvalid.rule.min-length" = "{attribute}字段值`{value}`字段最小长度应当为{min}"
"gf.gvalid.rule.max-length" = "{attribute}字段值`{value}`字段最大长度应当为{max}"
"gf.gvalid.rule.size" = "{attribute}字段值`{value}`字段长度必须应当为{size}"
"gf.gvalid.rule.between" = "{attribute}字段值`{value}`字段大小应当为{min}到{max}"
"gf.gvalid.rule.min" = "{attribute}字段值`{value}`字段最小值应当为{min}"
"gf.gvalid.rule.max" = "{attribute}字段值`{value}`字段最大值应当为{max}"
"gf.gvalid.rule.json" = "{attribute}字段值`{value}`字段应当为JSON格式"
"gf.gvalid.rule.xml" = "{attribute}字段值`{value}`字段应当为XML格式"
"gf.gvalid.rule.array" = "{attribute}字段值`{value}`字段应当为数组"
"gf.gvalid.rule.integer" = "{attribute}字段值`{value}`字段应当为整数"
"gf.gvalid.rule.float" = "{attribute}字段值`{value}`字段应当为浮点数"
"gf.gvalid.rule.boolean" = "{attribute}字段值`{value}`字段应当为布尔值"
"gf.gvalid.rule.same" = "{attribute}字段值`{value}`字段值必须和{field}相同"
"gf.gvalid.rule.different" = "{attribute}字段值`{value}`字段值不能与{field}相同"
"gf.gvalid.rule.in" = "{attribute}字段值`{value}`字段值应当满足取值范围:{pattern}"
"gf.gvalid.rule.not-in" = "{attribute}字段值`{value}`字段值不应当满足取值范围:{pattern}"
"gf.gvalid.rule.regex" = "{attribute}字段值`{value}`字段值不满足规则:{pattern}"
"gf.gvalid.rule.__default__" = "{attribute}字段值`{value}`字段值不合法"

View File

@ -1,47 +1,45 @@
"gf.gvalid.rule.required" = "The :attribute field is required"
"gf.gvalid.rule.required-if" = "The :attribute field is required"
"gf.gvalid.rule.required-unless" = "The :attribute field is required"
"gf.gvalid.rule.required-with" = "The :attribute field is required"
"gf.gvalid.rule.required-with-all" = "The :attribute field is required"
"gf.gvalid.rule.required-without" = "The :attribute field is required"
"gf.gvalid.rule.required-without-all" = "The :attribute field is required"
"gf.gvalid.rule.date" = "The :attribute value is not a valid date"
"gf.gvalid.rule.datetime" = "The :attribute value is not a valid datetime"
"gf.gvalid.rule.date-format" = "The :attribute value does not match the format :format"
"gf.gvalid.rule.email" = "The :attribute value must be a valid email address"
"gf.gvalid.rule.phone" = "The :attribute value must be a valid phone number"
"gf.gvalid.rule.phone-loose" = "The :attribute value must be a valid phone number"
"gf.gvalid.rule.telephone" = "The :attribute value must be a valid telephone number"
"gf.gvalid.rule.passport" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password2" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password3" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.postcode" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.resident-id" = "The :attribute value is not a valid resident id number"
"gf.gvalid.rule.bank-card" = "The :attribute value must be a valid bank card number"
"gf.gvalid.rule.qq" = "The :attribute value must be a valid QQ number"
"gf.gvalid.rule.ip" = "The :attribute value must be a valid IP address"
"gf.gvalid.rule.ipv4" = "The :attribute value must be a valid IPv4 address"
"gf.gvalid.rule.ipv6" = "The :attribute value must be a valid IPv6 address"
"gf.gvalid.rule.mac" = "The :attribute value must be a valid MAC address"
"gf.gvalid.rule.url" = "The :attribute value must be a valid URL address"
"gf.gvalid.rule.domain" = "The :attribute value must be a valid domain format"
"gf.gvalid.rule.length" = "The :attribute value length must be between :min and :max"
"gf.gvalid.rule.min-length" = "The :attribute value length must be equal or greater than :min"
"gf.gvalid.rule.max-length" = "The :attribute value length must be equal or lesser than :max"
"gf.gvalid.rule.size" = "The :attribute value length must be :size"
"gf.gvalid.rule.between" = "The :attribute value must be between :min and :max"
"gf.gvalid.rule.min" = "The :attribute value must be equal or greater than :min"
"gf.gvalid.rule.max" = "The :attribute value must be equal or lesser than :max"
"gf.gvalid.rule.json" = "The :attribute value must be a valid JSON string"
"gf.gvalid.rule.xml" = "The :attribute value must be a valid XML string"
"gf.gvalid.rule.array" = "The :attribute value must be an array"
"gf.gvalid.rule.integer" = "The :attribute value must be an integer"
"gf.gvalid.rule.float" = "The :attribute value must be a float"
"gf.gvalid.rule.boolean" = "The :attribute value field must be true or false"
"gf.gvalid.rule.same" = "The :attribute value must be the same as field :field"
"gf.gvalid.rule.different" = "The :attribute value must be different from field :field"
"gf.gvalid.rule.in" = "The :attribute value is not in acceptable range"
"gf.gvalid.rule.not-in" = "The :attribute value is not in acceptable range"
"gf.gvalid.rule.regex" = "The :attribute value is invalid"
"gf.gvalid.rule.__default__" = "The :attribute value is invalid"
"gf.gvalid.rule.required" = "The {attribute} field is required"
"gf.gvalid.rule.required-if" = "The {attribute} field is required"
"gf.gvalid.rule.required-unless" = "The {attribute} field is required"
"gf.gvalid.rule.required-with" = "The {attribute} field is required"
"gf.gvalid.rule.required-with-all" = "The {attribute} field is required"
"gf.gvalid.rule.required-without" = "The {attribute} field is required"
"gf.gvalid.rule.required-without-all" = "The {attribute} field is required"
"gf.gvalid.rule.date" = "The {attribute} value `{value}` is not a valid date"
"gf.gvalid.rule.datetime" = "The {attribute} value `{value}` is not a valid datetime"
"gf.gvalid.rule.date-format" = "The {attribute} value `{value}` does not match the format: {pattern}"
"gf.gvalid.rule.email" = "The {attribute} value `{value}` is not a valid email address"
"gf.gvalid.rule.phone" = "The {attribute} value `{value}` is not a valid phone number"
"gf.gvalid.rule.telephone" = "The {attribute} value `{value}` is not a valid telephone number"
"gf.gvalid.rule.passport" = "The {attribute} value `{value}` is not a valid passport format"
"gf.gvalid.rule.password" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.password2" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.password3" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.postcode" = "The {attribute} value `{value}` is not a valid postcode format"
"gf.gvalid.rule.resident-id" = "The {attribute} value `{value}` is not a valid resident id number"
"gf.gvalid.rule.bank-card" = "The {attribute} value `{value}` is not a valid bank card number"
"gf.gvalid.rule.qq" = "The {attribute} value `{value}` is not a valid QQ number"
"gf.gvalid.rule.ip" = "The {attribute} value `{value}` is not a valid IP address"
"gf.gvalid.rule.ipv4" = "The {attribute} value `{value}` is not a valid IPv4 address"
"gf.gvalid.rule.ipv6" = "The {attribute} value `{value}` is not a valid IPv6 address"
"gf.gvalid.rule.mac" = "The {attribute} value `{value}` is not a valid MAC address"
"gf.gvalid.rule.url" = "The {attribute} value `{value}` is not a valid URL address"
"gf.gvalid.rule.domain" = "The {attribute} value `{value}` is not a valid domain format"
"gf.gvalid.rule.length" = "The {attribute} value `{value}` length must be between {min} and {max}"
"gf.gvalid.rule.min-length" = "The {attribute} value `{value}` length must be equal or greater than {min}"
"gf.gvalid.rule.max-length" = "The {attribute} value `{value}` length must be equal or lesser than {max}"
"gf.gvalid.rule.size" = "The {attribute} value `{value}` length must be {size}"
"gf.gvalid.rule.between" = "The {attribute} value `{value}` must be between {min} and {max}"
"gf.gvalid.rule.min" = "The {attribute} value `{value}` must be equal or greater than {min}"
"gf.gvalid.rule.max" = "The {attribute} value `{value}` must be equal or lesser than {max}"
"gf.gvalid.rule.json" = "The {attribute} value `{value}` is not a valid JSON string"
"gf.gvalid.rule.xml" = "The {attribute} value `{value}` is not a valid XML string"
"gf.gvalid.rule.array" = "The {attribute} value `{value}` is not an array"
"gf.gvalid.rule.integer" = "The {attribute} value `{value}` is not an integer"
"gf.gvalid.rule.boolean" = "The {attribute} value `{value}` field must be true or false"
"gf.gvalid.rule.same" = "The {attribute} value `{value}` must be the same as field {pattern}"
"gf.gvalid.rule.different" = "The {attribute} value `{value}` must be different from field {pattern}"
"gf.gvalid.rule.in" = "The {attribute} value `{value}` is not in acceptable range: {pattern}"
"gf.gvalid.rule.not-in" = "The {attribute} value `{value}` must not be in range: {pattern}"
"gf.gvalid.rule.regex" = "The {attribute} value `{value}` must be in regex of: {pattern}"
"gf.gvalid.rule.gf.gvalid.rule.__default__" = "The :attribute value `:value` is invalid"

View File

@ -1,49 +1,49 @@
"gf.gvalid.rule.required" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-if" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-unless" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-with" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-with-all" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-without" = ":attribute 字段不能为空"
"gf.gvalid.rule.required-without-all" = ":attribute 字段不能为空"
"gf.gvalid.rule.date" = ":attribute 日期格式不正确"
"gf.gvalid.rule.date-format" = ":attribute 日期格式不满足:format"
"gf.gvalid.rule.email" = ":attribute 邮箱地址格式不正确"
"gf.gvalid.rule.phone" = ":attribute 手机号码格式不正确"
"gf.gvalid.rule.phone-loose" = ":attribute 手机号码格式不正确"
"gf.gvalid.rule.telephone" = ":attribute 电话号码格式不正确"
"gf.gvalid.rule.passport" = ":attribute 账号格式不合法必需以字母开头只能包含字母、数字和下划线长度在6~18之间"
"gf.gvalid.rule.password" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符"
"gf.gvalid.rule.password2" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符,必须包含大小写字母和数字"
"gf.gvalid.rule.password3" = ":attribute 密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母数字和特殊字符"
"gf.gvalid.rule.postcode" = ":attribute 邮政编码不正确"
"gf.gvalid.rule.resident-id" = ":attribute 身份证号码格式不正确"
"gf.gvalid.rule.bank-card" = ":attribute 银行卡号格式不正确"
"gf.gvalid.rule.qq" = ":attribute QQ号码格式不正确"
"gf.gvalid.rule.ip" = ":attribute IP地址格式不正确"
"gf.gvalid.rule.ipv4" = ":attribute IPv4地址格式不正确"
"gf.gvalid.rule.ipv6" = ":attribute IPv6地址格式不正确"
"gf.gvalid.rule.mac" = ":attribute MAC地址格式不正确"
"gf.gvalid.rule.url" = ":attribute URL地址格式不正确"
"gf.gvalid.rule.domain" = ":attribute 域名格式不正确"
"gf.gvalid.rule.length" = ":attribute 字段长度为:min到:max个字符"
"gf.gvalid.rule.min-length" = ":attribute 字段最小长度为:min"
"gf.gvalid.rule.max-length" = ":attribute 字段最长度为:max"
"gf.gvalid.rule.size" = ":attribute 字段长度为必须为:size"
"gf.gvalid.rule.between" = ":attribute 字段大小为:min到:max"
"gf.gvalid.rule.min" = ":attribute 字段最小值为:min"
"gf.gvalid.rule.max" = ":attribute 字段最大值为:max"
"gf.gvalid.rule.json" = ":attribute 字段应当为JSON格式"
"gf.gvalid.rule.xml" = ":attribute 字段应当为XML格式"
"gf.gvalid.rule.array" = ":attribute 字段应当为数组"
"gf.gvalid.rule.integer" = ":attribute 字段应当为数"
"gf.gvalid.rule.float" = ":attribute 字段应当为浮点数"
"gf.gvalid.rule.boolean" = ":attribute 字段应当为布尔值"
"gf.gvalid.rule.same" = ":attribute 字段值必须和:field相同"
"gf.gvalid.rule.different" = ":attribute 字段值不能与:field相同"
"gf.gvalid.rule.in" = ":attribute 字段值不合法"
"gf.gvalid.rule.not-in" = ":attribute 字段值不合法"
"gf.gvalid.rule.regex" = ":attribute 字段值不合法"
"gf.gvalid.rule.__default__" = ":attribute 字段值不合法"
"gf.gvalid.rule.required" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-if" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-unless" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-with" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-with-all" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-without" = "{attribute}字段不能为空"
"gf.gvalid.rule.required-without-all" = "{attribute}字段不能为空"
"gf.gvalid.rule.date" = "{attribute}字段值`{value}`日期格式不满足Y-m-d格式例如: 2001-02-03"
"gf.gvalid.rule.datetime" = "{attribute}字段值`{value}`日期格式不满足Y-m-d H:i:s格式例如: 2001-02-03 12:00:00"
"gf.gvalid.rule.date-format" = "{attribute}字段值`{value}`日期格式不满足{format}"
"gf.gvalid.rule.email" = "{attribute}字段值`{value}`邮箱地址格式不正确"
"gf.gvalid.rule.phone" = "{attribute}字段值`{value}`手机号码格式不正确"
"gf.gvalid.rule.phone-loose" = "{attribute}字段值`{value}`手机号码格式不正确"
"gf.gvalid.rule.telephone" = "{attribute}字段值`{value}`电话号码格式不正确"
"gf.gvalid.rule.passport" = "{attribute}字段值`{value}`账号格式不合法必需以字母开头只能包含字母、数字和下划线长度在6~18之间"
"gf.gvalid.rule.password" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符"
"gf.gvalid.rule.password2" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母数字"
"gf.gvalid.rule.password3" = "{attribute}字段值`{value}`密码格式不合法密码格式为任意6-18位的可见字符必须包含大小写字母、数字和特殊字符"
"gf.gvalid.rule.postcode" = "{attribute}字段值`{value}`邮政编码不正确"
"gf.gvalid.rule.resident-id" = "{attribute}字段值`{value}`身份证号码格式不正确"
"gf.gvalid.rule.bank-card" = "{attribute}字段值`{value}`银行卡号格式不正确"
"gf.gvalid.rule.qq" = "{attribute}字段值`{value}`QQ号码格式不正确"
"gf.gvalid.rule.ip" = "{attribute}字段值`{value}`IP地址格式不正确"
"gf.gvalid.rule.ipv4" = "{attribute}字段值`{value}`IPv4地址格式不正确"
"gf.gvalid.rule.ipv6" = "{attribute}字段值`{value}`IPv6地址格式不正确"
"gf.gvalid.rule.mac" = "{attribute}字段值`{value}`MAC地址格式不正确"
"gf.gvalid.rule.url" = "{attribute}字段值`{value}`URL地址格式不正确"
"gf.gvalid.rule.domain" = "{attribute}字段值`{value}`域名格式不正确"
"gf.gvalid.rule.length" = "{attribute}字段值`{value}`字段长度应当为{min}到{max}个字符"
"gf.gvalid.rule.min-length" = "{attribute}字段值`{value}`字段最长度应当为{min}"
"gf.gvalid.rule.max-length" = "{attribute}字段值`{value}`字段最大长度应当为{max}"
"gf.gvalid.rule.size" = "{attribute}字段值`{value}`字段长度必须应当为{size}"
"gf.gvalid.rule.between" = "{attribute}字段值`{value}`字段大小应当为{min}到{max}"
"gf.gvalid.rule.min" = "{attribute}字段值`{value}`字段最小值应当为{min}"
"gf.gvalid.rule.max" = "{attribute}字段值`{value}`字段最大值应当为{max}"
"gf.gvalid.rule.json" = "{attribute}字段值`{value}`字段应当为JSON格式"
"gf.gvalid.rule.xml" = "{attribute}字段值`{value}`字段应当为XML格式"
"gf.gvalid.rule.array" = "{attribute}字段值`{value}`字段应当为数"
"gf.gvalid.rule.integer" = "{attribute}字段值`{value}`字段应当为数"
"gf.gvalid.rule.float" = "{attribute}字段值`{value}`字段应当为浮点数"
"gf.gvalid.rule.boolean" = "{attribute}字段值`{value}`字段应当为布尔值"
"gf.gvalid.rule.same" = "{attribute}字段值`{value}`字段值必须和{field}相同"
"gf.gvalid.rule.different" = "{attribute}字段值`{value}`字段值不能与{field}相同"
"gf.gvalid.rule.in" = "{attribute}字段值`{value}`字段值应当满足取值范围:{pattern}"
"gf.gvalid.rule.not-in" = "{attribute}字段值`{value}`字段值不应当满足取值范围:{pattern}"
"gf.gvalid.rule.regex" = "{attribute}字段值`{value}`字段值不满足规则:{pattern}"
"gf.gvalid.rule.__default__" = "{attribute}字段值`{value}`字段值不合法"
"CustomMessage" = "自定义错误"
"project id must between :min, :max" = "项目ID必须大于等于:min并且要小于等于:max"
"project id must between {min}, {max}" = "项目ID必须大于等于{min}并且要小于等于{max}"

View File

@ -1,46 +1,45 @@
"gf.gvalid.rule.required" = "The :attribute field is required"
"gf.gvalid.rule.required-if" = "The :attribute field is required"
"gf.gvalid.rule.required-unless" = "The :attribute field is required"
"gf.gvalid.rule.required-with" = "The :attribute field is required"
"gf.gvalid.rule.required-with-all" = "The :attribute field is required"
"gf.gvalid.rule.required-without" = "The :attribute field is required"
"gf.gvalid.rule.required-without-all" = "The :attribute field is required"
"gf.gvalid.rule.date" = "The :attribute value is not a valid date"
"gf.gvalid.rule.date-format" = "The :attribute value does not match the format :format"
"gf.gvalid.rule.email" = "The :attribute value must be a valid email address"
"gf.gvalid.rule.phone" = "The :attribute value must be a valid phone number"
"gf.gvalid.rule.phone-loose" = "The :attribute value must be a valid phone number"
"gf.gvalid.rule.telephone" = "The :attribute value must be a valid telephone number"
"gf.gvalid.rule.passport" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password2" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.password3" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.postcode" = "The :attribute value is not a valid passport format"
"gf.gvalid.rule.resident-id" = "The :attribute value is not a valid resident id number"
"gf.gvalid.rule.bank-card" = "The :attribute value must be a valid bank card number"
"gf.gvalid.rule.qq" = "The :attribute value must be a valid QQ number"
"gf.gvalid.rule.ip" = "The :attribute value must be a valid IP address"
"gf.gvalid.rule.ipv4" = "The :attribute value must be a valid IPv4 address"
"gf.gvalid.rule.ipv6" = "The :attribute value must be a valid IPv6 address"
"gf.gvalid.rule.mac" = "The :attribute value must be a valid MAC address"
"gf.gvalid.rule.url" = "The :attribute value must be a valid URL address"
"gf.gvalid.rule.domain" = "The :attribute value must be a valid domain format"
"gf.gvalid.rule.length" = "The :attribute value length must be between :min and :max"
"gf.gvalid.rule.min-length" = "The :attribute value length must be equal or greater than :min"
"gf.gvalid.rule.max-length" = "The :attribute value length must be equal or lesser than :max"
"gf.gvalid.rule.size" = "The :attribute value length must be :size"
"gf.gvalid.rule.between" = "The :attribute value must be between :min and :max"
"gf.gvalid.rule.min" = "The :attribute value must be equal or greater than :min"
"gf.gvalid.rule.max" = "The :attribute value must be equal or lesser than :max"
"gf.gvalid.rule.json" = "The :attribute value must be a valid JSON string"
"gf.gvalid.rule.xml" = "The :attribute value must be a valid XML string"
"gf.gvalid.rule.array" = "The :attribute value must be an array"
"gf.gvalid.rule.integer" = "The :attribute value must be an integer"
"gf.gvalid.rule.float" = "The :attribute value must be a float"
"gf.gvalid.rule.boolean" = "The :attribute value field must be true or false"
"gf.gvalid.rule.same" = "The :attribute value must be the same as field :field"
"gf.gvalid.rule.different" = "The :attribute value must be different from field :field"
"gf.gvalid.rule.in" = "The :attribute value is not in acceptable range"
"gf.gvalid.rule.not-in" = "The :attribute value is not in acceptable range"
"gf.gvalid.rule.regex" = "The :attribute value is invalid"
"gf.gvalid.rule.__default__" = "The :attribute value is invalid"
"gf.gvalid.rule.required" = "The {attribute} field is required"
"gf.gvalid.rule.required-if" = "The {attribute} field is required"
"gf.gvalid.rule.required-unless" = "The {attribute} field is required"
"gf.gvalid.rule.required-with" = "The {attribute} field is required"
"gf.gvalid.rule.required-with-all" = "The {attribute} field is required"
"gf.gvalid.rule.required-without" = "The {attribute} field is required"
"gf.gvalid.rule.required-without-all" = "The {attribute} field is required"
"gf.gvalid.rule.date" = "The {attribute} value `{value}` is not a valid date"
"gf.gvalid.rule.datetime" = "The {attribute} value `{value}` is not a valid datetime"
"gf.gvalid.rule.date-format" = "The {attribute} value `{value}` does not match the format: {pattern}"
"gf.gvalid.rule.email" = "The {attribute} value `{value}` is not a valid email address"
"gf.gvalid.rule.phone" = "The {attribute} value `{value}` is not a valid phone number"
"gf.gvalid.rule.telephone" = "The {attribute} value `{value}` is not a valid telephone number"
"gf.gvalid.rule.passport" = "The {attribute} value `{value}` is not a valid passport format"
"gf.gvalid.rule.password" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.password2" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.password3" = "The {attribute} value `{value}` is not a valid password format"
"gf.gvalid.rule.postcode" = "The {attribute} value `{value}` is not a valid postcode format"
"gf.gvalid.rule.resident-id" = "The {attribute} value `{value}` is not a valid resident id number"
"gf.gvalid.rule.bank-card" = "The {attribute} value `{value}` is not a valid bank card number"
"gf.gvalid.rule.qq" = "The {attribute} value `{value}` is not a valid QQ number"
"gf.gvalid.rule.ip" = "The {attribute} value `{value}` is not a valid IP address"
"gf.gvalid.rule.ipv4" = "The {attribute} value `{value}` is not a valid IPv4 address"
"gf.gvalid.rule.ipv6" = "The {attribute} value `{value}` is not a valid IPv6 address"
"gf.gvalid.rule.mac" = "The {attribute} value `{value}` is not a valid MAC address"
"gf.gvalid.rule.url" = "The {attribute} value `{value}` is not a valid URL address"
"gf.gvalid.rule.domain" = "The {attribute} value `{value}` is not a valid domain format"
"gf.gvalid.rule.length" = "The {attribute} value `{value}` length must be between {min} and {max}"
"gf.gvalid.rule.min-length" = "The {attribute} value `{value}` length must be equal or greater than {min}"
"gf.gvalid.rule.max-length" = "The {attribute} value `{value}` length must be equal or lesser than {max}"
"gf.gvalid.rule.size" = "The {attribute} value `{value}` length must be {size}"
"gf.gvalid.rule.between" = "The {attribute} value `{value}` must be between {min} and {max}"
"gf.gvalid.rule.min" = "The {attribute} value `{value}` must be equal or greater than {min}"
"gf.gvalid.rule.max" = "The {attribute} value `{value}` must be equal or lesser than {max}"
"gf.gvalid.rule.json" = "The {attribute} value `{value}` is not a valid JSON string"
"gf.gvalid.rule.xml" = "The {attribute} value `{value}` is not a valid XML string"
"gf.gvalid.rule.array" = "The {attribute} value `{value}` is not an array"
"gf.gvalid.rule.integer" = "The {attribute} value `{value}` is not an integer"
"gf.gvalid.rule.boolean" = "The {attribute} value `{value}` field must be true or false"
"gf.gvalid.rule.same" = "The {attribute} value `{value}` must be the same as field {pattern}"
"gf.gvalid.rule.different" = "The {attribute} value `{value}` must be different from field {pattern}"
"gf.gvalid.rule.in" = "The {attribute} value `{value}` is not in acceptable range: {pattern}"
"gf.gvalid.rule.not-in" = "The {attribute} value `{value}` must not be in range: {pattern}"
"gf.gvalid.rule.regex" = "The {attribute} value `{value}` must be in regex of: {pattern}"
"gf.gvalid.rule.gf.gvalid.rule.__default__" = "The :attribute value `:value` is invalid"