blockfrost / blockfrost-java

Java SDK for the Blockfrost.io API.
Apache License 2.0
11 stars 10 forks source link

Specific asset service returns multiple MismatchedInputException(s) #2

Open MarkBlythe opened 2 years ago

MarkBlythe commented 2 years ago

I have started building an application in Spring Boot and have written a couple of services that use the Blockfrost API with no issue however the AssetService getAsset method returns:

[Request processing failed; nested exception is io.blockfrost.sdk.api.exception.APIException: Error getting asset] with root cause

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 539] (through reference chain: io.blockfrost.sdk.api.model.Asset["onchain_metadata"]->java.util.LinkedHashMap["files"])
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.13.1.jar:2.13.1]

on some of the assets and also this on others:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 576] (through reference chain: io.blockfrost.sdk.api.model.Asset["onchain_metadata"]->java.util.LinkedHashMap["attributes"])

To get to this stage I have followed the docs to do the following:

Use the AddressService to get the asset <Lovelace or concatenation of asset policy_id and hex-encoded asset_name> from one of the unit keys in the response.

Then tried to pass that as the asset following the examples here: https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}/get

I believe that the asset returned by the address query is the exact same asset required by the asset endpoint but please let me know if I've misunderstood.

bentaye commented 2 years ago

It seems to me that this is the same issue as https://github.com/blockfrost/blockfrost-java/issues/3 Some fields of the onchain_metadata object are not Strings