patx/relay-lang

Fix MiniJinja template context conversion

Commit 6433c17 · Harrison Erd · 2026-02-10T15:25:27-05:00

Changeset
6433c174bf6e351810b68481f6610df34dd6e015
Parents
3323fb206e5ec1492400b74a94e5c0cf3a9fbab0

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/src/main.rs b/src/main.rs
index 8ceb08f..40c47b4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -32,7 +32,7 @@ use axum::{
 use async_recursion::async_recursion;
 use futures::{stream::TryStreamExt, SinkExt, StreamExt};
 use indexmap::IndexMap;
-use minijinja::{context, Environment};
+use minijinja::Environment;
 use mongodb::{
     bson::{self, Bson, Document},
     Client as MongoClient, Collection as MongoCollection, Database as MongoDatabase,
@@ -1481,8 +1481,10 @@ fn render_template(s: &str, locals: &HashMap<String, Value>) -> RResult<String>
         ctx.insert(key.clone(), value_to_json(value));
     }
 
+    let ctx = J::Object(ctx);
+
     Environment::new()
-        .render_str(s, context!(..ctx))
+        .render_str(s, &ctx)
         .map_err(|e| RelayError::Runtime(format!("Template render error: {e}")))
 }