-
-
Notifications
You must be signed in to change notification settings - Fork 158
Deserializer only links attributes and not included relationships #497
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
Can you link to json:api spec where it says this should be supported? Seems like it should. |
I don't think it's a part of the JSON:API spec to support create/update with nested relationships. If we were to adjust the serialization layer to create the output as you're describing, things will break in the repository layer because the current implementation does not handle updating nested relationships. I don't think we should do that, therefore I think we can close this issue. However: This issue shows pretty accurately the issue that I have with the current serializers. IMO, the deserializers output should be dependent only on 1) the json input, and 2) the resource graph, and not on any query params (and therefore no dependency on Rewriting the serializer as such is mentioned in #263 and #253 |
There is no mention on json:api for this so not sure. However I have seen other libraries do that which makes me think this is very much standard. |
I totally agree, I'm in! Work that will be involved:
This will surely involve breaking changes in the API. I hope I can make a proposal where to start on soon. If you feel like getting involved, we would greatly encourage that! |
resolved in #558 |
For a simple model like below
Serializer works fine and get customer with included relationship returns the desired response
/api/v1/customers?included=orders.invoices
However on using the same json as input for post/put operation and trying to deserialize into customer instance with all fields/relationships populated, it does not load included relationship.
In this instance, customer has orders attributes populated but invoices is appearing blank.
Is it because we are only setting attributes and not relationship. Can we please modify it to add second level or more relationship be included as well.
JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/JsonApiDeSerializer.cs
Line 323 in 9059560
The text was updated successfully, but these errors were encountered: