Skip to content

Cap section and block option values at 50 characters - #1933

Open
dpanov wants to merge 1 commit into
mainfrom
dpanov/strict-option-values
Open

dpanov wants to merge 1 commit into
mainfrom
dpanov/strict-option-values

Conversation

@dpanov

@dpanov dpanov commented Oct 26, 2026 •

Copy link
Copy Markdown

Why are these changes introduced?

Right now theme-check accepts select and radio option values of any length in sections and blocks. shopify theme push fails on a section or block with a value over 50 characters, so the developer only finds out when they push:

blocks/main-menu.liquid: Invalid schema: setting with id="variant" option value is too long (max 50 characters)

This change adds the limit to theme-check's schemas.

What approach did you take?

A new settings schema for sections and blocks adds the 50-character limit to the existing rules. Settings in config/settings_schema.json keep the existing schema, because shopify theme push accepts 1,000 characters there. The new schema skips t: translation references, because shopify theme push doesn't check their length.

Testing steps/scenarios

  • On this branch, run this to clear the theme-check cache (macOS) and create an empty test theme:
    rm -rf ~/Library/Caches/theme-liquid-docs-nodejs
    mkdir -p /tmp/strict-test/blocks /tmp/strict-test/config /tmp/strict-test/locales
  • Create /tmp/strict-test/blocks/test.liquid with this content. The option value has 51 characters.
    {% schema %}
    {
      "name": "Test",
      "settings": [
        {
          "type": "select",
          "id": "variant",
          "label": "Variant",
          "options": [{ "value": "a-select-option-value-that-has-fifty-one-characters", "label": "Long" }]
        }
      ]
    }
    {% endschema %}
  • Create /tmp/strict-test/config/settings_schema.json with this content. It has the same setting.
    [
      {
        "name": "Test",
        "settings": [
          {
            "type": "select",
            "id": "variant",
            "label": "Variant",
            "options": [{ "value": "a-select-option-value-that-has-fifty-one-characters", "label": "Long" }]
          }
        ]
      }
    ]
  • Run SHOPIFY_TLD_ROOT="$PWD" shopify theme check --path /tmp/strict-test from the root of this repo. Make sure that blocks/test.liquid has a ValidSchema error: "String is longer than the maximum length of 50."
  • Read the same output. Make sure that it lists no offense for config/settings_schema.json.
  • Run rm -rf /tmp/strict-test ~/Library/Caches/theme-liquid-docs-nodejs to remove the test theme and the cached schemas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dpanov
dpanov marked this pull request as ready for review October 26, 2026 15:43
@dpanov
dpanov requested a review from a team as a code owner October 26, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant