Add SchemaPresetsAndDefault check - #1302
Open
web-orbit12 wants to merge 1 commit into
Open
web-orbit12 wants to merge 1 commit into
web-orbit12 wants to merge 1 commit into
Conversation
Reports section schemas that define both presets and default, which `shopify theme dev` rejects with "Invalid schema: cannot define both 'default' and 'presets'". Fixes Shopify#750
Author
|
I have signed the CLA! |
This branch has not been deployed
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 #750
A section schema that defines both
presetsanddefaultpasses Theme Check today, butshopify theme devrejects it with:This adds a
SchemaPresetsAndDefaultcheck that reports the same error in the editor and inshopify theme check, highlighting thedefaultvalue.defaultproperty.SchemaPresets*checks.What's next? Any followup issues?
The check needs a page on shopify.dev (
checks/schema-presets-and-default), which a Shopify team member would have to add.I treated key presence as the trigger, so an empty
presets: []withdefaultis also flagged. Happy to switch to non-emptypresetsonly if the platform accepts that combination.Tophatting
sections/test.liquid: the error appears ondefault. Remove either key and it goes away.{% schema %} { "name": "Test", "presets": [{ "name": "Test" }], "default": { "settings": {} } } {% endschema %}pnpm playground) with the section above, built frommainand from this branch:Before (
main@ 8bc5e03): no errorAfter (this branch @ d4dcdf9):
defaultis flaggedpnpm vitest run packages/theme-check-common/src/checks/schema-presets-and-default(5 tests), plus the fulltheme-check-commonandtheme-check-nodesuites pass.I added screenshots of the changes (before and after the changes if applicable)
Before you deploy
changesetpnpm buildand committed the updated configuration filestheme-app-extension.ymlconfig (not applicable: in app mode, sections have no schema to check, so the check is a no-op)