Skip to content

Commit b9a0c84

Browse files
jiangzhoPeter Toth
authored andcommitted
[SPARK-53430] Prevent unintended JSON serialization with @JsonIgnore
### What changes were proposed in this pull request? This PR adds JsonIgnore to helper methods in API to avoid unintentional serialization. ### Why are the changes needed? Some non-field heler methods in our API POJO classes can be unintentionally serialized as Jackson treat them as getters. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? CIs ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#304 from jiangzho/ignore. Authored-by: Zhou JIANG <[email protected]> Signed-off-by: Peter Toth <[email protected]>
1 parent d679321 commit b9a0c84

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spark-operator-api/src/main/java/org/apache/spark/k8s/operator/spec/ApplicationTolerations.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import java.time.Instant;
2323

24+
import com.fasterxml.jackson.annotation.JsonIgnore;
2425
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2526
import com.fasterxml.jackson.annotation.JsonInclude;
2627
import io.fabric8.generator.annotation.Default;
@@ -110,6 +111,7 @@ public boolean exceedRetainDurationAtInstant(
110111
* @return true if `resourceRetainDurationMillis` or `ttlAfterStopMillis` is set to non-negative
111112
* value
112113
*/
114+
@JsonIgnore
113115
public boolean isRetainDurationEnabled() {
114116
return resourceRetainDurationMillis >= 0L || ttlAfterStopMillis >= 0L;
115117
}
@@ -119,6 +121,7 @@ public boolean isRetainDurationEnabled() {
119121
*
120122
* @return true if `ttlAfterStopMillis` is set to non-negative value
121123
*/
124+
@JsonIgnore
122125
public boolean isTTLEnabled() {
123126
return ttlAfterStopMillis >= 0L;
124127
}

0 commit comments

Comments
 (0)