Validate section setting keys in JSON templates#1245
Open
chippleh1392 wants to merge 1 commit into
Open
Conversation
|
Hi @chippleh1392, Thanks for the PR! What about blocks in templates? |
00dedb5 to
54e07d3
Compare
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you adding in this PR?
Fixes #1239.
ValidSettingsKeyalready 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:typeto its section schemasections.*.settingskeys against that schema'ssettingsThis 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
ValidSettingsKeycode.Tophatting
corepack pnpm exec vitest run packages/theme-check-common/src/checks/valid-settings-key/index.spec.tscorepack pnpm exec vitest run packages/theme-check-common/src/index.spec.ts packages/theme-check-common/src/checks/valid-settings-key/index.spec.tscorepack pnpm --dir packages/theme-check-common type-checkcorepack 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.mdcorepack pnpm buildfrom Git Bash on WindowsBefore you deploy
changesetpnpm buildand committed the updated configuration files (no tracked config changes were produced)theme-app-extension.ymlconfig (not applicable)