From 012c4b02e966c2ae7bdc767f6ad539da65726313 Mon Sep 17 00:00:00 2001 From: BernardoGiordano Date: Thu, 7 Mar 2024 10:57:43 +0100 Subject: [PATCH 1/3] Don't throw exception on unmapped property deserialization --- .../java/com/whatsapp/api/WhatsappApiServiceGenerator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java b/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java index a5907cdfd..e9690cfdc 100644 --- a/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java +++ b/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java @@ -32,7 +32,10 @@ public class WhatsappApiServiceGenerator { static OkHttpClient sharedClient; private static final Converter.Factory converterFactory = JacksonConverterFactory.create( - new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + new ObjectMapper() + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false) + .configure(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS, false) ); @SuppressWarnings("unchecked") From 78a9f280411823830a3bc38a11d51b098c17f0a0 Mon Sep 17 00:00:00 2001 From: BernardoGiordano Date: Fri, 8 Mar 2024 15:03:00 +0100 Subject: [PATCH 2/3] Gracefully handle deserialization error on unmapped FLOW Button type --- src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java b/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java index e9690cfdc..606688e9d 100644 --- a/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java +++ b/src/main/java/com/whatsapp/api/WhatsappApiServiceGenerator.java @@ -36,6 +36,7 @@ public class WhatsappApiServiceGenerator { .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS, false) + .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false) ); @SuppressWarnings("unchecked") From ff249b52bee09a6baea2cb6223a00d20fc64df27 Mon Sep 17 00:00:00 2001 From: BernardoGiordano Date: Wed, 13 Mar 2024 10:13:25 +0100 Subject: [PATCH 3/3] Expose Whatsapp API error details needed if handling SDK errors is necessary --- .../java/com/whatsapp/api/exception/WhatsappApiException.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/whatsapp/api/exception/WhatsappApiException.java b/src/main/java/com/whatsapp/api/exception/WhatsappApiException.java index f601507b7..1f32c712c 100644 --- a/src/main/java/com/whatsapp/api/exception/WhatsappApiException.java +++ b/src/main/java/com/whatsapp/api/exception/WhatsappApiException.java @@ -51,4 +51,8 @@ public String getMessage() { return super.getMessage(); } + public WhatsappApiError getError() { + return whatsappApiError; + } + }