-
-
Notifications
You must be signed in to change notification settings - Fork 932
Description
API Platform version(s) affected: 4.1.21, 4.1.22, 4.1.23
Description
In
- fix(serializer): Allow nested denormalization when allow_extra_attributes=false #7270
the behavior when denormalizing the id attribute was changed.
I did not get the whole PR, but something with id and denormalization changed.
in - fix(serializer): improve #7270 by reducing inconsistencies #7346
the code was refactored, but the behavior stayed the same.
Since then our test:
https://github.com/ecamp/ecamp3/blob/0c3639b884974fdbbb8682f3982d394207c05d38/api/tests/Api/BaseEntity/UpdateBaseEntityTest.php#L25
fails.
The id in the patch body ( of a top level element) is silently ignored.
Using the id in the Post body still fails which is verified by the test:
https://github.com/ecamp/ecamp3/blob/0c3639b884974fdbbb8682f3982d394207c05d38/api/tests/Api/BaseEntity/CreateBaseEntityTest.php#L28
See https://github.com/ecamp/ecamp3/actions/runs/17690379427/job/50282621552?pr=8013
PR: ecamp/ecamp3#8013
Reverting the 2 PR fixes the test:
Branch: https://github.com/BacLuc/ecamp3/tree/refs/heads/api-platform-revert-7270
Run: https://github.com/BacLuc/ecamp3/actions/runs/17698044717/job/50299984530
Job log: job-logs.txt
Would you rather:
-
It is not perfect that the id in the patch body is silently ignored and that the behavior between post and patch is different.
But we should change our test and this is the intended behavior of api-platform.
Nobodies application is going to break if this does not results in a 400er error. -
Revert these 2 commits (and maybe break others applications in a minor update).
And reintroduce the behavior once its implemented by preserving not writable ids. -
Keep the 2 commits and wait until there is a fix for not writable ids?