-
-
Notifications
You must be signed in to change notification settings - Fork 906
can't update nested entities while doing patch #4061
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
+1 |
The behavior explained at https://tools.ietf.org/html/rfc7386#section-3 shows that arrays must be replaced. Therefore this is the sole implementation of the merge-patch specification. The JSON PATCH specification (that is not implemented yet) may help solve that issue (https://tools.ietf.org/html/rfc6902#appendix-A.2). I'm closing this issue and we will follow that at #759 |
API Platform version(s) affected: 2.6.2
Description
After upgrading from api platform 2.5.7 to 2.6.2, updating nested entites using patch request (application/merge-patch+json) result in inserting new nested entities even if id attribute is provided.
How to reproduce
https://github.com/Adrillex/api-platform-2.6-patch-bug
The above project is a simple project with only two entities "resource" and "subresource".
to reproduce the bug :
{{baseUrl}}/resources/1
Content-Type: application/merge-patch+json
It result in inserting a new subresource instead of updating the old one (like if the id property wasn't provided) :
I noticed that If I do the exact same request using PUT, it works. BTW actually the PUT behavior seems to be exactly the one PATCH should be since I can use PUT to modify a resource without replacing it entirely.
I can also do a POST resource while modifying the subresource, it also works.
It looks like the problem is only with PATCH
The text was updated successfully, but these errors were encountered: