Skip to content

Commit 31bfa7f

Browse files
authored
feat: add @PluginProperty group annotations from taxonomy (#74)
Co-authored-by: François Delbrayelle <fdelbrayelle@kestra.io>
1 parent ea92955 commit 31bfa7f

13 files changed

Lines changed: 65 additions & 3 deletions

File tree

plugin-transform-grok/src/main/java/io/kestra/plugin/transform/grok/GrokInterface.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,47 @@
55

66
import java.util.List;
77
import java.util.Map;
8+
import io.kestra.core.models.annotations.PluginProperty;
89

910
public interface GrokInterface {
1011

1112
@Schema(title = "The Grok pattern to match.")
13+
@PluginProperty(group = "advanced")
1214
Property<String> getPattern();
1315

1416
@Schema(title = "The list of Grok patterns to match.")
17+
@PluginProperty(group = "advanced")
1518
Property<List<String>> getPatterns();
1619

1720
@Schema(
1821
title = "List of user-defined pattern directories.",
1922
description = "Directories must be paths relative to the working directory."
2023
)
24+
@PluginProperty(group = "advanced")
2125
Property<List<String>> getPatternsDir();
2226

2327
@Schema(
2428
title = "Custom pattern definitions.",
2529
description = "A map of pattern-name and pattern pairs defining custom patterns to be used by the current tasks. Patterns matching existing names will override the pre-existing definition. "
2630
)
31+
@PluginProperty(group = "advanced")
2732
Property<Map<String, String>> getPatternDefinitions();
2833

2934
@Schema(title = "If `true`, only store named captures from grok.")
35+
@PluginProperty(group = "advanced")
3036
Property<Boolean> getNamedCapturesOnly();
3137

3238
@Schema(
3339
title = "If `true`, break on first match.",
3440
description = "The first successful match by grok will result in the task being finished. Set to `false` if you want the task to try all configured patterns."
3541
)
42+
@PluginProperty(group = "advanced")
3643
Property<Boolean> getBreakOnFirstMatch();
3744

3845
@Schema(
3946
title = "If `true`, keep empty captures.",
4047
description = "When an optional field cannot be captured, the empty field is retained in the output. Set `false` if you want empty optional fields to be filtered out."
4148
)
49+
@PluginProperty(group = "advanced")
4250
Property<Boolean> getKeepEmptyCaptures();
4351
}

plugin-transform-grok/src/main/java/io/kestra/plugin/transform/grok/TransformItems.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class TransformItems extends Transform implements GrokInterface, Runnable
7676
description = "Must be a `kestra://` internal storage URI."
7777
)
7878
@NotNull
79-
@PluginProperty(internalStorageURI = true)
79+
@PluginProperty(internalStorageURI = true, group = "main")
8080
private Property<String> from;
8181

