Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rules for omitempty on xml struct tags #3

Open
ng2dev opened this issue Jul 17, 2019 · 1 comment
Open

rules for omitempty on xml struct tags #3

ng2dev opened this issue Jul 17, 2019 · 1 comment

Comments

@ng2dev
Copy link

ng2dev commented Jul 17, 2019

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.

@ng2dev
Copy link
Author

ng2dev commented Jul 17, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant