Skip to content

Add regression matrix for heterogeneous union annotations#735

Draft
wbarnha wants to merge 2 commits into
masterfrom
fix-pep604-json-unions
Draft

Add regression matrix for heterogeneous union annotations#735
wbarnha wants to merge 2 commits into
masterfrom
fix-pep604-json-unions

Conversation

@wbarnha

@wbarnha wbarnha commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a focused compatibility suite for Faust model field unions.
  • Cover both typing.Union and PEP 604 (X | Y) annotations.
  • Preserve coverage for currently supported scalar, optional-model, and nested-container forms.
  • Reproduce the exact declaration from NotImplementedError: Union of types not supported mode#80.
  • Separate JSON-shaped pass-through candidates from ambiguous/coercion-sensitive unions that should remain explicitly unsupported.

Current finding

Mode 0.5.3 now correctly recognizes PEP 604 unions. Faust's UnionNode only collapses unions when every member is a model or every member is a literal scalar. A union such as str | list | dict | None therefore reaches UnionNode.build() and raises NotImplementedError during Record class creation.

The issue #80 cases are marked strict xfail in this draft so CI documents the existing failure while the implementation fix is designed. Ambiguous model/scalar and coercion-sensitive unions remain passing negative tests.

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