-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Sf 6.4 RC2] Serialization problem #52744
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
Thanks fr testing RCs :) Can you please share a reproducer? The current description is not actionable I fear. |
Hello Nicolas, :)
then :
Allows to trigger the bug or not. (OK with RC1, NOK with RC2). I'll try to create a reproducer with MicroSymfony if I can find time this week. It was also OK with all 6.4 beta versions. |
I've got the same error on a project. You can reproduce the error with this project sample. The project is just a new project I also confirm that only the |
Thanks for the reproducer @jdecool :) |
/cc @mtarld maybe? |
Hey! I checked a little bit and it appears that it is tightly related to API Platform. Indeed, this behavior was introducted in #52680 (which still does make sense to me). But API Platform do ignore the attribute extraction, and I don't know why, maybe @soyuka or @dunglas have an idea? 🙂 |
We don't use |
What I've found so far - when I have this:
and this
the issue is reproduced, but when I remove/change the Looks like the issue in API platform indeed. |
this is not solely an api platform problem. Given a serialization config like: App\Entity\Foo:
attributes:
id:
groups: ['read']
bar.id:
serialized_name: bar_id
groups: ['read'] where |
Here's a repo that shows the issue. Works with serializer RC1, but breaks with RC2. git clone git@github.com:survos-sites/dt-demo && cd dt-demo
composer install
bin/console importmap:install
symfony server:start -d
symfony open:local --path=/congress/api_grid Now change symfony/serializer to RC2, composer update, and it go to the same URL, it's broken. composer req symfony/serializer:v6.4.0-RC2
symfony open:local --path=/congress/api_grid |
@bendavies Your example broke with #52680 ( /cc @mtarld |
FWIW, I'm experiencing the problem even if I explicitly list serialization groups, so it's not simply that only using the default ApiPlatform() attribute. In other project: #[ApiResource(
shortName: 'member',
operations: [new Get(), new Put(), new Delete(), new Patch(), new GetCollection()],
normalizationContext: [
'groups' => ['member.read', 'member_extended', 'member_main', 'rp'],
],
denormalizationContext: [
'groups' => ['member.write'],
],
)]
#[Gedmo\Loggable]
#[Groups(['member.read'])]
class Member implements Loggable, RouteParametersInterface |
@xabbuh indeed and this is the behavior API Platform is based on, we don't use |
…es only (mtarld) This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Fix normalization relying on allowed attributes only | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #52744 | License | MIT Commits ------- ca16751 [Serializer] Fix normalization relying on allowed attributes only
Symfony version(s) affected
6.4 RC2
Description
Hello, I have an API Platform route which returns a collection :
It works well with Symfony 6.4 RC1, but with RC2 it returns an empty list :
It comes from the serializer component, I get the bug when only updating this component :
How to reproduce
up / down
Possible Solution
serializer component
Additional Context
The text was updated successfully, but these errors were encountered: