From 7110fd0ee9dc764606d0df5ccb43212555af64b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Mon, 4 Nov 2024 16:44:26 +0100 Subject: [PATCH] Use @JsonIgnore for unwrapping of notification-related config --- .../quarkus/github/lottery/config/LotteryConfig.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/quarkus/github/lottery/config/LotteryConfig.java b/src/main/java/io/quarkus/github/lottery/config/LotteryConfig.java index f7486df..cbddbc3 100644 --- a/src/main/java/io/quarkus/github/lottery/config/LotteryConfig.java +++ b/src/main/java/io/quarkus/github/lottery/config/LotteryConfig.java @@ -9,9 +9,11 @@ import java.util.TreeSet; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + import io.quarkus.runtime.annotations.RegisterForReflection; @RegisterForReflection(ignoreNested = false) // For deserialization from the GitHub repository @@ -36,7 +38,7 @@ public record Buckets( public record Triage( String label, - @JsonUnwrapped @JsonProperty(access = JsonProperty.Access.READ_ONLY) Notification notification) { + @JsonIgnore Notification notification) { // https://stackoverflow.com/a/71539100/6692043 // Also gives us a less verbose constructor for tests @JsonCreator @@ -56,7 +58,7 @@ public record Feedback( @JsonProperty(required = true) Provided provided) { public record Needed( - @JsonUnwrapped @JsonProperty(access = JsonProperty.Access.READ_ONLY) Notification notification) { + @JsonIgnore Notification notification) { // https://stackoverflow.com/a/71539100/6692043 // Also gives us a less verbose constructor for tests @JsonCreator @@ -67,7 +69,7 @@ public Needed(@JsonProperty(required = true) Duration delay, } public record Provided( - @JsonUnwrapped @JsonProperty(access = JsonProperty.Access.READ_ONLY) Notification notification) { + @JsonIgnore Notification notification) { // https://stackoverflow.com/a/71539100/6692043 // Also gives us a less verbose constructor for tests @JsonCreator @@ -114,7 +116,7 @@ public record Participant( public record Triage( @JsonDeserialize(as = TreeSet.class) Set days, - @JsonUnwrapped @JsonProperty(access = JsonProperty.Access.READ_ONLY) Participation participation) { + @JsonIgnore Participation participation) { // https://stackoverflow.com/a/71539100/6692043 @JsonCreator public Triage(@JsonProperty(required = true) Set days, @JsonProperty(required = true) int maxIssues) { @@ -136,7 +138,7 @@ public record Feedback( public record Stewardship( @JsonDeserialize(as = TreeSet.class) Set days, - @JsonUnwrapped @JsonProperty(access = JsonProperty.Access.READ_ONLY) Participation participation) { + @JsonIgnore Participation participation) { // https://stackoverflow.com/a/71539100/6692043 @JsonCreator public Stewardship(@JsonProperty(required = true) Set days,