Open Kentin14 opened 9 months ago
I've seen this too upgrading from v10.15.1 to v10.15.2.
https://github.com/go-playground/validator/compare/v10.15.1...v10.15.2
Please see https://github.com/go-playground/validator/issues/1157
This was thoroughly discussed in https://github.com/go-playground/validator/issues/1142 originally.
The TL;DR is that struct validations were not running as expected prior to this change. This is a correction of behaviour so that now validations are being called on structs which also corrected some issues with the required_with*
validations.
Special concessions were made for the required
tag running to be opt-in because it is confusing when coming from a number of other languages to Go, but will become the default in the next version.
Again I'm sorry for any inconvenience that it's causing however the alternative is far worse, validations that were thought to be running which weren't which can cause undefined behaviour for applications relying on these validations to catch bad data. This is why this change was classified as a fix/correction rather than a breaking change.
Package version v10.15.5 :
Issue, Question or Enhancement:
Following code used to work fine in v10.14.1 at least. Now that we upgraded to v10.15.5, it panics because of the dive validator.
I do realize the dive doesn't do anything on a struct and shouldn't even be here in the first place. But before v10.15.5, it was simply ignored and raised no error whatsoever. It is kind of a breaking change.
Code sample, to showcase or reproduce:
now raises