oxan / djangorestframework-dataclasses

Dataclasses serializer for Django REST framework
BSD 3-Clause "New" or "Revised" License
431 stars 28 forks source link

save() with nested dataclasses is broken #3

Closed intgr closed 4 years ago

intgr commented 4 years ago

Hi. As you can see from the supplied testcase, the save() method with nested dataclass fields is broken. The returned dataclass has fields that violate type declaration: house.owner has type OrderedDict instead of Person. Same with the house.residents list elements.

This seems like a pretty major omission to me, or am I missing something?

Any ideas about what's the most reasonable way to fix this?

oxan commented 4 years ago

Thanks! I've merged your test, added some more tests for the save() method, and committed a fix.

intgr commented 4 years ago

Thank you! I will test this with my original use case soon.