Closed Provoo closed 4 years ago
Thanks for your kind words!
I'm not exactly sure what you mean though. This is just an implementation detail, for the enduser this is completely opaque and they already get an instance of the main dataclass.
The problem hinted at here is that the location where that dataclass is instantiated. Ideally, I'd want to do that in to_internal_value()
, so that nesting automatically works. However, DRF doesn't allow us to do that on the outermost serializer, so we have to do it somewhere else. I don't see what your suggestion to change that is.
encode/django-rest-framework#6053 and encode/django-rest-framework#6365 make me think this might not be intentional on DRF's side, so maybe I should look into why it doesn't work.
Hi I red the coment below in instantiate_data_dictionaries:
First i want to congratulate you, with dataclasses django and python are becoming much better a robust to deploy productions services, I'm also front end developer and is amazing how with typescript and angular you can prevent a lot of bugs with de interfaces, I have been looking away to replacate that in backend, i tryed TypedDict, but my code steel been very dificult to debug, so when I started to use dataclasses and your library, the enpoint works like magic.
So I was wondering or I don't understand why you dont instance the main Dataclass instead of creating a Dict, if you want I can try to create this improvement.
Thanks again for your amazing work!