Skip to content

Validate section setting keys in JSON templates#1245

Open
chippleh1392 wants to merge 1 commit into
Shopify:mainfrom
chippleh1392:repro/issue-1239-valid-settings-key-json
Open

Validate section setting keys in JSON templates#1245
chippleh1392 wants to merge 1 commit into
Shopify:mainfrom
chippleh1392:repro/issue-1239-valid-settings-key-json

Conversation

@chippleh1392

@chippleh1392 chippleh1392 commented Jun 22, 2026

Copy link
Copy Markdown

What are you adding in this PR?

Fixes #1239.

ValidSettingsKey already validates setting keys inside section schema presets/defaults, but template JSON section settings were not checked. That meant a template could set an unknown section setting key and Theme Check would report no offense.

This adds the JSON-template side of the same check for templates/*.json:

  • resolve each template section's type to its section schema
  • validate sections.*.settings keys against that schema's settings
  • report the unknown key on the template JSON setting key

This covers section settings and template block settings, including nested blocks. Section group JSON files are left unchanged.

What's next? Any followup issues?

No follow-up planned.

What did you learn?

Template JSON checks run separately from Liquid schema checks, so this uses a JSON companion check registered under the same ValidSettingsKey code.

Tophatting

  • corepack pnpm exec vitest run packages/theme-check-common/src/checks/valid-settings-key/index.spec.ts
  • corepack pnpm exec vitest run packages/theme-check-common/src/index.spec.ts packages/theme-check-common/src/checks/valid-settings-key/index.spec.ts
  • corepack pnpm --dir packages/theme-check-common type-check
  • corepack pnpm exec prettier --check --ignore-unknown packages/theme-check-common/src/checks/valid-settings-key/index.ts packages/theme-check-common/src/checks/valid-settings-key/index.spec.ts packages/theme-check-common/src/checks/index.ts .changeset/bright-keys-check.md
  • corepack pnpm build from Git Bash on Windows
  • I added screenshots of the changes (before and after the changes if applicable)

Before you deploy

  • This PR includes a new checks or changes the configuration of a check
    • I included a minor bump changeset
    • I ran pnpm build and committed the updated configuration files (no tracked config changes were produced)
    • If applicable, I've updated the theme-app-extension.yml config (not applicable)
    • [Shopifolk] I've made a PR to update the shopify.dev theme check docs if applicable.

@chippleh1392 chippleh1392 requested a review from a team as a code owner June 22, 2026 04:57
@domaine-stijn-slats

domaine-stijn-slats commented Jun 22, 2026

Copy link
Copy Markdown

Hi @chippleh1392,

Thanks for the PR!

What about blocks in templates?

@chippleh1392 chippleh1392 force-pushed the repro/issue-1239-valid-settings-key-json branch from 00dedb5 to 54e07d3 Compare June 22, 2026 14:56
@chippleh1392

Copy link
Copy Markdown
Author

Hi @domaine-stijn-slats, good point. I extended the JSON template path to cover block settings too, using the same general traversal shape as JSONMissingBlock.

This now checks section settings and template block settings under sections.*.blocks.*.settings, including nested blocks. Local blocks and theme blocks are resolved separately. I kept section group JSON out of scope for parity with JSONMissingBlock, but can include that too if you want it covered here.

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.

ValidSettingsKey: does not validate section settings in template JSON files

2 participants