feat: support flow label values to be of data types different than string
What changes are being made and why?
Allow flow label values to accept data types such as int, float, and boolean, in addition to strings. Complex data types, such as lists and maps, remain unsupported as label values. This change improves label flexibility and serialization while maintaining simple data type compatibility.
closes #5707
Yes, I'll add the test cases. Thanks!
@loicmathieu Given that I modified the label deserializer, Is it reasonable to include a test case such as this?
@Test
void shouldHandleNonStringLabelValues() {
Flow flow = Flow.builder()
.labels(List.of(
new Label("intLabel", "42"),
new Label("boolLabel", "true"),
new Label("floatLabel", "3.14"),
new Label(Label.SYSTEM_PREFIX + "intSystemLabel", "100")
))
.build();
assertThat(labels, hasSize(3));
assertThat(labels, hasItems(
new Label("intLabel", "42"),
new Label("boolLabel", "true"),
new Label("floatLabel", "3.14")
));
Here that we are again passing strings only?
@Malaydewangan09 I'm not sure your test do anything. The best would be to:
- update the RuntimeLabelTest to use a label with a primitive type.
- Add a label to an existing flow in https://github.com/kestra-io/kestra/tree/develop/core/src/test/resources/flows/valids and either assert in an existing test that uses this flow or create a new test.
Got it Thanks!