File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -593,3 +593,18 @@ module that contains the extension.
593593
594594.. _`drf-spectacular` : https://github.com/tfranzel/drf-spectacular
595595.. _`extension` : https://github.com/tfranzel/drf-spectacular/blob/master/drf_spectacular/contrib/rest_framework_dataclasses.py
596+
597+ Typing
598+ ------
599+ When using a type checker such as mypy, please ensure that the ``djangorestframework-stubs `` package is installed. The
600+ type hints for this library depend on the type hints for DRF being available to validate successfully, and might
601+ otherwise generate some seemingly bizarre mypy errors.
602+
603+ The ``DataclassSerializer `` class is generic, and must be parameterized with the dataclass type to have correct types on
604+ its properties and methods:
605+
606+ .. code :: Python
607+
608+ class PersonSerializer (DataclassSerializer[Person]):
609+ class Meta :
610+ dataclass = Person
You can’t perform that action at this time.
0 commit comments