Doesn't work with nullable nested
ADR-007 opened this issue · 1 comments
ADR-007 commented
Hi!
I found a problem with serializers like:
class MySerializer(...):
my_nested = MyDataclassSerializer(allow_null=True, required=False)
The fix:
def create(self, validated_data):
if validated_data is None:
return None
dataclass_type = self.get_dataclass_type()
return dataclass_type(**self.instantiate_data_dictionaries(validated_data))
oxan commented
Fixed!