-
Notifications
You must be signed in to change notification settings - Fork 529
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
Any recommended workaround for embedding resources in Create/Update requests #775
Comments
Have you read this article? |
This will be resolved when JSON API is extended with Operations. Over the next few weeks I'm hoping to put some time into testing this in JR as a step in writing the update to the spec. |
Thanks @aldhsu . That is a great article, and lovely solution for the client side. Does this work for you with json-api-resources. I keep getting an error message:
|
@ianpetzer I haven't had to implement saving embedded records yet. Just something on my horizon. You may need to handle the request manually using the |
Hi @ianpetzer , can you implement that? I'm new in ruby rails world and I don't understand how to use the "processor hook".. |
@ianpetzer, have you manage to overcome this issue? I keep getting the same error message like you: title: "Invalid Links Object" |
Hi,
My understanding is that jsonapi-resources aims to be a json-api compliant
implementation.
This behaviour of embedded nested resources is slated for json-api v1.1
which hasn't been adopted yet. I tried to look into how to add this to
json-api resources but it was a bit beyond me.
The only option that I've managed to find that offers this behaviour is
https://jsonapi-suite.github.io/jsonapi_suite/ but I'm currently stuck on
Active Model Serializers 0.8 because of this issue.
Good luck, and if you manage to make embedded resources work on Json-api
resources, please let us know. I would love to switch over and this is the
only thing blocking me.
…On Fri, Mar 31, 2017 at 6:39 AM, LarryMckuydee ***@***.***> wrote:
@ianpetzer <https://github.com/ianpetzer>, have you manage to overcome
this issue? I keep getting the same error message like you:
title: "Invalid Links Object"
code: "115"
I follow http://jsonapi.org/format/#crud-creating
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#775 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHZh6IVfNbx_E80Ro4_r-_9vBV5Si0_ks5rrIOQgaJpZM4JSklF>
.
|
Thanks for bringing JSONAPI Suite to my attention, @ianpetzer. I, too, would absolutely love for JR to support embedded resources one way or another, even though it’s not (yet‽) part of the jsonapi.org spec. The way JSONAPI Suite deals with temporary client IDs seems pretty cool. I wish someone smarter and faster than me would whip together a fork of JR which does this. |
I managed to create a record with nested association records following the docs section on flattening relationships. So instead of writing my request this way:
I sent the relationship data as part of the main object's attributes:
And I defined my resource object getter and setter:
I have a feeling there will be a better solution in the future depending on how the conversation goes, but this is my working solution for now. |
Thanks @martinverdejo, this example was very helpful. I hope to see this feature included soon. There is an example of this in the official JSON API docs here http://jsonapi.org/format/#crud-creating |
Hi,
I've read up a lot of information about how 'embedded' / 'nested' resources are scheduled for v1.1 of the json-api but I was just wondering if anyone using jsonapi-resources has an interim solution, for de-serializing create/update requests where I can create / update a set of related entities. In the case of the create they wouldn't have client generated ids. I'm just hoping to create them as Rails nested resources.
Is there possibly a workaround for json-api resources similar to what was created for Active Model Serializers here: json-api/json-api#795 (comment)
I'm just trying to create a a few related entries in an atomic request.
For record fetching, I use sideloading.
I'm using Ember-data with the EmbeddedRecordsMixin to include the embedded relationships
Thanks for any suggestions
The text was updated successfully, but these errors were encountered: