You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, any Resource without an id can not be stores. Problem is, when you want to create object and relation on client-side, it fails.
From the JSONAPI :
Resource Objects
“Resource objects” appear in a JSON API document to represent resources.
A resource object MUST contain at least the following top-level members:
id type
Exception: The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
@Thiryn
Rule you quoted applies only for resource objects, not the pointer objects inside relationships payload.
So I think creating an object and relationship in one request is not supported by JSON:API because you need to set id and type for relationship element. Please correct me if I'm wrong.
I think there are drafts about creating nested object here. But even without talking about creating the resource on server-side, for now it is not possible to create resources such as car on client-side with Vox.
My use-case is a resource with relations (like car), with a client-side creation of temporary related object (temporary tires) that are not going to be persisted on server-side but used on the application.
The ResourcePool store resources, with a key that use
id
andtype
So, any Resource without an
id
can not be stores. Problem is, when you want to create object and relation on client-side, it fails.From the JSONAPI :
Resource Objects
Such a Thing would not work :
I would suggest to add a default
id
to a resource in ResourcePool::addResource if none is given by the user :The text was updated successfully, but these errors were encountered: