Skip to content

Commit 65aa760

Browse files
committed
fix: fix dynamic properties
1 parent 1d9e02e commit 65aa760

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/io/kestra/plugin/jira/issues/CreateComment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class CreateComment extends JiraTemplate {
6868
@NotBlank
6969
protected String body;
7070

71+
@SuppressWarnings("unchecked")
7172
@Override
7273
public VoidOutput run(RunContext runContext) throws Exception {
7374
this.templateUri = Property.of("comment-jira-template.peb");

src/main/java/io/kestra/plugin/jira/issues/UpdateFields.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.util.Map;
2424
import java.util.Objects;
25+
import java.util.Optional;
2526

2627
@SuperBuilder
2728
@ToString
@@ -77,13 +78,17 @@ public VoidOutput run(RunContext runContext) throws Exception {
7778
this.templateUri = Property.of("update-field-template.peb");
7879
this.baseUrl += JiraUtil.ISSUE_API_ROUTE + runContext.render(this.issueIdOrKey);
7980

81+
String templateUri = runContext.render(this.templateUri)
82+
.as(String.class)
83+
.orElseThrow(() -> new IllegalArgumentException("Invalid templateUri: " + this.templateUri));
84+
8085
String template = IOUtils.toString(
81-
Objects.requireNonNull(this.getClass().getClassLoader().getResourceAsStream(runContext.render(this.templateUri, String.class))),
86+
Objects.requireNonNull(this.getClass().getClassLoader().getResourceAsStream(templateUri)),
8287
Charsets.UTF_8
8388
);
8489

8590
String render = runContext.render(
86-
template, Map.of("fields", this.fields.asMap(runContext, String.class, Object.class))
91+
template, Map.of("fields", runContext.render(this.fields).asMap(String.class, Object.class))
8792
);
8893

8994
Map<String, Object> body = mapper.readValue(render, new TypeReference<>() {});

0 commit comments

Comments
 (0)