Skip to content

Fix template rendering: support custom filters and Jinja2 inline dicts#5

Merged
jeffreyaven merged 1 commit intomainfrom
claude/rust-stackql-deploy-port-xyr7K
Feb 12, 2026
Merged

Fix template rendering: support custom filters and Jinja2 inline dicts#5
jeffreyaven merged 1 commit intomainfrom
claude/rust-stackql-deploy-port-xyr7K

Conversation

@jeffreyaven
Copy link
Contributor

Two issues prevented real-world IQL templates from rendering:

  1. render_queries() used Tera::one_off which doesn't have custom filters registered (generate_patch_document, from_json, sql_list, etc). Switched to render_with_filters() which creates a Tera instance with all custom filters.

  2. Tera doesn't support Jinja2 inline dict literals like: {{ { "Key": var, "Key2": var2 } | generate_patch_document }} Added preprocess_inline_dicts() which parses these expressions, constructs the JSON object from context variables, and rewrites them as {{ __inline_dict_N | filter_name }} with the JSON injected into context.

Also updated generate_patch_document filter to accept both JSON objects and JSON strings as input.

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv

Two issues prevented real-world IQL templates from rendering:

1. render_queries() used Tera::one_off which doesn't have custom filters
   registered (generate_patch_document, from_json, sql_list, etc).
   Switched to render_with_filters() which creates a Tera instance with
   all custom filters.

2. Tera doesn't support Jinja2 inline dict literals like:
   {{ { "Key": var, "Key2": var2 } | generate_patch_document }}
   Added preprocess_inline_dicts() which parses these expressions,
   constructs the JSON object from context variables, and rewrites them
   as {{ __inline_dict_N | filter_name }} with the JSON injected into
   context.

Also updated generate_patch_document filter to accept both JSON objects
and JSON strings as input.

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv
@jeffreyaven jeffreyaven merged commit 21f5951 into main Feb 12, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments