Represent elements of choices as pointers#105
Merged
xuri merged 9 commits intoxuri:masterfrom Sep 26, 2025
Merged
Conversation
xuri
requested changes
Sep 18, 2025
Owner
xuri
left a comment
There was a problem hiding this comment.
Code conflicts should be resolve.
# Conflicts: # genGo.go # test/go/base64.xsd.go # test/java/base64.xsd.java # test/ts/base64.xsd.ts # test/xsd/base64.xsd
xuri
added a commit
to xuri/xsd
that referenced
this pull request
Sep 25, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #105 +/- ##
==========================================
- Coverage 81.93% 81.92% -0.01%
==========================================
Files 37 37
Lines 1871 1870 -1
==========================================
- Hits 1533 1532 -1
Misses 246 246
Partials 92 92
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@xuri Let me know if there's anything else that I'll need to do before this can be merged. |
xuri
approved these changes
Sep 26, 2025
Owner
xuri
left a comment
There was a problem hiding this comment.
LGTM, thanks for your contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Details
Description
(Note: this PR includes the changes from #102. That PR should be merged before this one.) This PR marks elements as optional when some ancestor element is a choice. In Go, this allows such elements to be omitted from XML serialization when that element was not present in the choice (i.e. when the pointer is nil).
The other (quite minor) change is that, in Go code generation, when an element is both plural and optional, this would generate a field of typeThis was already done in a previous PR, I was not aware.[]*T, whereTis the generated Go type of the element. I've changed it so that it will generate[]Tinstead--the optional-ness of this element is best represented by an empty slice, so pointers are unnecessary. However, forcomplexTypes,Twill be generated as a pointer anyway, so this doesn't change anything in such cases.Related Issue
Motivation and Context
How Has This Been Tested
Types of changes
Checklist