Closed kwvanderlinde closed 4 years ago
@kwvanderlinde thank you for this issue.
Behaviour you described was intentional. I thought that it's not possible to solve this problem in a different way. Now I reviewed this once again and I think I found a solution. Union
is a very tricky type.
I'll try to fix it soon.
@kwvanderlinde should be ok now, please check 1.5.0
version.
This relates to the fix for #82.
In most circumstances, a type hook is applied to input data before the corresponding type is instantiated. This lets us modify the input prior to parsing it. However, if the type is used in a
Union
, then the type hook is not applied to the input, but to the parsed result.The expected behaviour would be for the type hook always and only be used to transform the input data.
Here is a minimal example demonstrating the difference:
This occurs on dacite 1.4.0.