Skip to content

Fix generated default and fixed string literals in Python C++ and C# - #140

Closed
nth-bailey wants to merge 4 commits into
fix/xsd-attribute-valuesfrom
fix/generated-default-literals
Closed

nth-bailey wants to merge 4 commits into
fix/xsd-attribute-valuesfrom
fix/generated-default-literals

Conversation

@nth-bailey

@nth-bailey nth-bailey commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Generated Python string defaults could lose backslashes or emit unterminated source when XSD character references produce newlines. Python fixed/default metadata used Rust Unicode escape syntax; C++ string initializers and C# default/fixed proxies had similar escaping gaps.

Use the existing target-compatible literal encoders for these sites. C# also encodes carriage returns as numeric XML references when parsing its internal default/fixed value element, preserving xs:string values through XML line-ending normalization.

The consumer regression compiles and executes Python dataclasses, Pydantic, C++ and C# against an independent UTF-8 fixture. It checks quotes, literal backslash-u text, referenced tabs/newlines/carriage returns, Unicode separators, non-ASCII text, empty-element defaults and fixed-value rejection. This change addresses literal encoding at these sites; it does not add missing default semantics to other backends or fields.

Validation: 327 Rust tests; strict workspace formatting/Clippy; 115 Python tests with 100% statement/branch coverage; all seven CLI backends; bounded CType, AttrDecl and NIST comparisons with byte-identical summaries/failure tables. The generated-model test helper and smoke script now honor isolated Cargo targets.

See the report and raw evidence.

Stacked on #138, which fixes XSD attribute normalization and enum literals. Keep this draft until that change and #137 are reviewed.

@nth-bailey nth-bailey closed this Oct 4, 2026
@nth-bailey
nth-bailey deleted the fix/generated-default-literals branch October 4, 2026 04:14
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