Skip to content

feat(templating): parseJson block form, oracle-validated (G2c backfill)#59

Merged
omercelikdev merged 1 commit into
feat/g15c-multi-domainfrom
feat/parseJson-block
Jul 5, 2026
Merged

feat(templating): parseJson block form, oracle-validated (G2c backfill)#59
omercelikdev merged 1 commit into
feat/g15c-multi-domainfrom
feat/parseJson-block

Conversation

@omercelikdev

Copy link
Copy Markdown
Owner

G2c backfill — parseJson block form

Adds WireMock's block/assignment form of parseJson:

{{#parseJson 'obj'}}{{{request.body}}}{{/parseJson}}{{obj.name}}

alongside the existing inline {{parseJson request.body 'obj'}}.

  • Registered as a second parseJson helper (a Handlebars.Net block helper) — the inline and block forms coexist and Handlebars dispatches on the leading #.
  • The block body is rendered first (so it can itself be templated — e.g. {{{request.body}}}), then parsed into the named variable via a Newtonsoft JToken; the block itself renders nothing.

Validation

Byte-diffed against the Java WireMock oracle for two scenarios: a literal-JSON block and a templated block (proving rendered-then-parsed order). Templating_DataHelpers green (whole G2StaticResponseTests class 9/9); build clean (0 warnings).

Deferred (unchanged)

parseJson on scalar JSON (Newtonsoft renders True/False, not true/false) and multi-value formData indexing remain the G2c tail.

Docs: docs/parity/g2-response.md, roadmap G2c note updated.

Stacked on #58 (G15c). Base retargets down the stack as each merges.

🤖 Generated with Claude Code

Adds WireMock's `{{#parseJson 'var'}}<json>{{/parseJson}}` block/assignment
form alongside the existing inline `{{parseJson body 'var'}}`. Registered as a
second `parseJson` helper (a Handlebars.Net block helper); the two coexist and
Handlebars dispatches on the `#`. The block body is rendered first — so it may
itself be templated (e.g. `{{{request.body}}}`) — then parsed into the named
variable via a Newtonsoft JToken, and the block renders nothing.

Byte-diffed against the oracle for both a literal-JSON block and a templated
block (rendered-then-parsed confirmed). Differential Templating_DataHelpers
green (9/9 in the class); build clean. `parseJson` on scalar JSON and
multi-value formData indexing remain the deferred G2c tail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omercelikdev omercelikdev merged commit 46c33d6 into feat/g15c-multi-domain Jul 5, 2026
2 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.

1 participant