Possible to get full object & variable name with `strict_variables: true`?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
Hi there,
My organization uses strict_variables: true to determine when a variable is undefined, and though this works well, the error messages lack full context, which means I have difficulty passing proper instruction to my customers. As an example, if my customers template is something like: "Hello {{ customer.full_name }}, I am {{ sender.full_name }}" and the sender object is missing altogether or is missing the first_name key, then the error returned to me by liquid would be undefined variable full_name. This makes it non-trivial to determine whether the customer object might be missing/incomplete or if the sender object might be missing/incomplete, and thus it becomes very difficult to tell my customer what they should do to fix the error.
Am I missing some easier way to determine this info? Or would it be possible to adjust the error message returned to pass along the entirety of the context for this scenario?
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the strict_variables handling and the code that constructs the undefined-variable error for nested expressions. Reproduce the customer and sender examples from the issue, then determine how full variable context should be represented and verify that the resulting error distinguishes the missing object or property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100