Skip to content

Commit

Permalink
fix: Ensure strict typing for input defaults to prevent runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Malaydewangan09 committed Oct 22, 2024
1 parent b399907 commit 251e361
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/core/models/flows/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public abstract class Input<T> implements Data {
@Schema(
title = "The default value to use if no value is specified."
)
Object defaults;
T defaults;

@Schema(
title = "The display name of the input."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ private Object parseType(Execution execution, Type type, String id, Type element
case FLOAT -> current instanceof Float ? current : Float.valueOf(current.toString());
case BOOLEAN -> current instanceof Boolean ? current : Boolean.valueOf((String) current);
case DATETIME -> Instant.parse(((String) current));
case DATE -> LocalDate.parse(((String) current));
case TIME -> LocalTime.parse(((String) current));
case DATE -> current instanceof LocalDate ? current : LocalDate.parse(((String) current));
case TIME -> current instanceof LocalTime ? current : LocalTime.parse(((String) current));
case DURATION -> Duration.parse(((String) current));
case FILE -> {
URI uri = URI.create(((String) current).replace(File.separator, "/"));
Expand Down

0 comments on commit 251e361

Please sign in to comment.