crowdin / crowdin-api-client-java

Java client library for Crowdin API
https://jitpack.io/#crowdin/crowdin-api-client-java
MIT License
65 stars 44 forks source link

WebhookApi.listWebhooks() throws HttpException #250

Open Marzuh opened 1 month ago

Marzuh commented 1 month ago

Actual: WebhookApi.listWebhooks() throws HttpException

Error message: HttpException.Error(code=null, message=Cannot deserialize value of type java.util.LinkedHashMap<java.lang.String,java.lang.String> from Array value (token JsonToken.START_ARRAY) at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 212] (through reference chain: com.crowdin.client.webhooks.model.WebhookResponseList["data"]->java.util.ArrayList[0]->com.crowdin.client.webhooks.model.WebhookResponseObject["data"]->com.crowdin.client.webhooks.model.Webhook["headers"]))

Expected: WebhookApi.listWebhooks() returns ResponseList

Up to me its looks loike mapping error. If I change in WebHookApi.java:45 WebhookResponseList webhookResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/webhooks", new HttpRequestConfig(queryParams), WebhookResponseList.class); to WebhookResponseList webhookResponseList = this.httpClient.get(this.url + "/projects/" + projectId + "/webhooks", new HttpRequestConfig(queryParams), Object.class); there is no exception threw.

Marzuh commented 1 month ago

Screenshot 2024-07-12 at 11 47 10

Marzuh commented 1 month ago

How to reproduce: Setup at least one webhook in crowndin without any headers. If all webhooks have not empty headers then no exception.