API Platform version(s) affected: 3.0.4
Description
BC using Serialization Per Item appears to be broken after upgrading to version 3.0.4
How to reproduce
Implement a normalizer following the documentation. The custom Normalizer will dynamically add serialization groups to the serialization context. After upgrading to v3.0.4 the dynamic groups are no longer respected.
The getFactoryOptions function in AbstractItemNormalizer (link) has added caching logic. If the context is cached, the options for serialization_context will not include the dynamically added groups.
Possible Solution
Move the logic that calculates the serialization_context ahead of the cache check and ensure they are all merged together.
API Platform version(s) affected: 3.0.4
Description
BC using Serialization Per Item appears to be broken after upgrading to version 3.0.4
How to reproduce
Implement a normalizer following the documentation. The custom Normalizer will dynamically add serialization groups to the serialization context. After upgrading to v3.0.4 the dynamic groups are no longer respected.
The
getFactoryOptionsfunction in AbstractItemNormalizer (link) has added caching logic. If the context is cached, the options forserialization_contextwill not include the dynamically added groups.Possible Solution
Move the logic that calculates the
serialization_contextahead of the cache check and ensure they are all merged together.