Patch with no query updates all records in the database #7052
Labels
bug
developer-experience
Issues affecting ease of use and overall experience of LB users
Repository
Issues related to @loopback/repository package
Steps to reproduce
lb4 example todo-list cd loopback4-example-todo-list npm start
Browse to the API explorer at http://127.0.0.1:3000
Notice that the database is prepopulated
a. With GET todo-lists/count
Try It out
execute
button{ "count": 2 }
b. With button GET todo-lists/
Try It out
c. Click button
GET /todo-lists/{id}/todos
Try It out
1
for the id number of the first listid's 1, 2 and 4 .
WARNING: about to (accidentally) patch all the todos in the list!
d. Click button
PATCH /todo-lists/{id}/todos
Try It out
1
for the id number of the first listexecute
button{ "count": 3 }
e. Re-perform step c. above to see the result is:
Current Behavior
Expected Behavior
accidentally. Even better, no patch-all would occur
and that a somewhat helpful error message would be
returned stating that an empty query is not allowed with
a patch request.
Link to reproduction sandbox
Additional information
@loopback/[email protected] /home/northdecoder/workspace/loopback4-example-todo-list
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── [email protected]
Related Issues
Issue #
The text was updated successfully, but these errors were encountered: