From 91fb01bf3e2d809d761378268a74a7cedf26f9b3 Mon Sep 17 00:00:00 2001 From: Guillaume Poirier-Morency Date: Mon, 7 Jun 2021 11:27:36 -0700 Subject: [PATCH] Add JsonIgnorePropreties annotation to fix deserialization (fix #85) Use JsonIgnoreProperties on all models consumed by the RemoteResourceService implementation. The 1.3 series does not use spring-provided ObjectMapper, so setting the property in application.properties does not fix the underlying issue. --- src/main/java/ubc/pavlab/rdp/model/User.java | 2 ++ src/main/java/ubc/pavlab/rdp/model/UserGene.java | 2 ++ src/main/java/ubc/pavlab/rdp/model/UserTerm.java | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/main/java/ubc/pavlab/rdp/model/User.java b/src/main/java/ubc/pavlab/rdp/model/User.java index d91f0f32..9f0d3e06 100644 --- a/src/main/java/ubc/pavlab/rdp/model/User.java +++ b/src/main/java/ubc/pavlab/rdp/model/User.java @@ -1,6 +1,7 @@ package ubc.pavlab.rdp.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonUnwrapped; import lombok.*; import org.hibernate.annotations.CacheConcurrencyStrategy; @@ -26,6 +27,7 @@ @NoArgsConstructor @EqualsAndHashCode(of = {"id"}) @ToString( of = {"id", "email", "enabled"}) +@JsonIgnoreProperties(ignoreUnknown = true) public class User{ @Id diff --git a/src/main/java/ubc/pavlab/rdp/model/UserGene.java b/src/main/java/ubc/pavlab/rdp/model/UserGene.java index 372d758e..07c0d245 100644 --- a/src/main/java/ubc/pavlab/rdp/model/UserGene.java +++ b/src/main/java/ubc/pavlab/rdp/model/UserGene.java @@ -1,6 +1,7 @@ package ubc.pavlab.rdp.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -25,6 +26,7 @@ @Setter @NoArgsConstructor @ToString(callSuper = true) +@JsonIgnoreProperties(ignoreUnknown = true) public class UserGene extends Gene { @Id diff --git a/src/main/java/ubc/pavlab/rdp/model/UserTerm.java b/src/main/java/ubc/pavlab/rdp/model/UserTerm.java index b245d558..66323472 100644 --- a/src/main/java/ubc/pavlab/rdp/model/UserTerm.java +++ b/src/main/java/ubc/pavlab/rdp/model/UserTerm.java @@ -1,6 +1,7 @@ package ubc.pavlab.rdp.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -23,6 +24,7 @@ @Getter @Setter @NoArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) public class UserTerm extends GeneOntologyTerm { @Id