bankiso
bankiso copied to clipboard
rules for omitempty on xml struct tags
Hey
what paradigm do you follow to annotate the xml tags with ,omitempty
eg:
type AccountAdditionalInformationRequestV02 struct {
// Set of elements for the identification of the message and related references.
References *iso20022.References3 `xml:"Refs"`
// Identifies the business sender of the message, if it is not the account owner or account servicing financial institution.
From *iso20022.OrganisationIdentification8 `xml:"Fr,omitempty"``
sometimes it is not supplied. Why is that? Can I change it to be more consistent? Namely to add omitempty to everything.
I actually added an omitempty to kinda all the struct tags but it still does the xml.Unmarshal carrying the empty values into the struct in validate.go:169. The omitempty does not seem to have effect in any way.