Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidSchema reports incorrect validation error when block in preset is disabled #748

Open
david-w-shopify opened this issue Jan 31, 2025 · 2 comments

Comments

@david-w-shopify
Copy link

Describe the bug
I'm copying some json from a template over to some schema presets and getting a theme check ValidSchema error with the wrong message.

Source

// sections/test.liquid

{% schema %}
{
  "name": "Test",
  "blocks": [{ "type": "@theme" }],
  "presets": [
    {
      "name": "Preset",
      "blocks": {
        "button": {
          "type": "button",
          "disabled": true
        }
      }
    }
  ]
}
{% endschema %}

Expected behaviour
"disabled": true is reported as invalid.
Theme Check flags a more useful error.

For what it's worth while I think this should be flagged as invalid, it is actually accepted by the platform, despite being useless.

Actual behaviour
The entire "blocks" value under the "Preset" preset throws an ValidSchema error with the message in the screenshot

Image

Debugging information

  • OS: macOS
  • OS Version: Sequoia 15.2
  • Theme Check Version: Unknown, according to CLI. I have @shopify/[email protected] installed though so whichever version is used by that
@david-w-shopify david-w-shopify changed the title ValidSchema reports incorrect validation error when block is preset is disabled ValidSchema reports incorrect validation error when block in preset is disabled Jan 31, 2025
@graygilmore
Copy link
Contributor

Hey @david-w-shopify! I'm pretty sure the schema validation is behaving as intended here. The "blocks" attribute should be passed an array of objects, not a single object: https://shopify.dev/docs/storefronts/themes/architecture/blocks/theme-blocks/schema#presets

@graygilmore
Copy link
Contributor

After chatting with David a bit I think there is a bug here. It's treating any non-valid attribute as a schema error (good!) but bubbling it up to a parent issue. We'll take a look at this.

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

No branches or pull requests

2 participants