-
-
Notifications
You must be signed in to change notification settings - Fork 158
PATCH returns data:[] relationships #318
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
I should also mention I'm using v2.2.5 as I have not upgraded to Core 2.1 yet. |
Thanks for reporting this. I plan on picking this up on Monday if no one gets to it by then. |
Update: I have upgraded to core 2.1, and am using v2.3.3 and still have the bug. |
@joshhubers actually, I'm unable to repro. Can you take a look at the test here: d9d1f65#diff-3291fcbe5d589cd25e4f538a16f78aadR148 And let me know if you're doing something different? Are you updating the relationship in the |
@jaredcnance Thanks for the test. The test ran fine and looks like the situation I was having. Turns out there was an initializer in the default constructor, assigning an empty list to the property. i.e.
So the serializer believed that there was a relationship with no data. |
test/#318: empty collection returned for PATCH requests
When I patch to an endpoint the relationship returns data: [], which isn't always true.
For example, if I had ingredients and recipes, I query for
recipes?include=ingredients
and I will get the included ingredients as expected.However, if I PATCH to recipe, the relationship returns an empty array, even though relationships exist
For example:
In my case I'm building an ember app, so ember thinks that the relationships just magically disappear and content on the page will disappear on update.
The text was updated successfully, but these errors were encountered: