You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a type nested inside a slice is being validated the field name that gets attached to the error is sometimes incorrect. When the parent field is given a json name, the parent field gets used, but when the parent field doesn't have a json name, the child field gets used. In both cases I think the child field should be used for consistency with all other cases.
Hello guys!
I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back
Link to my repo: create issue there and we'll discuss it.
Bug
When a type nested inside a slice is being validated the field name that gets attached to the error is sometimes incorrect. When the parent field is given a
json
name, the parent field gets used, but when the parent field doesn't have ajson
name, the child field gets used. In both cases I think the child field should be used for consistency with all other cases.Examples
Example
When the parent
Addresses
has ajson
tag nameaddresses
, the validation error on theCountryCode
field gets given the nameaddresses
:https://play.golang.org/p/eH93fHIiCCR
Example 2
When the parent
Addresses
doesn't have ajson
tag name, the validation error on theCountryCode
field gets given the namecountry_code
:https://play.golang.org/p/8GZK-XRqCjp
The text was updated successfully, but these errors were encountered: