Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for error message getting name of the parent json tag instead of the field tag when parent json tag is available. #438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,6 @@ func ValidateStruct(s interface{}) (bool, error) {
}
resultField, err2 := typeCheck(valueField, typeField, val, nil)
if err2 != nil {

// Replace structure name with JSON name if there is a tag on the variable
jsonTag := toJSONName(typeField.Tag.Get("json"))
if jsonTag != "" {
Expand All @@ -1153,7 +1152,6 @@ func ValidateStruct(s interface{}) (bool, error) {
for i2, err3 := range jsonError {
switch customErr := err3.(type) {
case Error:
customErr.Name = jsonTag
jsonError[i2] = customErr
}
}
Expand Down