Skip to content

Create / update record not transformed to JSON:API format #5

@yoelpc4

Description

@yoelpc4

Hi nice plugin btw with JSON:API.

I wonder about way to creating/updating record on
https://github.com/scalient/vuex-orm-json-api/blame/master/README.md#L39-L40

Seems the data parameter is not formatted as described on creating spec and updating spec.

Your restful actions mixin only provides the raw data instead of JSON:API formatted to the json api request on

/*
* The Rails-y REST `create` action.
*/
async create(data = {}, config = {}) {
return this.post(this.restResourcePath(), data, {multiplicity: "one", ...config});
},
/*
* The Rails-y REST `update` action.
*/
async update(id, data = {}, config = {}) {
// The JSON:API specification seems to prefer `PATCH` over `PUT`: See
// `https://jsonapi.org/format/#crud-updating-resource-relationships`.
return this.patch(this.restResourcePath(id), data, {id, multiplicity: "one", ...config});
},

Can you help me with data request transformer when creating/updating record that comply to JSON:API spec?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions