You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use a custom scalar type but normalisation inside SqlNormalizedCache fails with the following error inside RecordFieldJsonAdapter
RuntimeException: Unsupported record value type: class java.util.LinkedHashMap
The data it's trying to parse is a mixed json array, and we are serialising it as a string using CustomTypeAdapters. However, RecordFieldJsonAdapter used by SqlNormalizedCache does not use custom type adapters and tries to serialise it as a LinkedHashMap.
This byline has a custom scalar type defined in the schema and being parsed as a string. We don't want to use strict types on this object as it's highly volatile. Is there a way to customize json serialisation? Am I missing something in the schema?
The text was updated successfully, but these errors were encountered:
If you register custom type adapter com.apollographql.apollo.response.CustomTypeAdapter in T decode(@NotNull CustomTypeValue value) you will get com.apollographql.apollo.response.CustomTypeValue.GraphQLJsonString that is JSON string.
Then it's up to you to define how to parse it and convert to custom type you want.
That's exactly what I'm doing, and apollo is able to parse it as a string.
The problem occurs when apollo tries to persist this data using the SqlNormalizedCache. So, my guess is apollo is not using the custom type adapters while trying to serialise data for persistence.
Using apollo-android 0.5.0
Trying to use a custom scalar type but normalisation inside SqlNormalizedCache fails with the following error inside
RecordFieldJsonAdapter
The data it's trying to parse is a mixed json array, and we are serialising it as a string using CustomTypeAdapters. However, RecordFieldJsonAdapter used by SqlNormalizedCache does not use custom type adapters and tries to serialise it as a LinkedHashMap.
Here is a sample from our json:
This
byline
has a custom scalar type defined in the schema and being parsed as a string. We don't want to use strict types on this object as it's highly volatile. Is there a way to customize json serialisation? Am I missing something in the schema?The text was updated successfully, but these errors were encountered: