Open
Conversation
tusharmndr
reviewed
Feb 17, 2026
| template(titleTemplate), | ||
| template(descriptionTemplate), | ||
| template(subjectTemplate)) | ||
| templateHandlebars(subjectTemplate)) |
Contributor
There was a problem hiding this comment.
Should not hardcode to Handlebarstemplate for subject, e should take this as input from the UI and ensure that the default value can be STRING_SUBSTITUTION itself for backward compatibility.
tusharmndr
reviewed
Feb 17, 2026
| public Optional<String> evaluate(Template template, JsonNode payload) { | ||
| return Optional.of(StringSubstitutor.replace( | ||
| template.getTemplate(), mapper.convertValue(payload, new TypeReference<Map<String, String>>() {}))); | ||
| template.getTemplate(), mapper.convertValue(payload, new TypeReference<Map<String, Object>>() {}))); |
Contributor
There was a problem hiding this comment.
Un-related changes, handle it in separate issue & PR
tusharmndr
reviewed
Feb 17, 2026
| return mapper.readValue(s, clazz); | ||
| } catch (Exception e) { | ||
| throw new RuntimeException("Failed to parse substituted string to object", e); | ||
| } |
Contributor
There was a problem hiding this comment.
Should be conductor exception
tusharmndr
reviewed
Feb 17, 2026
| """); | ||
| String result = evaluator.evaluate(template, payload).orElse(null); | ||
| assert result != null; | ||
| assert result.equals("Hello Alice, your age is 30, you live in ${place.name}"); |
Contributor
There was a problem hiding this comment.
is this expected i.e ${place.name} not replaced ?
Tushar-Naik
reviewed
Feb 17, 2026
| public String valueFromJson(Object context, Options options) { | ||
| val node = MAPPER.valueToTree(context); | ||
| val pointer = (String) options.hash(POINTER); | ||
| if (!Strings.isNullOrEmpty(pointer) ) { |
There was a problem hiding this comment.
Null check on node missing, similar to other methods in the helper
Suggestion:
if (!Strings.isNullOrEmpty(pointer) && null != node && !node.isNull() && !node.isMissingNode()) {
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.
This pull request introduces enhancements to the template engine system to support additional template evaluation capabilities and improve type handling.
Changes
Bug fix and features
HandlebarsObjectTemplateEvaluatorto support Handlebars template evaluation to return object type. The existing evaluator returned String and subjectId template expected an object (bug).valueFromJson()helper method inCustomHelpersto extract string values from JSON objects. The existingvalueFromJsonStringmethod expects String input rather than JsonNode.Improvements
StringSubstitutionTextTemplateEvaluatorto useMap<String, Object>instead ofMap<String, String>to support nested json payload. The existing implementation was breaking with nested payloads.Test Coverage