Skip to content

feat(transcoder): dual-format XML ↔ JSON engine, annotations, codecs, and transcoder - #39

Merged
nth-bailey merged 1 commit into
mainfrom
feat/dual-format-transcoder
Sep 20, 2026
Merged

nth-bailey merged 1 commit into
mainfrom
feat/dual-format-transcoder

Conversation

@nth-bailey

Copy link
Copy Markdown
Collaborator

Summary

Implements Epic #34: Dual-Format XML ↔ JSON Engine & Toolchain, resolving all child issues:

  • Closes [Codegen: Dual Tags] Emit native JSON tags & attributes for Go, C#, Rust, and Python #35: Dual XML/JSON annotations across Go, C#, Rust, and Python.
    • Go: Emits xml:"..." and native json:"..." struct tags on all fields, with json:"-" on XMLName.
    • C#: Emits [property: XmlAttribute/XmlElement, JsonPropertyName(...)] on primary constructor records and [JsonConverter(typeof(JsonStringEnumConverter))] on enums.
    • Rust: Emits #[serde(rename = "...")] on choice unions and fields when renaming is necessary.
    • Python: Emits "json_name" in dataclass metadata and alias="...", serialization_alias="..." in Pydantic v2 mode.
  • Closes [Runtime Codecs] Synthesize inherent .to_json() and .from_json() methods for Python and Rust #36: Synthesizes inherent .to_json() and .from_json() codecs directly on generated models in Python and Rust.
    • Rust: .to_json_string(), .to_json_vec(), .from_json_str(), and .from_json_slice().
    • Python: Inherent .to_json(indent=..., by_alias=...) and @classmethod from_json(cls, data).
  • Closes [Transcoder & CLI] Zero-copy streaming XML ↔ JSON transcoder in core and polyxml transcode CLI #37: Zero-copy streaming XML ↔ JSON bidirectional transcoder directly in polyxml-core and exposed via CLI and Python bindings.
    • Core Transcoder: polyxml::xml_to_json and polyxml::json_to_xml supporting both schema-guided (via ModelSchema) and schema-less dynamic modes. Lossless roundtrip of attributes using @attr prefix in dynamic JSON.
    • CLI: polyxml transcode supporting stdin/stdout streaming pipes, --from, --to, --schema, --root, and --pretty.
    • Python PyO3 Bindings: polyxml.xml_to_json and polyxml.json_to_xml supporting source (bytes, str, Path, stream), target_type / model, schema_path, root, and indent.

Verification & Quality Gate

  • 100% Rust workspace test pass (cargo test --workspace).
  • 0 Clippy warnings with cargo clippy --workspace --all-targets -- -D warnings.
  • 100% statement and branch test coverage in Python (pytest --cov=polyxml --cov-branch --cov-fail-under=100).
  • Clean cargo fmt --check, ruff check, and ruff format --check.
  • End-to-end ./scripts/gate.sh passing cleanly.

… and transcoder

- Go: emit native json:"..." struct tags and json:"-" on XMLName (#35)
- C#: emit JsonPropertyName and JsonConverter attributes (#35)
- Rust: emit #[serde(rename = "...")] on choices and inherent .to_json_string() / .from_json_str() codecs (#35, #36)
- Python: emit json_name in field metadata, alias/serialization_alias in Pydantic, and inherent .to_json() / .from_json() codecs (#35, #36)
- Transcoder: implement zero-copy streaming XML ↔ JSON bidirectional transcoder with schema-guided and schema-less modes (#37)
- CLI: add polyxml transcode command with stdin/stdout streaming and --pretty (#37)
- Python: expose polyxml.xml_to_json and polyxml.json_to_xml functions (#37)

Closes #34, Closes #35, Closes #36, Closes #37
@nth-bailey
nth-bailey merged commit 97f9fd0 into main Sep 20, 2026
28 checks passed
@nth-bailey
nth-bailey deleted the feat/dual-format-transcoder branch September 20, 2026 05:17
nth-bailey pushed a commit that referenced this pull request Sep 20, 2026
# [0.14.0](v0.13.0...v0.14.0) (2026-09-20)

### Features

* **transcoder:** dual-format XML ↔ JSON engine, annotations, codecs, and transcoder ([#39](#39)) ([97f9fd0](97f9fd0)), closes [#35](#35) [#35](#35) [#35](#35) [#36](#36) [#35](#35) [#36](#36) [#37](#37) [#37](#37) [#37](#37) [#34](#34) [#35](#35) [#36](#36) [#37](#37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant