mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
In the native image every $foreach property of a VTL mapping template resolved to null: #if($foreach.hasNext) was always false, so the usual comma-between-items pattern rendered invalid JSON, and $foreach.index, $foreach.count and $foreach.hasNext printed as literal text. Velocity binds $foreach to a ForeachScope and reads its getters through reflection, but only the Foreach directive was registered, not the scope it creates. Velocity then fell back to reading the scope as a map, which holds none of those keys. ForeachScope and its parent Scope are now registered alongside the directive. Reflection registration covers the whole image, so AppSync resolver templates, which loop through the same directive, get the scope too.