Skip to content

Add setting option icons and number bounds to the setting schema - #1831

Merged
lukeh-shopify merged 1 commit into
Shopify:mainfrom
lukeh-shopify:lh-theme-check-new-setting-kinds
Aug 5, 2026
Merged

Add setting option icons and number bounds to the setting schema#1831
lukeh-shopify merged 1 commit into
Shopify:mainfrom
lukeh-shopify:lh-theme-check-new-setting-kinds

Conversation

@lukeh-shopify

@lukeh-shopify lukeh-shopify commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

Add schema support and validation for new optional setting properties:

  • select settings: options can now specify an icon
  • number settings: new optional min, max, icon, and options metadata

Allows theme check to pass for these before submitting them to the server

What approach did you use?

  • Added a shared settingIcon definition, an enum of the supported snake_case icon IDs
  • Added a numberOptions definition
  • Added min/max to the number definition and option values to enforce at most one decimal digit
  • Added a radioOptions definition so radio options keep their existing shape but reject icon with a message pointing to select settings

@lukeh-shopify
lukeh-shopify marked this pull request as ready for review July 29, 2026 23:20
@lukeh-shopify
lukeh-shopify requested a review from a team as a code owner July 29, 2026 23:20

describe('Module: theme settings validation (config/settings_schema.json)', () => {
describe('Unit: option icons and number bounds', () => {
it('select setting allows an option icon', async () => {

@rjur11 rjur11 Jul 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we'd need to gate these changes to behind the flag? Or are we good just allowing it all to be discoverable in theme check? Core will reject it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't really add flags to this one, as they're just static files that theme check and the vs code extension pull from main. i did call this limitation out on slack. i think given the backend is still the source of truth, it's okay if these fields are rejected for now until it fully rolls out. worst case is someone does this manually (rare), or their agents read this file and start using them (higher chance but also rare)

i think the consensus for this repo is it's okay to merge early for us to test internally, so i'll do that. we can rip it out if we need to

Comment thread tests/setting.spec.ts
"description": "The smallest value the setting is expected to take. Supports at most one decimal digit. The setting still renders as a plain number field, so the input isn't clamped, but the default and any option values must fall within the bounds.",
"markdownDescription": "The smallest value the setting is expected to take. Supports at most one decimal digit.\n\nThe setting still renders as a plain number field, so the input isn't clamped, but `default` and `options[].value` must fall within the bounds.\n\n---\n\n[Shopify reference](https://shopify.dev/docs/themes/architecture/settings/input-settings#number)"
},
"max": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core also validates for number:

  • max >= min
  • default is within min / max
  • options[].value is within min / max

Do we need to make sure we cover that here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't quite cover those here. the JSON schema can't compare fields against each other, so we can't really express max >= min or "default must be within bounds"

the backend will stay the source of truth for this. the tests make sure no one assumes that this is covered in the JSON schema. the only way around this would be to create a custom theme check in Shopify/theme-tools

i'll merge this as-is, and we can discuss next week if we should add a check

Comment thread schemas/theme/setting.json Outdated

@karreiro karreiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, @lukeh-shopify!

I've sent you a video on Slack about grid being a valid value for the icon key -- please, let me know your thoughts about that.

Thanks again for this PR!

@karreiro karreiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this PR, @lukeh-shopify!

Once we address @rjur11's comments, I'm fine to merge (thank you, Rana, for clarifying the grid details on Slack!).

@lukeh-shopify
lukeh-shopify force-pushed the lh-theme-check-new-setting-kinds branch from 6d7b8a1 to 8c52498 Compare July 31, 2026 21:44
Adds the new setting kinds from issues-merchant-workflows issue 2669:

- `settingIcon`: an enum of the 64 supported snake_case stable icon IDs,
  with an error message that points merchants and theme developers away
  from Polaris component names (`LayoutColumns3Icon`) and kebab-case
  admin handles (`layout-columns-3`).
- `selectOptions`: an optional `icon` on each option.
- `radioOptions`: a new definition for `radio` settings that rejects
  `icon` with a message pointing at `select`, so radio settings no longer
  silently accept an unsupported attribute. The shared `options`
  definition is unchanged.
- `numberOptions`: a new definition for suggested `value`/`label`/`icon`
  entries on `number` settings, where `value` is a required number with
  at most one decimal digit.
- `number`: new `min`, `max`, `icon` and `options` attributes, and one
  decimal digit of precision on `default`, `min` and `max`.

The icon list and the precision rules mirror Core's
`Theme::SettingOptionIcon` and spec validator, so the editor, the
platform and theme-check agree on what is valid. theme-check downloads
these schemas from this repository and uses them for its ValidSchema
check.

Assisted-By: devx/0e7ab314-3226-4582-ac8d-b65bca9cbfd8
@lukeh-shopify
lukeh-shopify force-pushed the lh-theme-check-new-setting-kinds branch from 8c52498 to ce74c55 Compare August 5, 2026 19:12
@lukeh-shopify
lukeh-shopify merged commit 567ec42 into Shopify:main Aug 5, 2026
2 of 3 checks passed
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.

3 participants