Skip to content

Serialization Context Per Item v3.0.4 Possible BC Break #5202

@mab05k

Description

@mab05k

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions