-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace zgw_consumers.drf.serializers with drf-dataclasses #31
Comments
maybe it would be better to deprecate this and remove it in 1.0, in favour of the mentioned library. |
@damm89 I know this thing is used in Utrecht - can you provide some insight of what the impact would be to switch to djangorestframework-dataclasses from zgw-consumers' |
Hi @sergei-maertens, The impact depends on the implementation. Deprecation would mean deprecating the ZGWModel? Or adapting it to drf-dataclasses but keeping ZGWModel? |
@damm89 no - we're not touching
|
I see, I misread. I tried to replace the APIModelSerializer with the DataclassSerializer in the ZAC and where it seems to "break" with current functionality is the to_internal_value method. When validating the data it tries to actually instantiate the dataclass in to_internal_value but it's obviously missing data. I don't really have a lot of time right now to check why this is happening and whether there's a quick option or fix somewhere. Test it out for yourself with the example below. Example:
|
Thanks for getting back - we'll wait a little longer with deprecating this then! |
See: https://pypi.org/project/djangorestframework-dataclasses/
The implementation appears to be the same - inspired on
ModelSerializer
.To avoid breaking backwards compatibility, we can keep the custom classes around for a couple of releases and alias the drf-dataclasses (+ add a warning of course).
The text was updated successfully, but these errors were encountered: