Closed ranjithvuppala closed 1 year ago
when using structure_attrs_fromdict cattrs doesnot honour 'alias' name for the field..
structure_attrs_fromdict
For example:
@define class Dummy: key1: str key3: str = field(alias="key2") input_dict = {"key1": "test1", "key2": "test3"} cattrs.structure_attrs_fromdict(b, Dummy)
Should work. But it gives this error
TypeError: Dummy.__init__() missing 1 required positional argument: 'key2'
Where as creating attrs class direclty works instance = Dummy(key1 = "value1", key2="value2")
instance = Dummy(key1 = "value1", key2="value2")
Hello,
closing as dupe of #322. Haven't gotten around to it yet!
closed in favour of #322
Description
when using
structure_attrs_fromdict
cattrs doesnot honour 'alias' name for the field..For example:
Should work. But it gives this error
TypeError: Dummy.__init__() missing 1 required positional argument: 'key2'
Where as creating attrs class direclty works
instance = Dummy(key1 = "value1", key2="value2")