Skip to content

Commit

Permalink
Merge pull request #590 from milaboratory/undefined-inputs-in-render
Browse files Browse the repository at this point in the history
Fix undefined input handling in workflow-tengo render library
  • Loading branch information
dbolotin authored Feb 25, 2025
2 parents 5f5829f + cb18f69 commit 4baec5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/render-library-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@platforma-sdk/workflow-tengo": patch
---

Fix the render library implementation in workflow-tengo SDK to properly handle undefined inputs.
8 changes: 6 additions & 2 deletions sdk/workflow-tengo/src/render.lib.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ createUniversal := func(tpl, isEph, inputs, ...opts) {
// inputs input
inputsMap := isEph ? smart.ephemeralMapBuilder() : smart.mapBuilder()
for name, value in inputs {
inputsMap.add(name, value)
if !is_undefined(value) {
inputsMap.add(name, value)
}
}
for name, value in serviceInputs {
inputsMap.addService(name, value)
if !is_undefined(value) {
inputsMap.addService(name, value)
}
}

rbuilder.createInputField(tplutil.INPUTS_MAP_FIELD).set(inputsMap.build())
Expand Down

0 comments on commit 4baec5d

Please sign in to comment.