[BUG] Can't access the newly created document when not using POJO
See original GitHub issueDescribe the bug Please note: we’re not using POJO. We’re working with raw JSON documents.
CosmosAsyncItemResponse<Document> dbResponse = container.createItem(new Document(documentAsJson)).block();
The responseBodyString
property from the CosmosAsyncItemResponse
contains the new document returned from the database, but it’s not accessible.
call to dbResponse.getResource()
fails with an exception.
Exception or Stack Trace
com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "defaultPropertyInclusion": com.fasterxml.jackson.databind.ObjectMapper#setDefaultPropertyInclusion(1 params) vs com.fasterxml.jackson.databind.ObjectMapper#setDefaultPropertyInclusion(1 params)
at [Source: (String)"{"id":"myid_2020-03-25T09:49:38.586298500","level1":{"level2":"replace_with_your_partition_key"},"_rid":"eqt-AIauc2cPAAAAAAAAAA==","_self":"dbs\/eqt-AA==\/colls\/eqt-AIauc2c=\/docs\/eqt-AIauc2cPAAAAAAAAAA==\/","_etag":"\"bf02d59a-0000-0d00-0000-5e7b1b220000\"","_attachments":"attachments\/","_ts":1585126178}"; line: 1, column: 1]
Expected behavior We’d like to be able to access the JSON returned from the server. Either by calling the getResource() method and then converting to JSON or by a new getter for the JSON string.
Setup (please complete the following information):
- OS: Windows
- Cosmos DB Java SDK v4 preview.2
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
For what its worth, this is also an issue when trying to read
data
classes using Kotlin.which fails to deserialize because the object mapper cannot be configured to use the kotlin module.
Making the handler configurable or returning the raw response would help a ton for kotlin projects.
@mbhaskar - can you please provide update on this ? If this is a feature request, can you please tag the issue appropriately with
feature-request
tag ?