crowdin / crowdin-api-client-dotnet

.NET client library for Crowdin API
https://www.nuget.org/packages/Crowdin.Api/
MIT License
53 stars 26 forks source link

Webhook responses are not deserialized correctly #176

Closed bZverok closed 1 year ago

bZverok commented 1 year ago

Everytime I invoke methods that receive webhook info (addWebhook, listWebhooks, etc. ) it throws an exception(see screenshot below). It occurs with organizationWebhooks and webhooks. I suppose that it has something to do with the Headers property

зображення

innomaxx commented 1 year ago

@bZverok could you please provide more details? Request parameters, JSON body (for POST/PATCH endpoints), raw response from API, etc

bZverok commented 1 year ago

Here is how I use sdk: зображення

bZverok commented 1 year ago

Here is the request: зображення

bZverok commented 1 year ago

It is also weird that OrganizationWebhooksApiExecutor is not a part of CrowdinApiClient, so that I need to create its instance manually

innomaxx commented 1 year ago

Here is the request: зображення

Thanks for clarifications. I see the issue : API returns headers as JSON Array instead of JSON Object. Seems like it should be fixed on backend side or handled in SDK. We will discuss this moment asap

innomaxx commented 1 year ago

It is also weird that OrganizationWebhooksApiExecutor is not a part of CrowdinApiClient, so that I need to create its instance manually

It's an issue, we will fix it. Thanks for mentioning this.

innomaxx commented 1 year ago

@andrii-bodnar @bZverok #180. It's probably temporary solution. Now it applied specifically to Headers property. The custom converter I implemented also can be added to any property with the same deserialization issue. I also added test case with sample broken json response to check the algorithm

bZverok commented 1 year ago

Glad to hear that! Looking forward to seeing this update on a nuget

andrii-bodnar commented 1 year ago

@bZverok available in 2.16.0