feat: Next-Gen Polyglot XML Schema Compiler & Toolchain (Epic #22) - #33
Merged
Merged
Conversation
…nd Pydantic v2 (#24)
…d Tarjan cycle boxing (#25)
…er codecs for Rust and Python (#32)
…s codegen (#27) - Added pure-Rust Java 21+ code generation in polyxml-core - Generates canonical public record definitions for complex types (rejecting legacy JavaBeans) - Generates public sealed interfaces with exhaustive member records for xs:choice - Value-backed public enum types with fromValue/getValue - Restriction facet validation in compact constructors - CLI support for --lang java and --package flag - Full unit and CLI E2E tests verified against javac -Werror (JDK 21)
…codegen (#26) - Pure-Rust C++20/C++23 code generator backend with zero Xerces-C++ runtime dependencies - Emits clean aggregate-initializable C++20 structs with defaulted equality (operator== ... = default) - Maps xs:choice to std::variant with canonical overloaded pattern-matching visitor helper - Maps recursive cycles to std::unique_ptr<T> based on Tarjan SCC cycle cuts - Emits scoped enum class with constexpr to_string and from_string conversion helpers - Restriction facet validation methods (validate() const noexcept) and C++20 XmlModel concept - Supports both standard header-only (.hpp) mode and C++20 Modules (.cppm) mode - Generates CMake (CMakeLists.txt, PolyXMLConfig.cmake) and Meson (meson.build) integration definitions - Full CLI support for --lang cpp and --namespace flag with clang-format integration - Comprehensive unit and E2E tests verified against g++ -std=c++20 -Wall -Wextra -Wpedantic -Werror
…onstructors codegen (#30)
… and redefines - Handle anonymous complexType/simpleType on global and local elements via name override - Propagate list cardinality for elements within unbounded compositors (sequence/choice/all) - Guard against treating repeated choice models (maxOccurs > 1) as single-variant unions - Implement 3-color cycle-safe topological sorting in Python, Rust, and TS to prevent stack overflow - Support <xsd:redefine> alongside <xsd:include> in schema parser - Guard against self-inheritance when extension base equals struct name - Ingest empty <xsd:complexType name='...'/> and <xsd:simpleType name='...'/> tags into SchemaIR - Fix Decimal import omission when Decimal primitive is only used in global elements - Sanitize Python keywords (field, dataclass, self) and non-ASCII identifier prefixes
…hitectural breakdown
…template engine lock contention
…neration front and center
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.
Summary
Closes #22
Closes #23
Closes #24
Closes #25
Closes #26
Closes #27
Closes #28
Closes #29
Closes #30
Closes #31
Closes #32
This PR delivers the Next-Gen Polyglot XML Schema Compiler & Toolchain for PolyXML, introducing a high-performance W3C XSD 1.0 & 1.1 compiler and code generator in pure Rust. It parses XML Schemas into a canonical, language-agnostic Intermediate Representation (IR), resolves recursive cycles via Tarjan's Strongly Connected Components algorithm, and generates idiomatic data models and high-performance codecs across 7 modern programming languages:
🎯 Supported Language Targets
Python 3.12+ ([Target: Python] Modern Python 3.12+ Codegen (
@dataclass& Pydantic v2) #24):@dataclass(stdlib) and Pydantic v2 models.patternregex,minInclusive,maxInclusive,minLength,maxLength).Rust 2021/2024 ([Target: Rust] Zero-Copy Rust 2021/2024 Codegen (
struct+enumwithCow<'a, str>) #25, [Phase 3 / Runtime Codecs] Zero-Copy Streaming Deserializer & Serializer Codec Synthesis for Rust & Python #32):Cow<'a, str>and owned struct modes.Box<T>).FromXmlStream) and serializer (ToXmlStream) codecs ([Phase 3 / Runtime Codecs] Zero-Copy Streaming Deserializer & Serializer Codec Synthesis for Rust & Python #32).cargo fmtwith 0 clippy warnings.Modern C++20 / C++23 ([Target: C++] Modern C++20/C++23 Codegen (
struct,std::variant,std::optional, Concepts) #26):std::variantchoice representations, and C++20 concepts (PolyXmlElement).std::unique_ptr<T>).clang-format.Java 21+ ([Target: Java] Java 21+ Modern Codegen (
record+sealed interface) #27):records andsealed interfacechoice models with exhaustive pattern matching.@Pattern,@Size,@Min,@Max).TypeScript 5+ ([Target: TypeScript] TypeScript 5+ & Zod Codegen (Discriminated Unions & Strict Types) #28):
z.lazy()recursion.Go 1.22+ ([Target: Go] Go 1.22+ Struct Codegen (
structwith XML tags & Choice Validation) #29):encoding/xmltags and pointer cycle cuts.UnmarshalXMLchoice types guaranteeing mutual exclusivity.gofmt.C# 12 / .NET 8+ ([Target: C#] C# 12 / .NET 8+ Codegen (
record class/record struct) #30):recorddefinitions with primary constructors andSystem.Xml.Serializationattributes.xs:choiceabstract records.IValidatableObjectimplementation with regex and facet constraints.csharpier.🛠️ CLI & Workspace Toolchain (#31)
polyxml generate: Multi-language, single-invocation code generation with--lang,--out,--backend,--zero-copy,--codecs, and--dry-run.polyxml build: Declarative workspace orchestration powered bypolyxml.toml.polyxml validate: Fast static XML Schema structure and cycle topology validation.🛡️ Quality Gate & Verification
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings(0 warnings).ruff check,ruff format --check, and 100% statement & branch coverage (pytest --cov --cov-branch --cov-fail-under=100).