Skip to content

Commit

Permalink
fix(core): deprecate listeners
Browse files Browse the repository at this point in the history
closes #1409
  • Loading branch information
brian-mulier-p committed Sep 4, 2023
1 parent 8fba5ee commit e6aa237
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/io/kestra/core/models/flows/Flow.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public boolean hasIgnoreMarker(final AnnotatedMember m) {
List<Task> errors;

@Valid
@Deprecated
List<Listener> listeners;

@Valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private Stream<String> deprecationTraversal(String prefix, Object object) {
}

return Stream.concat(
method.isAnnotationPresent(Deprecated.class) && fieldValue != null ? Stream.of(prefix + "." + fieldName) : Stream.empty(),
method.isAnnotationPresent(Deprecated.class) && fieldValue != null ? Stream.of(prefix.isEmpty() ? fieldName : prefix + "." + fieldName) : Stream.empty(),
additionalDeprecationPaths
);
} catch (IllegalAccessException | InvocationTargetException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ void validateFlows() throws IOException {

List<ValidateConstraintViolation> body = response.body();
assertThat(body.size(), is(2));
assertThat(body.get(0).getDeprecationPaths(), hasSize(2));
assertThat(body.get(0).getDeprecationPaths(), containsInAnyOrder("tasks[1]", "tasks[1].additionalProperty"));
assertThat(body.get(0).getDeprecationPaths(), hasSize(3));
assertThat(body.get(0).getDeprecationPaths(), containsInAnyOrder("tasks[1]", "tasks[1].additionalProperty", "listeners"));
assertThat(body.get(1).getDeprecationPaths(), empty());
assertThat(body, everyItem(
Matchers.hasProperty("constraints", is(nullValue()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ tasks:
- id: deprecated_task
type: io.kestra.core.plugins.test.DeprecatedTask
additionalProperty: "value"
listeners:
- tasks:
- id: log
type: io.kestra.core.tasks.log.Log
message: logging

---

Expand Down

0 comments on commit e6aa237

Please sign in to comment.