Closed RazerM closed 5 months ago
Hm, confirming. Looks like this was broken in https://github.com/python-attrs/cattrs/pull/443.
That PR pops out the tag out of the payload to make the strategy work with forbid_extra_keys
. But it does feel useful to be able to have the tag.
Thanks, got it fixed. I also turned the example into a doctest so we don't get into the same situation in the future.
Thanks!
Description
I was following the docs on tagged unions in https://github.com/python-attrs/cattrs/blob/main/docs/strategies.md
What I Did
I'm unable to get
OtherAppleNotification
to work:I get the following output:
(1) This is given in the example and works fine:
(2) Given the example I expected
notificationType
to be preserved, notNone
:(3) I'm not able to structure a payload as
OtherAppleNotification
via theAppleNotification
union: