Shopify / Shopify/theme-tools

`ValidSchema` check errors on nested translation keys

Open
#722 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug SEV-3
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Describe the bug
When using the locales object in a section schema, Theme Check raises an error if the translation is an object rather than a string, despite being renderable on the frontend.

Image

Image

Despite this being accepted by the platform, and renderable by Liquid, in the /themes/:id/language UI the nested keys only use the last portion of the key (desktop or mobile) in this case. So whilst I'd argue this is still a valid schema, I do think it's still worth at least warning users about to discourage a poor edit experience for merchants.

Source

// section/test-section.liquid

<p>{{ 'sections.test-section.title' | t }}</p>
<p>{{ 'sections.test-section.description.desktop' | t }}</p>
<p>{{ 'sections.test-section.description.mobile' | t }}</p>

{% schema %}
{
  "name": "Section",
  "locales": {
    "en": {
      "title": "Title",
      "description": {
        "desktop": "Lorem ipsum dolor sit amet consectetur, adipisicing elit.",
        "mobile": "Lorem ipsum dolor sit amet"
      }
    }
  }
}
{% endschema %}

Expected behaviour
No errors

Actual behaviour
The description object in the schema has a ValidSchema error

Debugging information

  • OS: Mac
  • OS Version: Sequoia 15.2
  • Theme Check Version: 3.73.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ValidSchema error with the nested locales object from section/test-section.liquid, then locate the validation entry point that reports the description object. Compare the expected no-error behavior with the stated warning concern, and confirm the result against the same schema example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.