Codebase list golang-github-go-playground-validator-v10 / 54db112
Make `required_without` work with pointer Fix #483, #473 Zuyang Kou 4 years ago
2 changed file(s) with 6 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
13071307 func requireCheckFieldKind(fl FieldLevel, param string) bool {
13081308 field := fl.Field()
13091309 if len(param) > 0 {
1310 field = fl.Parent().FieldByName(param)
1310 if fl.Parent().Kind() == reflect.Ptr {
1311 field = fl.Parent().Elem().FieldByName(param)
1312 } else {
1313 field = fl.Parent().FieldByName(param)
1314 }
13111315 }
13121316 switch field.Kind() {
13131317 case reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func:
87118711 Field5: "test",
87128712 }
87138713
8714 errs = validate.Struct(test2)
8714 errs = validate.Struct(&test2)
87158715
87168716 if errs == nil {
87178717 t.Fatalf("failed Error: %s", errs)