Skip to content
New issue

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

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

Already on GitHub? # to your account

Omit empty fields when marshalling #6

Closed
chavacava opened this issue Apr 6, 2023 · 3 comments · Fixed by #8
Closed

Omit empty fields when marshalling #6

chavacava opened this issue Apr 6, 2023 · 3 comments · Fixed by #8
Labels
enhancement New feature or request

Comments

@chavacava
Copy link

Marshalling generates empty tags for empty POM fields.
It could be nice to add omitempty tags to the lib's structs in order to avoid polluting the marshaled XML with empty tags.

PS: thanks @vifraa for the nice lib.

@vifraa vifraa added the enhancement New feature or request label Apr 11, 2023
@vifraa
Copy link
Owner

vifraa commented Apr 11, 2023

@chavacava
I agree that this is a nice feature, I am however a bit worried that changing this would break existing applications that depend on the empty tags getting generated.

So somehow we need to make it configurable to keep the backwards compatibility. I don't have an obvious solution that would work fine without massive code duplication currently, but will look into it. Do you have any ideas?

@chavacava
Copy link
Author

Omitting empty fields requires modifying the POM data model thus, as you said, it might cause some compatibility problems.
Providing an ad-hoc (with empty fields omitted) marshaling method could be a backward compatible approach.

@vifraa
Copy link
Owner

vifraa commented Aug 8, 2023

This issue has now been resolved in version v1.0.0.

Ended up just making the change and bumping the major version instead of working out a way to keep backwards compatibility. Projects needing the empty fields when marshalling need to handle this on the client side before updating to the new major version. I assume the number of projects depending on this is quite small.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants