Shopify / shopify-cli

Shopify CLI helps you build against the Shopify platform faster.
https://shopify.dev/tools/cli
Other
1.01k stars 202 forks source link

[Bug]: populate products --images does not work. Only works after this fix! #2692

Closed zifahm closed 1 year ago

zifahm commented 1 year ago

Please confirm that you:

What type of project are you working on?

other

Expected behavior

Adding and excaped json with key value should be accepted for --images

eg: --images="{\"src\":\"src-url.png\", \"altText\":\"alt\"}"

A Fix for this error by Stephan made it work https://discord.com/channels/842813079926603828/1006230403838906420/1006275813504729179

Adding a JSON.parse fixes the issue

Why not a PR? Because I have no idea anything about ruby!

Actual behavior

Throws and error for invalid json

[{"message"=>"Variable $input of type ProductInput! was provided invalid value for images.0 (Expected \"{\\\"src\\\":\\\"hello\\\"}\" to be a key-value object responding to `to_h` or `to_unsafe_h`.)", "locations"=>[{"line"=>1, "column"=>24}], "extensions"=>{"value"=>{"title"=>"old glade", "variants"=>[{"price"=>"3.00"}], "images"=>"{\"src\":\"hello\"}"}, "problems"=>[{"path"=>["images", 0], "explanation"=>"Expected \"{\\\"src\\\":\\\"hello\\\"}\" to be a key-value object responding to `to_h` or `to_unsafe_h`."}]]

Stack trace

No response

Reproduction steps

  1. paste shopify populate products --images="{\"src\":\"hello\"}"
  2. Throws an error for invalid json

Operating System

Ubuntu 20.4

CLI version (run shopify version if you're not sure)

2.32.0

Shell

No response

Ruby version (run ruby -v if you're not sure)

No response

What language and version are you using in your application?

No response

github-actions[bot] commented 1 year ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.

→ If there's no activity within a week, then a bot will automatically close this.

Thanks for helping to improve Shopify's dev tooling and experience.