1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 02:20:19 +00:00

Fix after test failure

This commit is contained in:
Andrea Spacca
2018-01-28 18:19:27 +01:00
parent ee9cf05796
commit faa3341603
2 changed files with 60 additions and 2 deletions

View File

@ -245,9 +245,14 @@ func (v *Validation) ZipCode(obj interface{}, key string) *Result {
}
func (v *Validation) apply(chk Validator, obj interface{}) *Result {
if reflect.TypeOf(obj).Kind() == reflect.Ptr {
validatorName := reflect.TypeOf(chk).Name()
if nil == obj {
if chk.IsSatisfied(obj) {
return &Result{Ok: true}
}
} else if reflect.TypeOf(obj).Kind() == reflect.Ptr {
if reflect.ValueOf(obj).IsNil() {
if "Required" != chk.GetKey() {
if "Required" != validatorName {
return &Result{Ok: true}
}
} else {