-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Allow (de)normalization of empty objects in PropertyNormalizer #46417
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
base: 7.3
Are you sure you want to change the base?
[Serializer] Allow (de)normalization of empty objects in PropertyNormalizer #46417
Conversation
Hey! I think @mtarld has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
4989076
to
b80705a
Compare
@mtarld The original issue is marked as Also, I don't see any documentation for normalizers except for https://symfony.com/doc/5.2/serializer/normalizers.html#built-in-normalizers, I guess it's self-documented enough. And lastly, I'm still wondering if the backward compatible behavior is needed in this edge case. Or at least what about adding a deprecation notice in case the original check does not pass so that we can delete it in a subsequent version? I mean I don't mind and most people configuring their normalizers can probably find this configuration option but it would prevent the unexpected first encounter of this |
Yes indeed, IMO it must be a feature 🙂 I guess the documentation, code, and context builders are enough. For the BC migration path part, it is tricky. The behavior of these normalizers is changed (and the same goes for the serializer itself), so we must trigger a deprecation IMHO. Maybe we could leverage the WDYT? |
b80705a
to
14f5c30
Compare
Sounds good, I've added the deprecation, updated the default symfony bundle configuration (src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php) and updated tests so that the deprecation is not triggered :) Do we want to target 6.1 or 6.2 release? |
38a3438
to
ca505aa
Compare
As 6.1 is in feature freeze, we must target 6.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost good for me! 🙂
src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
Outdated
Show resolved
Hide resolved
2d0f77f
to
d7114f0
Compare
72c0c98
to
02a8212
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…alizer and GetSetMethodNormalizer
Update changelog
648b0d4
to
9de526d
Compare
Failing checks seem to be unrelated |
Anything I can do to get a second review and merge it? |
This PR adds optional support for the normalization of objects without properties (in the case of
PropertyNormalizer
) or objects without getters (in the case ofGetSetMethodNormalizer
). Backward compatibility is preserved since this change is disabled by default for now.Reasoning behind this change is explained in the discussion of the linked issue (#46280)