mirror of https://github.com/gin-gonic/gin.git
Add slice elements check for not required slice
This commit is contained in:
parent
f145e435c7
commit
b537c5d15e
|
@ -209,6 +209,11 @@ func Validate(obj interface{}, parents ...string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else if fieldType == reflect.Slice && field.Type.Elem().Kind() == reflect.Struct {
|
||||||
|
err := Validate(fieldValue, field.Name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue