Skip to content
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

Patch on to-one relationships doesn't work due to issues with { "data": null } unmarshal #154

Open
brunoluiz opened this issue Aug 27, 2018 · 2 comments

Comments

@brunoluiz
Copy link

If a user wants to remove a to-one relationship a PATCH should be done on the /resource/:resourceId/relationships/relatedResource, with a body containing the following:

{
    "data": null
}

(http://jsonapi.org/format/#crud-updating-to-one-relationships)

But, when err := jsonapi.UnmarshalPayload(c.Request.Body, data) is executed, an error is given with the following message "data is not a jsonapi representation of '*chronos.RelatedResource'". What should I do to allow null values on jsonapi representations?

@cjmarkham
Copy link

@brunoluiz Did you ever find a solution for this? A different library? It looks like a PR to make this work was added in 2017 but in 2018 work was added which introduces the error.

@brunoluiz
Copy link
Author

brunoluiz commented Jan 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants