Closed alexongh closed 1 month ago
This, in my opinion, is a little unexpected. Judging from the name required only, I expected that a false boolean value would be ok, since a value was provided.
Can we recover the literal meaning of required instead of being kidnapped by go's zero value ?
required
validates that the value is not the data types default zero value. Forboolean
the default zero value isfalse
. Therefore, afalse
boolean value would be interpreted as not matching therequired
validation and fail.This, in my opinion, is a little unexpected. Judging from the name
required
only, I expected that afalse
boolean value would be ok, since a value was provided.Nevertheless, in my opinion, this behavior should be documented a little more explicitly. Which is why I propose this change to the docs.
@go-playground/validator-maintainers