datastax / astra-db-java

Java Client for DataStax Astra DB and the Data API
https://datastaxdevs.github.io/astra-db-java/latest/
Apache License 2.0
11 stars 3 forks source link

Incomplete handling in `UUIDDeserializer` (need to support "plain" UUIDs in some cases) #25

Open tatu-at-datastax opened 11 hours ago

tatu-at-datastax commented 11 hours ago

So: with 2.0.0-SNAPSHOT, handling of a failed command triggers an exception due to UUID deserialization of DataAPIErrorDescriptor (via APIException etc) fails. This is because UUIDDeserializer only handles EJSON-wrapped UUID case like:

{ "$uuid": "c9172c7a-3dd7-41d9-aa53-8d5361c660d9" }

so you get

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Cannot convert the expression as an UUID "c9172c7a-3dd7-41d9-aa53-8d5361c660d9" (through reference chain: com.datastax.astra.internal.api.DataAPIResponse["errors"]->java.util.ArrayList[0])

Since Data API uses "plain" UUID in many places, I think it is necessary for deserializer to allow either. I can try to provide a PR -- I verified handling works with extended deserializer.