8282
/**

plugin-transform-grok/src/main/java/io/kestra/plugin/transform/grok/TransformValue.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.nio.charset.StandardCharsets;
2121
import java.util.Map;
22+
import io.kestra.core.models.annotations.PluginProperty;
2223

2324
@SuperBuilder
2425
@ToString
@@ -76,6 +77,7 @@ public class TransformValue extends Transform implements GrokInterface, Runnable
7677

7778
@Schema(title = "The value to parse.")
7879
@NotNull
80+
@PluginProperty(group = "main")
7981
private Property<String> from;
8082

8183
/**

plugin-transform-json/src/main/java/io/kestra/plugin/transform/jsonata/JSONataInterface.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ public interface JSONataInterface {
99

1010
@Schema(title = "The JSONata expression to apply on the JSON object.")
1111
@NotNull
12+
@PluginProperty(group = "main")
1213
Property<String> getExpression();
1314

1415
@Schema(title = "The maximum number of recursive calls allowed for the JSONata transformation.")
1516
@NotNull
17+
@PluginProperty(group = "main")
1618
Property<Integer> getMaxDepth();
1719
}

plugin-transform-json/src/main/java/io/kestra/plugin/transform/jsonata/Transform.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public abstract class Transform<T extends Output> extends Task implements JSONat
3333

3434
private static final ObjectMapper MAPPER = JacksonMapper.ofJson();
3535

36-
@PluginProperty(language = MonacoLanguages.JAVASCRIPT)
36+
@PluginProperty(language = MonacoLanguages.JAVASCRIPT, group = "advanced")
3737
private Property<String> expression;
3838

3939
@Builder.Default

plugin-transform-json/src/main/java/io/kestra/plugin/transform/jsonata/TransformItems.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class TransformItems extends Transform<TransformItems.Output> implements
100100
description = "Must be a `kestra://` internal storage URI."
101101
)
102102
@NotNull
103-
@PluginProperty(internalStorageURI = true)
103+
@PluginProperty(internalStorageURI = true, group = "main")
104104
private Property<String> from;
105105

106106
@Schema(
@@ -109,6 +109,7 @@ public class TransformItems extends Transform<TransformItems.Output> implements
109109
)
110110
@NotNull
111111
@Builder.Default
112+
@PluginProperty(group = "advanced")
112113
private Property<Boolean> explodeArray = Property.ofValue(true);
113114

114115
/**

plugin-transform-json/src/main/java/io/kestra/plugin/transform/jsonata/TransformValue.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public class TransformValue extends Transform<TransformValue.Output> implements
9090
description = "Must be a valid JSON string."
9191
)
9292
@NotNull
93+
@PluginProperty(group = "main")
9394
private Property<String> from;
9495

9596

plugin-transform-records/src/main/java/io/kestra/plugin/transform/Aggregate.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import java.util.Objects;
4848
import java.util.Locale;
4949
import java.util.UUID;
50+
import io.kestra.core.models.annotations.PluginProperty;
5051

5152
@SuperBuilder
5253
@ToString
@@ -154,6 +155,7 @@ private static BigDecimal normalizedAverage(BigDecimal total, long count) {
154155
Ion list or struct to transform, or a storage URI pointing to an Ion file.
155156
"""
156157
)
158+
@PluginProperty(group = "main")
157159
private Property<Object> from;
158160

159161
@NotNull
@@ -163,6 +165,7 @@ private static BigDecimal normalizedAverage(BigDecimal total, long count) {
163165
Fields to group on.
164166
"""
165167
)
168+
@PluginProperty(group = "main")
166169
private Property<List<String>> groupBy;
167170

168171
@NotNull
@@ -173,6 +176,7 @@ private static BigDecimal normalizedAverage(BigDecimal total, long count) {
173176
Each value can be a shorthand expression string or an object with expr and optional type.
174177
"""
175178
)
179+
@PluginProperty(group = "main")
176180
private Property<Map<String, AggregateDefinition>> aggregates;
177181

178182
@Builder.Default
@@ -191,6 +195,7 @@ private static BigDecimal normalizedAverage(BigDecimal total, long count) {
191195
Experimental: TEXT or BINARY. Only transform tasks can read binary Ion. Use TEXT as the final step.
192196
"""
193197
)
198+
@PluginProperty(group = "processing")
194199
private Property<OutputFormat> outputFormat = Property.ofValue(OutputFormat.TEXT);
195200

196201
@Schema(
@@ -200,6 +205,7 @@ private static BigDecimal normalizedAverage(BigDecimal total, long count) {
200205
"""
201206
)
202207
@Builder.Default
208+
@PluginProperty(group = "advanced")
203209
private Property<OutputMode> outputType = Property.ofValue(OutputMode.AUTO);
204210

205211
@Override
@@ -543,6 +549,7 @@ public static class AggregateDefinition {
543549
Supported forms are count(), sum(path), min(path), max(path), avg(path), first(path), and last(path).
544550
"""
545551
)
552+
@PluginProperty(group = "advanced")
546553
private String expr;
547554

548555
@Schema(
@@ -551,6 +558,7 @@ Supported forms are count(), sum(path), min(path), max(path), avg(path), first(p
551558
Optional type to cast the aggregate result to before writing the output field.
552559
"""
553560
)
561+
@PluginProperty(group = "advanced")
554562
private IonTypeName type;
555563

556564
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)

plugin-transform-records/src/main/java/io/kestra/plugin/transform/Filter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.Locale;
4040
import java.util.Map;
4141
import java.util.UUID;
42+
import io.kestra.core.models.annotations.PluginProperty;
4243

4344
@SuperBuilder
4445
@ToString
@@ -95,6 +96,7 @@ public class Filter extends Task implements RunnableTask<Filter.Output> {
9596
Ion list or struct to transform, or a storage URI pointing to an Ion file.
9697
"""
9798
)
99+
@PluginProperty(group = "main")
98100
private Property<Object> from;
99101

100102
@NotNull
@@ -104,6 +106,7 @@ public class Filter extends Task implements RunnableTask<Filter.Output> {
104106
Expression evaluated on each record and required to return true or false.
105107
"""
106108
)
109+
@PluginProperty(group = "main")
107110
private Property<String> where;
108111

109112
@Builder.Default
@@ -113,6 +116,7 @@ public class Filter extends Task implements RunnableTask<Filter.Output> {
113116
FAIL stops the task on expression errors, SKIP drops the current record, and KEEP emits the original record when the filter expression fails.
114117
"""
115118
)
119+
@PluginProperty(group = "advanced")
116120
private Property<OnErrorMode> onError = Property.ofValue(OnErrorMode.FAIL);
117121

118122
@Builder.Default
@@ -122,6 +126,7 @@ public class Filter extends Task implements RunnableTask<Filter.Output> {
122126
Experimental: TEXT or BINARY. Only transform tasks can read binary Ion. Use TEXT as the final step.
123127
"""
124128
)
129+
@PluginProperty(group = "processing")
125130
private Property<OutputFormat> outputFormat = Property.ofValue(OutputFormat.TEXT);
126131

127132
@Schema(
@@ -131,6 +136,7 @@ public class Filter extends Task implements RunnableTask<Filter.Output> {
131136
"""
132137
)
133138
@Builder.Default
139+
@PluginProperty(group = "advanced")
134140
private Property<OutputMode> outputType = Property.ofValue(OutputMode.AUTO);
135141

136142
@Override

plugin-transform-records/src/main/java/io/kestra/plugin/transform/Map.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import java.util.Map.Entry;
4848
import java.util.Objects;
4949
import java.util.UUID;
50+
import io.kestra.core.models.annotations.PluginProperty;
5051

5152
@SuperBuilder
5253
@ToString
@@ -178,6 +179,7 @@ public class Map extends Task implements RunnableTask<Map.Output> {
178179
Ion list or struct to transform, or a storage URI pointing to an Ion file.
179180
"""
180181
)
182+
@PluginProperty(group = "main")
181183
private Property<Object> from;
182184

183185
@NotNull
@@ -197,6 +199,7 @@ public class Map extends Task implements RunnableTask<Map.Output> {
197199
Keeps input fields not explicitly mapped. If you map a_new: a, the original a is still kept.
198200
"""
199201
)
202+
@PluginProperty(group = "advanced")
200203
private Property<Boolean> keepOriginalFields = Property.ofValue(false);
201204

202205
@Builder.Default
@@ -206,6 +209,7 @@ public class Map extends Task implements RunnableTask<Map.Output> {
206209
Omits output fields whose final value is null after mapping.
207210
"""
208211
)
212+
@PluginProperty(group = "advanced")
209213
private Property<Boolean> dropNulls = Property.ofValue(true);
210214

211215
@Builder.Default
@@ -224,6 +228,7 @@ public class Map extends Task implements RunnableTask<Map.Output> {
224228
Experimental: TEXT or BINARY. Only transform tasks can read binary Ion. Use TEXT as the final step.
225229
"""
226230
)
231+
@PluginProperty(group = "processing")
227232
private Property<OutputFormat> outputFormat = Property.ofValue(OutputFormat.TEXT);
228233

229234
@Schema(
@@ -233,6 +238,7 @@ public class Map extends Task implements RunnableTask<Map.Output> {
233238
"""
234239
)
235240
@Builder.Default
241+
@PluginProperty(group = "advanced")
236242
private Property<OutputMode> outputType = Property.ofValue(OutputMode.AUTO);
237243

238244
@Override
@@ -470,6 +476,7 @@ public static class FieldDefinition {
470476
Per-record expression used to compute the output field value.
471477
"""
472478
)
479+
@PluginProperty(group = "advanced")
473480
private String expr;
474481

475482
@Schema(
@@ -478,6 +485,7 @@ public static class FieldDefinition {
478485
Optional type to cast the evaluated value to before writing the output field.
479486
"""
480487
)
488+
@PluginProperty(group = "advanced")
481489
private IonTypeName type;
482490

483491
@Builder.Default
@@ -488,6 +496,7 @@ public static class FieldDefinition {
488496
Expression and cast errors are still handled by onError.
489497
"""
490498
)
499+
@PluginProperty(group = "advanced")
491500
private boolean optional = false;
492501

493502
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)

0 commit comments

Comments
 (0)