Shopify / Shopify/theme-tools

I would like to be warned when a select setting's default value is not a valid option.

Open
#943 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Describe the solution you'd like
Writing this setting in a block/section/settings_schema.json should warn me that the default doesn't match the options.

  "settings": [
    {
      "type": "select",
      "id": "alignment",
      "default": "this-is-not-an-option", 
      "options": [
        { "value": "flex-start", "label": "t:options.alignment.left" },
        { "value": "center", "label": "t:options.alignment.center" },
        { "value": "flex-end", "label": "t:options.alignment.right" }
      ],
    },

Similarly, I'd like the presets to warn me as well if a setting value in a preset is not a valid option.

  "presets": [
    {
      "name": "t:general.column",
      "category": "t:general.layout",
      "settings": {
        "layout_direction": "group--vertical",
        "alignment": "this-is-not-an-option",
      }
    },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the validation entry point for block/section/settings_schema.json and read how select settings and presets are currently checked. Add warnings for defaults and preset values that do not match the declared options, then verify both examples produce warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.