Currently there seems to be no correlation between this package's optional tag and for example the json omitempty tag. I.e. if I specify a field in this package to be optional, I'd expect it to automatically add omitempty to json fields and not just blindly copy the original tags. This would be beneficial because it would avoid needing to specify both optional and omitempty.
Now I do know that optional is used during unmarshaling and omitempty during marshaling, so there is a case for the current behavior too. Just figured I'd raise this since I slipped up on this at my first go.
Currently there seems to be no correlation between this package's
optional
tag and for example the jsonomitempty
tag. I.e. if I specify a field in this package to beoptional
, I'd expect it to automatically addomitempty
to json fields and not just blindly copy the original tags. This would be beneficial because it would avoid needing to specify bothoptional
andomitempty
.Now I do know that
optional
is used during unmarshaling andomitempty
during marshaling, so there is a case for the current behavior too. Just figured I'd raise this since I slipped up on this at my first go.