Skip to content

fix(resolver): JSON-serialize array params in Mustache body templates…#214

Merged
jlouvel merged 1 commit intomainfrom
fix/array-params-mustache-body-template
Apr 1, 2026
Merged

fix(resolver): JSON-serialize array params in Mustache body templates…#214
jlouvel merged 1 commit intomainfrom
fix/array-params-mustache-body-template

Conversation

@eskenazit
Copy link
Copy Markdown
Contributor

@eskenazit eskenazit commented Apr 1, 2026

Related Issue

Closes #213


What does this PR do?

Resolver.resolveMustacheTemplate was using JMustache with default settings, causing two issues:

  1. Collection and Object[] values were substituted via toString(), producing [CREW-001, CREW-003] (no quotes) — invalid JSON when inserted into a body template.
  2. JMustache HTML-escapes by default (""). Templates here produce JSON/URI output, never HTML, so this escaping corrupted the serialized JSON values.

Fix: JSON-serialize collections using Jackson before substitution, and disable HTML escaping via escapeHTML(false).


Tests

  • ResolverTest#resolveMustacheTemplateShouldJsonSerializeArrayParameters — verifies that a List is properly serialized as a JSON array in the template
  • ResolverTest#resolveMustacheTemplateShouldPreserveNonAsciiCharacters — verifies that non-ASCII characters (e.g. ø) are not corrupted by HTML escaping

Checklist

  • CI is green (build, tests, schema validation, security scans)
  • Rebased on latest main
  • Small and focused — one concern per PR
  • Commit messages follow Conventional Commits

Agent Context (optional)

agent_name: GitHub Copilot
llm: Claude Sonnet 4.6
tool: VS Code Copilot Chat
confidence: high
source_event: step-6 tutorial debug — create-voyage body rendered as invalid JSON
discovery_method: runtime_observation
review_focus: Resolver.java:resolveMustacheTemplate

@eskenazit eskenazit requested a review from jlouvel April 1, 2026 19:29
Copy link
Copy Markdown
Contributor

@jlouvel jlouvel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jlouvel jlouvel merged commit 1d8ec62 into main Apr 1, 2026
3 checks passed
@jlouvel jlouvel deleted the fix/array-params-mustache-body-template branch April 1, 2026 20:03
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.

Array parameters are serialized as toString() in Mustache body templates, producing invalid JSON

2 participants