-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix passing serializer.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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Related to #47012 |
ObjectNormalizer
that doesn't use default_context
config optionserializer.default_context
option to normalizers
4a39eb4
to
db6ab74
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.
@@ -6,9 +6,16 @@ framework: | |||
enabled: true | |||
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?
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 tagged serializer.normalizer
or serializer.encoder
and that have the argument $defautContext
in their constructor, the same as what SerializerPass
does.
db6ab74
to
6ac8f52
Compare
serializer.default_context
option to normalizersserializer.default_context
option to normalizers and encoders
serializer.default_context
option to normalizers and encodersserializer.default_context
option to normalizers
6ac8f52
to
d863692
Compare
Thank you @wuchen90. |
The
default_context
config option underserializer
of 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.