Suggestion: Make it easier to identify or bypass only submitting dirty attributes on update
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by reading the dirty-attributes behavior introduced in PR 1149 and trace the save path that sends the PUT request. Define which proposed behavior is in scope—bypassing dirty checks, inspecting changes, or reporting empty payloads—and consider the issue complete when the selected behavior is specified with a clear way to verify it.
Written by the indexing model from the issue text.
Description
This feature to only send changed fields has tripped me up a few times and can be difficult to identify.
The problem I've ran into is when the object state hasn't changed and you call save it will still do the put request with an empty payload and you end up with an error with something like {"errors":{"metafield":"Required parameter missing or invalid"} which isn't very clear about the problem. As far as I can tell there isn't a method that I can use to inspect the object to decide if I need to save or not.
If this functionality is really important what do you think about a few additional features to make it easier to work with or bypass, such as:
- Allow bypassing the dirty attributes check and sending all attributes on
save. Maybe something likesave(only_changed: false) - Provide a method that we can use to inspect the object to see if there are changes so we can skip the
savecall if we want. Something likechanged?ordirty?maybe?
It would also be great if an error or warning of some sort was returned if the payload you are submitting is empty.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 484
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/shopify-api-ruby
-
devtools-gardener
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Shopify/shopify-api-ruby#1456 · 3 reactions ·
-
devtools-gardener
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Shopify/shopify-api-ruby#1461 ·
-
automated
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Shopify/shopify-api-ruby#1460 ·
-
devtools-gardener
Difficulty 5/5 Over a week Newbie friendliness 35/100
Shopify/shopify-api-ruby#1455 ·
-
devtools-gardener
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Shopify/shopify-api-ruby#1453 ·
All issues in Shopify/shopify-api-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100