Shopify / ui-extensions

MIT License
248 stars 35 forks source link

"Choice" validation settings example is incorrect. #2085

Open edhgoose opened 2 weeks ago

edhgoose commented 2 weeks ago

Describe the bug

The documentation on this page says:

[[extensions.settings.fields.validations]]
name = "choices"
value = "["red", "green", "blue"]"

is a valid example.

But, the shopify cli will throw out an error:

15:26:16 │ app-access       │ Error while deploying updated extension draft: Fix the following error in
 extensions/order-status-ui/shopify.extension.toml:
15:26:16 │ app-access       │ Unexpected character, expected only whitespace or comments till end of
line at row 65, col 12, pos 2186:
15:26:16 │ app-access       │ 64: name = "choices"
15:26:16 │ app-access       │ 65> value = "["red", "green", "blue"]"

Replacing the code with:

[[extensions.settings.fields.validations]]
name = "choices"
value = "[\"red\", \"green"\, \"blue\"]"

allows the UI to work:

CleanShot 2024-06-15 at 15 29 59@2x

Steps to reproduce the behavior:

  1. Add the config above to a setting
  2. Observe that the CLI complains
  3. Replace the " with \" and see it works and the UI renders.

Expected behavior

No error and correct documentation.

Screenshots

Additional context