Commit d3e28c4
authored
Make docs for required more explicit regarding boolean values (#1261)
`required` validates that the value is not the data types default zero
value. For `boolean` the default zero value is `false`. Therefore, a
`false` boolean value would be interpreted as not matching the
`required` validation and fail.
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.
Nevertheless, in my opinion, this behavior should be documented a little
more explicitly. Which is why I propose this change to the docs.
- [x] Tests exist or have been written that cover this particular
change.
(this is only a docs change)
@go-playground/validator-maintainers1 parent 0df4e00 commit d3e28c4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
0 commit comments