Skip to content

[Add] XmiWriter implementation; fixes #194#195

Merged
samatstariongroup merged 2 commits into
developmentfrom
feature/194-xmi-writers
Jul 3, 2026
Merged

[Add] XmiWriter implementation; fixes #194#195
samatstariongroup merged 2 commits into
developmentfrom
feature/194-xmi-writers

Conversation

@samatstariongroup

@samatstariongroup samatstariongroup commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

Implements #194: an XMI writer for uml4net.xmi that serializes a UML model (or a selected Package) back to XMI, mirroring the existing XMI reader architecture exactly.

  • XmiWriterBuilder / XmiWriterScope / XmiWriter follow the same Autofac-based pattern as XmiReaderBuilder / XmiReaderScope / XmiReader.
  • Sync and async Write APIs, writing to a file path or a Stream.
  • External reference handling is selectable via IXmiWriterSettings.ExternalReferenceResolution:
    • Href (default) — references outside the selected package are written as href links to the original document.
    • Include — the containing root packages of external references are pulled into the output, producing a self-contained document.
  • ReferenceClosureCalculator computes the containment/reference closure at runtime from the same [Property]/[SubsettedProperty] metadata used by the reader, including replicating the composite-serialized-as-reference case (e.g. Behavior.postcondition).
  • 193 generated element writers + XmiElementWriterFacade in uml4net.xmi/AutoGenXmiWriters/, generated from new Handlebars templates/helpers in uml4net.CodeGenerator / uml4net.HandleBars, regenerable via the [Explicit] test XmiWriterGeneratorTestFixture.Regenerate_AutoGenXmiWriters_of_uml4net_xmi.
  • README and CLAUDE.md updated to document the writer.

Testing

  • Full solution test suite green (431 tests) including new round-trip tests (UML.xmi, SysML.uml) proving read → write → re-read produces an equivalent object graph, sync/async byte-identical output, and Include-mode self-containment.
  • New-code coverage on hand-written writer classes is ≥94% (gate is 80%).

@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@samatstariongroup
samatstariongroup merged commit d37f333 into development Jul 3, 2026
7 of 8 checks passed
@samatstariongroup
samatstariongroup deleted the feature/194-xmi-writers branch July 3, 2026 12:55
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.

1 participant