Skip to content

Conversation

matthinrichsen-wf
Copy link
Contributor

@matthinrichsen-wf matthinrichsen-wf commented Jul 18, 2025

PR Details

Extends optional element support in Golang.

Description

Changes the Golang generator to make optional fields as pointers

Related Issue

Motivation and Context

An XSD can be defined to have optional elements (such as minOccurs=0). When this happens, its unclear on parsing if the value was truly unset in the xml, or given the zero value. Null-able optional fields allows developers to differentiate.

How Has This Been Tested

Locally ran all tests after updating generation.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • this will change generated output for Golang in a way that will break programs that are currently using optional primitive elements
    • I think this could not be made a non-breaking change if a command line flag was also added. I did not do this - but will if requested.

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@xuri xuri added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 28, 2025
Copy link
Owner

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your pull request. I've left some comments.

@joshprzybyszewski-wf
Copy link

@xuri I think this should be ready for re-review.

@xuri xuri added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 4, 2025
@joshprzybyszewski-wf
Copy link

@xuri I'm still learning your contributing process to this repo: what's the best way to get your or a maintainer's review on a PR?

@xuri
Copy link
Owner

xuri commented Sep 9, 2025

Thanks for your update, will take review for this.

@xuri xuri mentioned this pull request Sep 10, 2025
10 tasks
@joshprzybyszewski-wf
Copy link

@xuri the latest changes won't run the new CI step unless you approve the awaiting workflows.

Copy link
Owner

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some new comments.

xuri added a commit to xuri/xsd that referenced this pull request Sep 12, 2025
Copy link

codecov bot commented Sep 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.87%. Comparing base (aee1e76) to head (fd0776e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   81.77%   81.87%   +0.09%     
==========================================
  Files          37       37              
  Lines        1855     1865      +10     
==========================================
+ Hits         1517     1527      +10     
  Misses        246      246              
  Partials       92       92              
Flag Coverage Δ
unittests 81.87% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joshprzybyszewski-wf
Copy link

@xuri Thanks for the review, and the CI run! Let me know what else you need from me to get this merged.

Copy link
Owner

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution.

@xuri xuri merged commit 2f3435a into xuri:master Sep 13, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants