bunq / sdk_java

Java SDK for bunq API
MIT License
49 stars 23 forks source link

Serialization Error #71

Closed ChappIO closed 6 years ago

ChappIO commented 6 years ago

Steps to reproduce:

  1. Make sure you have a geolocated payment on your account
  2. Request a list of Payments

What should happen:

  1. The list is returned

What happens:

  1. A serialization error occurs

Traceback

SDK version and environment

Response id

Extra info:

Currently com.bunq.sdk.model.generated.object.Geolocation has three BigDecimal fields. However, there seems to be a mismatch. If you take a look at com.bunq.sdk.json.BigDecimalTypeAdapter it reads a BigDecimal from type String. Yet the api returns a value of type number.

I did not make the pull request myself because I don't know which fix you'd like me to make. I see a few options:

  1. Make sure the API returns a String. However, this is probably extremely impactful as it is a breaking api change.
  2. Revert the if statement in com.bunq.sdk.json.BigDecimalTypeAdapter so it becomes
         if (input.peek() == JsonToken.NULL) {
            input.nextNull();
            return null;
        } else {
            return new BigDecimal(input.nextString());
        }
  3. Have Geolocation use Doubles instead of BigIntegers

My personal preference would go to option 2 since in my opinion it is a more resilient solution. I am willing to make the pull request myself. Just give me your decision.

ChappIO commented 6 years ago

My apologies, I just noticed this was already fixed in a way quite similar to option 2. I will build application using the develop branch for now and wait for the official release.

OGKevin commented 6 years ago

Hey ChappIO,

This is indeed a duplicate of bunq/sdk_java#46 and will be fixed in the 0.12.5 release.

Im hoping to release it beginning next week after fixing bunq/sdk_java#25.

ChappIO commented 6 years ago

@OGKevin thank you very much. I won't finish my application by then anyway, so I will upgrade after the release :)