-
Notifications
You must be signed in to change notification settings - Fork 23
Patching relationships should be possible via relationship URLs. #88
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
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The examples shown only deal with non-relational patching.
|
There are now 3 methods to handle updates via relationship URLs:
|
The jsonapi spec allows for altering relationship information either by PATCHing a resource and including the relationship information (https://jsonapi.org/format/#crud-updating-resource-relationships) or by sending PATCH, POST and DELETE requests to relationship URLs (https://jsonapi.org/format/#crud-updating-relationships).
jsonapi-vuex currently only supports the former and there are good reasons one might want to choose the latter. For instance, when updating a resource with many related resources (such as an article with many comments) we might have fetched only a subset of those related resources (because the results are paged, for example). If we PATCH said article and include the comments relationship in the patch, we will send an incomplete list of comments and unintentionally cause the server to delete many other comments from the relationship.
To support the latter, I think a diff style function which generates a list of patching actions (some of which are actually POST or DELETE in HTTP terms) might be useful. Something like:
The text was updated successfully, but these errors were encountered: