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.
validate:required
won't work for input like:Because the validator always check against the struct defaults, however, it's very likely that the input value of an
int
is0
andstring
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.