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

Connector does not support empty update #339

Closed
hvlawren opened this issue Jul 17, 2018 · 8 comments
Closed

Connector does not support empty update #339

hvlawren opened this issue Jul 17, 2018 · 8 comments
Labels

Comments

@hvlawren
Copy link

Description/Steps to reproduce

run patchAttributes on a model and provide an empty object as the payload, e.g.

PATCH /api/users/1 {}

Expected result

200 or 204, no error thrown

Actual result

500 thrown, connector sends invalid SQL to the DB, e.g.

UPDATE "public"."assettype" SET WHERE "id"=931;

Additional information

darwin x64 8.11.1

@hvlawren
Copy link
Author

Both the Cloudant connector and the in memory connector allow for empty updates.

@aharbis
Copy link
Contributor

aharbis commented Dec 6, 2018

Can we get any feedback on this?

@stale
Copy link

stale bot commented Jul 11, 2019

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.

@stale stale bot added the stale label Jul 11, 2019
@aharbis
Copy link
Contributor

aharbis commented Jul 11, 2019

@dhmlau I do not believe this has been fixed. Any chance we can keep this open and investigate?

@stale stale bot removed the stale label Jul 11, 2019
@dhmlau
Copy link
Member

dhmlau commented Jul 11, 2019

Sure.
We recently added the support for PATCH, see PR loopbackio/loopback-next#3199, and our milestone blog: https://strongloop.com/strongblog/loopback-june-2019-milestone/. Could you please verify if it's been fixed? Thanks!

cc @bajtos

@bajtos
Copy link
Member

bajtos commented Jul 30, 2019

Based on the report, it seems to me that the problem is in individual connectors that are not prepared to handle the case where the patch object contains no properties. Considering that this situation should be handled the same way by all connectors, I think it makes sense to detect empty patch payloads in @loopback/repository and/or loopback-datasource-juggler.

To ensure all connectors work consistently, we should add a test to packages/repository-tests to verify.

@stale
Copy link

stale bot commented Sep 28, 2019

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.

@stale stale bot added the stale label Sep 28, 2019
@stale
Copy link

stale bot commented Oct 12, 2019

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants