feat(templating): parseJson block form, oracle-validated (G2c backfill)#59
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
G2c backfill —
parseJsonblock formAdds WireMock's block/assignment form of
parseJson:alongside the existing inline
{{parseJson request.body 'obj'}}.parseJsonhelper (a Handlebars.Net block helper) — the inline and block forms coexist and Handlebars dispatches on the leading#.{{{request.body}}}), then parsed into the named variable via a NewtonsoftJToken; 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_DataHelpersgreen (wholeG2StaticResponseTestsclass 9/9); build clean (0 warnings).Deferred (unchanged)
parseJsonon scalar JSON (Newtonsoft rendersTrue/False, nottrue/false) and multi-valueformDataindexing remain the G2c tail.Docs:
docs/parity/g2-response.md, roadmap G2c note updated.🤖 Generated with Claude Code