-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
Description
Regression
This change has broken existing behaviour.
For eg: I have a JSON:
{
"main1": {
"child11": 1,
"child12": 2
},
"main2": {
"child21": 5,
"child22": 6
}
}Now, as per validation rules, key main1 and main2 are optional. And their respective children keys should be validated only when main key exists.
The validation rules are defined as:
type Request struct {
Main1 *struct {
Child11 string `json:"child11" validate:"required"`
Child12 string `json:"child12" validate:"required"`
} `json:"main1"`
Main2 *struct {
Child21 string `json:"child21" validate:"required"`
Child22 string `json:"child22" validate:"required"`
} `json:"main2"`
}Earlier, uptil v1.4.5, these definitions were working fine and children struct was validated only when the respective main key existed
Now, with the release v1.4.6 , this behaviour does not work anymore as nil pointer check is removed.
Originally posted by @madhurbhaiya in #191 (comment)
Reactions are currently unavailable