ValidTagArgumentTypes
ValidTagArgumentTypes
Severity: warning | Type: LiquidHtml
This check ensures that an argument passed to a Liquid tag has the type the platformOS documentation publishes for that argument. It is the tag counterpart of ValidRenderPartialArgumentTypes, which judges {% render %} arguments against a partial's {% doc %} block, and it shares the same type inference and the same compatibility rules.
The expected types come from the Liquid tags reference and from nowhere else. platformOS Check never guesses a type: an argument the documentation does not type is not reported, whatever is passed to it. How much that leaves is the documentation's business rather than the check's, and it grows without a new release of platformOS Check.
An argument is only type-checked when:
- The tag is documented with a
parametersentry of that name. - That entry publishes a real type rather than
untyped. - The value is a literal, or an expression ending in a filter whose return type the documentation publishes — a bare variable lookup (
limit: page_size) cannot be typed without running the code and is never reported.
nil and null are accepted for every type — they mean "no value". boolean accepts any value, because every value in Liquid is truthy or falsy.
Examples
✗ Incorrect Code Example (Avoid using this):
{% for item in items limit: 'ten' %}
{{ item }}
{% endfor %}
✓ Correct Code Example (Use this instead):
{% for item in items limit: 10 %}
{{ item }}
{% endfor %}
{% comment %}A filtered value is typed by its last filter{% endcomment %}
{% for item in items limit: items | size %}
{{ item }}
{% endfor %}
{% comment %}A bare variable is never reported — its type is unknown here{% endcomment %}
{% for item in items limit: page_size %}
{{ item }}
{% endfor %}
Configuration
The default configuration for this check:
ValidTagArgumentTypes:
enabled: true
severity: warning
Disabling This Check
This check is safe to disable if you rely on Liquid coercing an argument to the type a tag needs.