Skip to content

Comments

support union of dataclasses, Literal, and Sequence.#1233

Draft
alexfanqi wants to merge 6 commits intoomry:masterfrom
alexfanqi:master
Draft

support union of dataclasses, Literal, and Sequence.#1233
alexfanqi wants to merge 6 commits intoomry:masterfrom
alexfanqi:master

Conversation

@alexfanqi
Copy link

@alexfanqi alexfanqi commented Jan 18, 2026

support union of dataclasses, Literal, and Sequence. It reads the annotation to parse all dataclasses and user can choose the concrete dataclass by config.union=classA. Dumping it to yaml will save the choice into a _type_ field.

This is primarily vibe coded up. It needs more tests to cover the edge cases. I am currently verifying it by using it myself in my project.

Fixes #144

@alexfanqi alexfanqi marked this pull request as draft January 18, 2026 09:29
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.

Look into supporting Union in Structured configs

1 participant