Comments (2)
@chaoflow thank you for reporting this issue.
I have to say that Union
is a pain in the neck, but well... dacite
supports it and it should definitely provide some more informative exception.
Do you have any suggestions? I'm open for a PR.
The problem is that when we build value for Union
field (core. _build_value_for_union
) we try to match each type to the input data, and if something is wrong, we take the next one. This is why the easiest way is to say "we can not match any type from union" instead of "we can not match any type, this and this was very close, but it doesn't work because of..."
from dacite.
@chaoflow as I said, it's difficult to provide more relevant info in this case. I'm closing this issue for now. Feel free to reopen or submit PR :)
from dacite.
Related Issues (20)
- identifier aliases HOT 2
- Compatibility in from_dict for frozen dataclasses where dict doesn't contain non-init fields HOT 1
- support non-dataclass types for the root object passed to from_dict HOT 2
- support non-default value field missing in dict HOT 1
- MissingValueError using union operator with None (`| None`) but `Optional` works HOT 2
- If a property is a python name also search for it with _ HOT 1
- Optional with default None gives a TypeError for python3.9 with modern annotation syntax HOT 2
- Cannot use Union of Dataclasses for `from_dict(data_class=...)` HOT 4
- Incorrect work when using field with default_factory HOT 3
- Regression in handling type_hooks for dict keys between dacite version 1.7 and 1.8 HOT 4
- Exception thrown by custom code inside a Union are caught by mistake HOT 6
- Is there a functionality like this in dacite? HOT 1
- Better support for primitive numeric types
- default_factory does not create new instance of an object HOT 4
- Support of a custom mapping to the fields with different names HOT 1
- Regression with nested classes
- Tuple of mixed values from list of strings HOT 1
- Type hooks applied to deserialized values when hook for union type is defined
- Return value of custom type hook is discarded when decoding generic type in union
- Regression in recognizing the type of the dataclass in case of inheritance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dacite.