You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?The text was updated successfully, but these errors were encountered: