From 71e5b15ae51c9a0ec53cfaf4094d49caed28b669 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 9 Jul 2018 20:57:29 +0200 Subject: [PATCH] Excluded empty fields, during marshalling of error-messages --- .../facebook/errors/FacebookErrorMessage.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/de/juplo/facebook/errors/FacebookErrorMessage.java b/src/main/java/de/juplo/facebook/errors/FacebookErrorMessage.java index 495c665..f807bc7 100644 --- a/src/main/java/de/juplo/facebook/errors/FacebookErrorMessage.java +++ b/src/main/java/de/juplo/facebook/errors/FacebookErrorMessage.java @@ -1,6 +1,9 @@ package de.juplo.facebook.errors; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; @@ -23,20 +26,31 @@ import com.fasterxml.jackson.annotation.JsonRootName; "error_user_msg", "fbtrace_id" }) +@JsonIgnoreProperties(ignoreUnknown = true) public class FacebookErrorMessage { @JsonProperty("message") + @JsonInclude(NON_EMPTY) String message; @JsonProperty("type") + @JsonInclude(NON_EMPTY) String type; @JsonProperty("code") + @JsonInclude(NON_EMPTY) Integer code; @JsonProperty("error_subcode") + @JsonInclude(NON_EMPTY) Integer subCode; @JsonProperty("error_user_title") + @JsonInclude(NON_EMPTY) String userTitle; @JsonProperty("error_user_msg") + @JsonInclude(NON_EMPTY) String userMessage; @JsonProperty("fbtrace_id") + @JsonInclude(NON_EMPTY) String traceId; + @JsonProperty("is_transient") + @JsonInclude(NON_EMPTY) + Boolean isTransient; } -- 2.20.1