Open
Description
Context: Currently, inja requires string literals are specified in double quotation marks, because it follows the JSON data syntax. But templates in jinja2 can specify string literals using either single or double quotation marks.
Current behavior: It appears inja silently ignores single quotation marks, so these objects are interpreted as variables rather than string literals. For example, {{ "a" == "a" }}
returns true, but {{ 'a' == 'a' }}
raises error "variable 'a' not found". These error messages can confuse end users. For example, {{ join(cols, ', ') }}
raises error "unknown function join".
Resolution: There are various approaches to improve this edge case. I've listed my ideas in order of preference:
- Accept string literals in single quotation marks (e.g., replace with double quotation marks before sending to JSON parser).
- Ability to configure
Environment
to accept string literals in single quotation marks. - Recognize string literals in single quotation marks and provide informative error message.
Metadata
Metadata
Assignees
Labels
No labels
Activity