Simplify union types #206
mikegratton
started this conversation in
Ideas
Replies: 1 comment
-
|
I've added a pull request to demonstrate what I am proposing #207 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For union types, the generated code currently throws exceptions when accessing the non-selected member or when changing the discriminator in some instances.
I think these aren't helpful. Changing the discriminator should always succeed. In other words, it should be legal to do
Likewise, accessing non-active members should be allowed. There is nothing technically wrong with first modifying a non-active member, then making that member active later. Users can check the discriminator before serialization to avoid bugs.
Beta Was this translation helpful? Give feedback.
All reactions