Describe the bug
Currently RxDocumentClientImpl uses a simple jackson object mapper, which does not support JDK8 classes like Optional.
To Reproduce
Create a bean with an Optional field
Store said bean
Expected behavior
It would serialize and deserialize correctly. Possible allow the user configure their own ObjectMapper to fix this.
Actual behavior
java.lang.ClassCastException: com.fasterxml.jackson.databind.node.TextNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
at com.microsoft.azure.cosmosdb.JsonSerializable.fromJson(JsonSerializable.java:494) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.JsonSerializable.<init>(JsonSerializable.java:78) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.Resource.<init>(Resource.java:84) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.Document.<init>(Document.java:63) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.Document.FromObject(Document.java:72) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.BridgeInternal.documentFromObject(BridgeInternal.java:56) ~[azure-cosmosdb-commons-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.getCreateDocumentRequest(RxDocumentClientImpl.java:1031) ~[azure-cosmosdb-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.createDocumentInternal(RxDocumentClientImpl.java:1164) ~[azure-cosmosdb-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.lambda$createDocument$23(RxDocumentClientImpl.java:1155) ~[azure-cosmosdb-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper.lambda$inlineIfPossibleAsObs$1(ObservableHelper.java:55) ~[azure-cosmosdb-gateway-2.6.4.jar:na]
at com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility.lambda$executeRetry$2(BackoffRetryUtility.java:102) ~[azure-cosmosdb-gateway-2.6.4.jar:na]
Environment summary
SDK Version: 2.6.4
Java JDK version: 8
OS Version (e.g. Windows, Linux, MacOSX): Windows
Describe the bug Currently RxDocumentClientImpl uses a simple jackson object mapper, which does not support JDK8 classes like Optional.
To Reproduce
Expected behavior It would serialize and deserialize correctly. Possible allow the user configure their own ObjectMapper to fix this.
Actual behavior
Environment summary SDK Version: 2.6.4 Java JDK version: 8 OS Version (e.g. Windows, Linux, MacOSX): Windows
Additional context /