You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deserialization fails for union types if the data is not always matching the first type.
For example address: Ed25519Address | AliasAddress | NFTAddress only works if the type matches the Ed25519Address variant, for AliasAddress or NFTAddress an error is returned.
Didn't found a solution yet, but maybe can be done with something similar to this
# https://github.com/lidatong/dataclasses-json/issues/303address: Ed25519Address|AliasAddress|NFTAddress=field(
metadata=config(
decoder=lambdad:
matchd["type"]:
caseAddressType.Ed25519:
Ed25519Address.from_dict(d)
case ...
If not probably a custom _from_dict_custom(), similar to
Description
Deserialization fails for union types if the data is not always matching the first type.
For example
address: Ed25519Address | AliasAddress | NFTAddress
only works if the type matches theEd25519Address
variant, forAliasAddress
orNFTAddress
an error is returned.Didn't found a solution yet, but maybe can be done with something similar to this
If not probably a custom
_from_dict_custom()
, similar toiota-sdk/bindings/python/iota_sdk/types/transaction_options.py
Line 31 in 1add7b7
https://github.com/lidatong/dataclasses-json/pull/478 might help
Motivation
Make deserialization work correct
Are you planning to do it yourself in a pull request?
No.
The text was updated successfully, but these errors were encountered: