Shopify Product `tags` format is inconsistent between GET and POST
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the issue with ShopifyAPI::Product.find and save!, then inspect the request path referenced at lib/shopify_api/clients/http_client.rb:71 and the product handling around tags. Done means a fetched product can be saved without manually converting tags from a comma-separated string to an array, with the existing reproduction no longer raising the shown error.
Written by the indexing model from the issue text.
Description
Issue summary
When we access product.tags it returns a string of comma separated tags.
When we save the product, it is required to set the tags to an array of tags.
This means that fetching a product and saving it without touching the tags results in an error :
product_id = XXX
ShopifyAPI::Auth::Session.temp(...) do
shopify_product = ShopifyAPI::Product.find(id: product_id)
# shopify_product.tags = shopify_product.tags.split(', ') # Uncomment this to fix the call
shopify_product.save!
end
# -> /usr/local/bundle/gems/shopify_api-13.0.0/lib/shopify_api/clients/http_client.rb:71:in `request': {"errors":{"product":"Required parameter missing or invalid"},"error_reference":"If you report this error, please include this id: f610c13a-c4ec-449d-b33f-1204e1eb2c3b."} (ShopifyAPI::Errors::HttpResponseError)
shopify_apiversion: 13.0.0- Ruby version: 3.2.0
- Operating system: MacOs 13.3.1
Expected behavior
The object returned by find or similar fetching methods should be in a state where they can be saved without the user having to map some fields (that he might not even be touching) in a different format.
Actual behavior
If you don't map the tags field from string to array, you can't save the product.
Steps to reproduce the problem
- Use the given code to reproduce the issue
- Notice that uncomenting the line makes the error go away
- 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