π Bug Report: [Android SDK] Serialization Engine
SebastianTMo opened this issue Β· comments
π Reproduction steps
When using a serialization engine other than Gson in your app (for example KotlinXSerialization) the annotations to your data classes are not recognised by the Gson serialization engine used by the SDK.
π Expected behavior
Propper object parsing.
I think the best solution for this problem might be choosing the serialization engine beforehand but happy to hear your oppinions on this one.
π Actual Behavior
The problem occures when casting RealtimeResponseEvents.payload
within the subscribe
-functions (using the payloadType
parameter). The SDK will try to cast the payload
-object using Gson and will fail for $id
and $permission
(as you need to annotate them propperly to be parsed due to the $-sign). This will also occur, when your data class parameter names will differ from the parameter names in the json-String.
Current Workaround:
Double-Annotation of the problematic parameters.
π² Appwrite version
Version 0.11.x
π» Operating system
Linux
𧱠Your Environment
No response
π Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
π’ Have you read the Code of Conduct?
- I have read the Code of Conduct
@abnegate please take a look at this
Cases where serialization failed ($id
and $permission
etc.) is fixed in version 0.3.3 π
It is a little harder to solve for cases where data class parameter names do not match JSON names - switching to a different library would result in the same problem for developers using any other library, and including multiple would bloat the SDK. I will close this as the bug is fixed but will investigate how to provide better support for other serializers.