[x] I have looked at the documentation here first?
[x] I have looked at the examples provided that may showcase my question here?
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
Question
Code sample, to showcase or reproduce:
I have a struct that represents an update / patch, where the fields are pointers, and are only used when the fields are not nil. When using the required rule together with omitnil or omitempty it seems to accept blank values (at least for strings, have not tried with other types yet).
Is there a way to achieve the usage of required only when the pointer is not nil?
Package version eg. v9, v10:
v10
Issue, Question or Enhancement:
Question
Code sample, to showcase or reproduce:
I have a struct that represents an update / patch, where the fields are pointers, and are only used when the fields are not nil. When using the
required
rule together withomitnil
oromitempty
it seems to accept blank values (at least for strings, have not tried with other types yet).Is there a way to achieve the usage of
required
only when the pointer is not nil?