Skip to content

Writing writeable:false id silently ignored in tests since #7270 #7382

@BacLuc

Description

@BacLuc

API Platform version(s) affected: 4.1.21, 4.1.22, 4.1.23

Description
In

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:

  1. 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.

  2. 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.

  3. Keep the 2 commits and wait until there is a fix for not writable ids?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions