Shopify / Shopify/liquid

[LiquidDoc] Add union types

Open
#1,962 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Add the possibility to add union types for LiquidDocs.

E.g.

@param {string|number} my_variable - This can be a string or a number.

Use cases:

  • When passing an image aspect attribute, you can manually enter the numeric value as 0.5 or you can enter a string as 1/2, and then have the snippet to the math for you.

  • To be a bit more lax. When passing a width attribute and appending %. E.g. {{ width | append: '%' }}, you wouldn't care if it's a number or a string.

@karreiro (Tagging for visibility)

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

No files or tests are named in the issue. Begin by locating the LiquidDoc type-parsing entry point and existing parameter-type coverage, then trace how the documented {string|number} form is interpreted. Done means union annotations are accepted for the stated use cases and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.