Skip to content

Commit 35b2e0c

Browse files
authored
Merge pull request #95 from ROCKTAKEY/fix-union-field-type
Fix type of `UnionField` to accept not only `Field` but also `Serializer`
2 parents b18c3b7 + ad82f6c commit 35b2e0c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework_dataclasses/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import collections.abc
2-
from typing import Any, Dict, Generic, Type, TypeVar, Union, Optional
2+
from typing import Any, Dict, Generic, Mapping, Type, TypeVar, Union, Optional
33

44
from django.core.exceptions import ImproperlyConfigured
55
from rest_framework.exceptions import ValidationError
@@ -80,7 +80,7 @@ class UnionField(Field, Generic[T]):
8080
type_mapping: Dict[type, str]
8181

8282
def __init__(self,
83-
child_fields: Dict[type, Union[Field, Type[Field]]],
83+
child_fields: Mapping[type, Union[Field, Type[Field]]],
8484
*,
8585
nest_value: bool = False,
8686
discriminator_field_name: Optional[str] = None,

0 commit comments

Comments
 (0)