Skip to content

Commit

Permalink
fix StructLevel Parent() (#716)
Browse files Browse the repository at this point in the history
Co-authored-by: torwang <torwang@tencent.com>
  • Loading branch information
Torwang1 and torwang authored Apr 6, 2021
1 parent 0e67456 commit 882ec0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (v *validate) validateStruct(ctx context.Context, parent reflect.Value, cur
}
}

v.traverseField(ctx, parent, current.Field(f.idx), ns, structNs, f, f.cTags)
v.traverseField(ctx, current, current.Field(f.idx), ns, structNs, f, f.cTags)
}
}

Expand Down Expand Up @@ -222,7 +222,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
structNs = append(append(structNs, cf.name...), '.')
}

v.validateStruct(ctx, current, current, typ, ns, structNs, ct)
v.validateStruct(ctx, parent, current, typ, ns, structNs, ct)
return
}
}
Expand Down

0 comments on commit 882ec0d

Please sign in to comment.