fix(binding): dereference pointer to struct (#3199)

This commit is contained in:
Alonso Villegas
2024-02-07 06:44:11 -05:00
committed by GitHub
parent 86ff4a64c7
commit 82bcd6d39b
2 changed files with 28 additions and 1 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ func (v *defaultValidator) ValidateStruct(obj any) error {
value := reflect.ValueOf(obj)
switch value.Kind() {
case reflect.Ptr:
return v.ValidateStruct(value.Elem().Interface())
if value.Elem().Kind() != reflect.Struct {
return v.ValidateStruct(value.Elem().Interface())
}
return v.validateStruct(obj)
case reflect.Struct:
return v.validateStruct(obj)
case reflect.Slice, reflect.Array: