Skip to content

Commit

Permalink
Use @JsonIgnore for unwrapping of notification-related config
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Nov 4, 2024
1 parent 79cc06b commit 7110fd0
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -114,7 +116,7 @@ public record Participant(

public record Triage(
@JsonDeserialize(as = TreeSet.class) Set<DayOfWeek> 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<DayOfWeek> days, @JsonProperty(required = true) int maxIssues) {
Expand All @@ -136,7 +138,7 @@ public record Feedback(

public record Stewardship(
@JsonDeserialize(as = TreeSet.class) Set<DayOfWeek> 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<DayOfWeek> days,
Expand Down

0 comments on commit 7110fd0

Please sign in to comment.