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

Theme check for settings keys inside presets and default #742

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aswamy
Copy link
Contributor

@aswamy aswamy commented Jan 29, 2025

What are you adding in this PR?

Fixes #624
Fixes #602

  • Talked to @charlespwd and we won't be doing setting value check here

Shoutout to @AribaRajput for creating the initial PR to get this done quickly

What's next? Any followup issues?

  • Found a few missing pieces of completion / hover / checks for schema that ill be tackling

How to test

NOTE: This check DOES NOT check if the theme block exists or not. That is the responsibility of another theme check. I have noticed a bug where if you have local blocks, and there are references to local blocks that dont exist within presets and default, no theme check error is thrown. I will fix that in a following PR.

Testing settings

  1. Create preset/default settings
"settings": [{
    "type": "text",
    "id": "top-level-setting",
    "label": "TEXT"
  }
],
  1. Create presets.[].settings and default.settings that has keys that match the settings.id defined above. Create some that don't. See error.

Testing preset/default block settings defined in local block

  1. Create a local block with settings
"blocks": [
  {
    "type": "local-block",
    "name": "local block",
    "settings": [
      {
        "id": "local-setting",
        "type": "text",
        "label": "local setting"
      }
    ]
  }
]
  1. Create presets.[].blocks.[].settings and default.blocks.[].settings that has keys that match the settings.id defined above. Create some that don't. See error.

Testing preset/default block settings defined in theme block

  1. Create blocks that allows all theme blocks
"blocks": [
  {
    "type": "@theme"
  }
]
  1. Create presets.[].blocks.[].settings and default.blocks.[].settings that has keys that match the settings.id defined in the block file being referenced. Create some that don't. See error.

Before you deploy

  • I included a minor bump changeset
  • My feature is backward compatible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Theme block JSON preset validation Validate preset settings
2 participants