Add option to support mandatory field when decode
goyzhang opened this issue · comments
validate:required
won't work for input like:
value: 0 # this will fail the validator. But I want value to be mandatory field as well.
Because the validator always check against the struct defaults, however, it's very likely that the input value of an int
is 0
and string
is ""
.
int
-> *int
is yet another dirty hack.
Since validator check against struct, only the go-yaml is able to detect this error when parsing the string.