Dataclasses serializer for Django REST framework
BSD-3-CLAUSE License
Features & fixes:
Published by oxan about 1 year ago
Breaking changes:
Features & fixes:
list
or dict
composite types (such as frozenset
or OrderedDict
) as that type, instead of list
or dict
.serializer_field_mapping
dictionary.rest_framework.fields.empty
sentinel value when used in non-partial mode. This fixes occasional leaks of the sentinel into dataclasses returned to the user, for example when a DataclassSerializer
was nested inside a regular serializer. Not setting, and later stripping, the sentinels also increases performance.init=False
.save()
on serializers with many=True
.source='*'
.child_kwargs
defined in dataclass field metadata (as opposed to extra_kwargs
field on Meta
subclass).Published by oxan almost 2 years ago
serializer_field_mapping
dictionary.None
as optional if they consist of three or more members. Previously this was only the case for unions with two members (i.e. only unions of a type with None
were optional).Published by oxan almost 3 years ago
list["str"]
).allow_empty
with many=True
.Published by oxan almost 3 years ago
Features & fixes:
X | None
union syntax for specifying optional fields in Python 3.10+ (PEP 604).Published by oxan over 3 years ago
Features & fixes:
EnumField
compatibility with drf-yasg.Published by oxan over 3 years ago
Breaking changes:
required=False
).typing.Optional
no longer causes the serializer fields to be optional (they will still be marked as nullable). In previous versions these fields would be optional, which broke if a field had no default value. Due to the preceding change, the common case of fields marked with typing.Optional
and None
as a default value, have no change in behaviour.typing.Final
type hints (without the type specified), as typing.Final
was never supposed to be used in this way, and Python 3.10 will drop support for it.Features & fixes:
serializer_field_mapping
.serializer_dataclass_field
property.many=True
.Published by oxan almost 4 years ago
Breaking changes:
Features & fixes:
Published by oxan about 4 years ago
save()
implementation to finally fix all issues with nested serializers.source
option.fields
option.Published by oxan about 4 years ago
many=True
.extra_kwargs
.fields
option.Published by oxan about 4 years ago
Literal
-typed fields (PEP 586).Published by oxan about 4 years ago
Published by oxan about 4 years ago
__all__
magic option in fields
option on Meta
class.Published by oxan about 4 years ago
Initial release.
Published by oxan about 4 years ago
Breaking changes:
validated_data
representation now contains the rest_framework.fields.empty
sentinel value for fields where no value was provided, instead of the default of the dataclass field. The value returned by save()
is unchanged. This was necessary to support partial updates.Features & fixes:
list
and dict
typehints.max_digits
and decimal_places
for DecimalField
.