Open josefguenther opened 1 month ago
Using StructFiltered()
, it does go into nested structs. However, it's a bit cumbersome to use. This works and validates all child fields in the child struct regardless of how deeply things are nested:
log.Printf("validation filtered: %+v", v.StructFiltered(order, func(ns []byte) bool {
if bytes.HasPrefix([]byte("Order.Item"), ns) || bytes.HasPrefix(ns, []byte("Order.Item")) {
return false
} else {
return true
}
}))
There should be better support in StructPartial()
for nested structs...
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
When using StructPartial(), we should expect all fields specified to be validated. It does not validate struct properties, however, unless you specify the full path to individual fields inside child structs.
Code sample, to showcase or reproduce:
Output is as follows: