georgebv / drf-pydantic

Use pydantic with the Django REST framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional lists are no supported

thommor opened this issue · comments

Having a field such as:

reasons_for_joining: Optional[List[str]] = None

results in the following serializer field:

ListField(child=CharField(allow_null=True, default=None, required=False))

This does not match the field type and providing None to the field results in an error saying reasons_for_joining cannot be null.