Skip to content

Add XML namespace support for Choice properties - #21

Merged
GregoryNikolaishvili merged 1 commit into
mainfrom
feature/XmlImprovements
Aug 1, 2026
Merged

Add XML namespace support for Choice properties#21
GregoryNikolaishvili merged 1 commit into
mainfrom
feature/XmlImprovements

Conversation

@GregoryNikolaishvili

Copy link
Copy Markdown
Contributor
  • Support XmlTag.Namespace for per-property XML namespaces
  • Emit [XmlElement(..., Namespace=...)] for correct XML output
  • Serialize only the active choice property (no xsi:nil)
  • Add advanced XML serialization tests with namespaces
  • Add envelope and document models for test coverage
  • Update tests for mixed XmlTag/XmlElement and namespaces
  • Bump version to 2.2.0

- Support XmlTag.Namespace for per-property XML namespaces
- Emit [XmlElement(..., Namespace=...)] for correct XML output
- Serialize only the active choice property (no xsi:nil)
- Add advanced XML serialization tests with namespaces
- Add envelope and document models for test coverage
- Update tests for mixed XmlTag/XmlElement and namespaces
- Bump version to 2.2.0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Choice source generator’s XML serialization support by allowing per-property XML namespaces (via XmlTag.Namespace) and by tightening XML output so only the active choice property is serialized (avoiding xsi:nil for inactive choices). It also adds a set of namespace-focused serialization tests and updates the package version.

Changes:

  • Add Namespace support to XmlTagAttribute and propagate it into generated [XmlElement(..., Namespace = ...)] attributes.
  • Generate ShouldSerialize{Property}() methods for choice properties to ensure only the active choice serializes (no xsi:nil for inactive choices).
  • Add/expand XML serialization tests covering namespaces, envelope/document structures, and nil suppression; bump version to 2.2.0.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/AltaSoft.ChoiceGenerator.Tests/XmlNamespaceNilTests.cs Adds regression tests asserting no xsi:nil and no inactive choice elements are emitted.
tests/AltaSoft.ChoiceGenerator.Tests/XmlNamespaceChoice.cs Introduces a Choice model using XmlTag.Namespace for per-property namespaces.
tests/AltaSoft.ChoiceGenerator.Tests/XmlChoiceSerializationTests.cs Adds comprehensive XML round-trip tests for multiple choice shapes and edge cases.
tests/AltaSoft.ChoiceGenerator.Tests/ChoiceGeneratorTests.cs Adds namespace round-trip tests for XmlNamespaceChoice.
tests/AltaSoft.ChoiceGenerator.Tests/AdvancedXmlNamespaceTests.cs Adds advanced envelope/document namespace tests and nil suppression checks.
tests/AltaSoft.ChoiceGenerator.Tests/AdvancedXml/* Adds XML models used for advanced namespace/envelope serialization coverage.
tests/AltaSoft.Choice.Generator.SnapshotTests/Snapshots/* Updates/introduces snapshots reflecting namespace emission and ShouldSerialize behavior changes.
tests/AltaSoft.Choice.Generator.SnapshotTests/ChoiceGeneratorTest.cs Adds snapshot test cases for XmlTag.Namespace and mixed attribute scenarios.
src/AltaSoft.Choice/XmlTagAttribute.cs Adds Namespace property to XmlTagAttribute.
src/AltaSoft.Choice.Generator/Models/PropertyDetails.cs Stores per-property XML namespace metadata for generation.
src/AltaSoft.Choice.Generator/Executor.cs Emits [XmlElement(..., Namespace=...)] and generates ShouldSerialize{Property} methods for choices.
Directory.Build.props Bumps version to 2.2.0 and updates copyright years.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/AltaSoft.Choice.Generator/Executor.cs
@GregoryNikolaishvili
GregoryNikolaishvili merged commit 348cf70 into main Aug 1, 2026
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants