Hacker News new | ask | show | jobs
by Nextgrid 1589 days ago
I'd argue that Python type hints are actually a step back. Sure, they may work 80% of the time, but there are times where you need the extra flexibility offered by DRF serializers. Those can go way farther than the basic "map these JSON data types to this Python representation" which would then be difficult to represent using basic Pydantic-style hints (you'd have to the rest in procedural Python within your endpoint, which can't easily be reused when it comes to function-based views, where as DRF abstracts that away within the serializer which not only can be reused, but itself can be composed of multiple classes/mixins).