-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] BackedEnum Serializer priority Change Broke API Platform BackedEnum Serialization #54478
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
Comments
Does api-platform/core#6283 fix your issue? |
@derrabus Unfortunately that did not fix the issue. After upgrading to API Platform 3.2.20 and disabling the |
cc @soyuka |
FWIW, I am not using GraphQL. |
To try and better illustrate the context, these are the relative Symfony services and their priority before #54315
With respect to API Platform, this is an incomplete list of code-documented priority needs for their serializers:
Is maybe a better approach to change the priority on |
I've submitted a set of additional tests for API Platform that hopefully shows the impact of this: api-platform/core#6288 |
It'd be nice to restore the priority on Symfony (as #54484 does) and I'll revert api-platform/core#6283 |
Instead of API Platform inserting its own normalizers into the priority queue, wouldn't it be better if it instead decorated Symfony normalizers? |
If we revert, let's please add tests that break should we ever fiddle with that specific priority again. |
… translatable (GwendolenLynch) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Serializer] reset backed_enum priority, and re-prioritise translatable | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54478 Fix api-platform/core#6285 Fix api-platform/core#6279 | License | MIT - `serializer.normalizer.translatable` -920 (was -890) - `serializer.normalizer.backed_enum` -915 (originally -915, changed to -880) Floating this as as solution to the knock-on issues from #54478 Context: - #54478 (comment) - api-platform/core#6288 Commits ------- b559aa5 [Serializer] reset backed_enum priority, and re-prioritise translatable
Yes if only it was possible api-platform/core#2355 |
Symfony version(s) affected
7.0.6
Description
The BackedEnum serializer priority change broke API Platform's serialization of backed enums, where the backed enum is declared as an API resource. Maybe it broke Symfony's serialization as well, but I did not test that.
After I upgraded to Symfony 7.0.6, backed enums are serialized in API Platform to just a simple array with the string values of the enum, and not as a full API resource. If I hack the BackedEnum Serializer priority back to
-915
inSymfony\Component\DependencyInjection\Loader\Configurator\serializer.php
, the serialization works 100% like prior to 7.0.6.The API Platform version did not change in my app.
How to reproduce
Serialize a backed enum in API Platform, as an API Platform resource.
Possible Solution
No response
Additional Context
API Platform output prior to 7.0.6
API Platform output with 7.0.6
Service Config
This service configuration in 7.0.6 makes the problem go away:
The text was updated successfully, but these errors were encountered: