Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] Fix passingserializer.default_context option to normalizers#47637
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
wuchen90 commentedSep 27, 2022
Related to#47012 |
Uh oh!
There was an error while loading.Please reload this page.
ObjectNormalizer that doesn't usedefault_context config optionserializer.default_context option to normalizers4a39eb4 todb6ab74Compare
nicolas-grekas left a comment
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.
| default_context: | ||
| enable_max_depth:true | ||
| # The option below is used in \Symfony\Bundle\FrameworkBundle\Tests\Functional\SerializerTest::testObjectNormalizerUsesDefaultContextConfigOption | ||
| # to assert that the `default_context` is taken into account in serializers |
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.
The test itself should be enough to spot any issue quickly so I'm not sure this is useful
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.
You're right.
Maybe do I need to change the test to take into account the other normalizers that have the same behavior with$defaultContext since@nicolas-grekas has fixed them too?
nicolas-grekasSep 29, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
that'd be nice if you can yes !
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.
Done.
I changed the tests to target all normalizers and encoders that are taggedserializer.normalizer orserializer.encoder and that have the argument$defautContext in their constructor, the same as whatSerializerPass does.
serializer.default_context option to normalizersserializer.default_context option to normalizers and encodersserializer.default_context option to normalizers and encodersserializer.default_context option to normalizersnicolas-grekas commentedSep 29, 2022
Thank you@wuchen90. |
The
default_contextconfig option underserializerof FrameworkBundle isn't taken into account when usingSymfony\Component\Serializer\Normalizer\ObjectNormalizer.Maybe it's the case for other serializers but let's fix one at a time.