Open scarySpice opened 1 month ago
We wish there was an annotation where we could mark a field to return the rawData you know? Like we don’t wanna any transformation, give me back the rawField representation and I’ll take from here
Hey @scarySpice
that's something that we will consider adding in the future. Right now, I can think of two workarounds:
rawFields
map in CDAEntry
to directly access the raw JSON structure of richText fields. Here’s a quick example: final CDAEntry entry = client.fetch(CDAEntry.class)
.include(10)
.one(ENTRY_ID);
Map<String, Object> richDocuments = (Map<String, Object>) entry.rawFields().get(FIELD_NAME);
return richDocuments.get(DEFAULT_LOCALE);
Hey @rafalniski ,
Thanks for the reply. @scarySpice and I are working together on this issue.
Currently we use Unwrapping feature where we map Contentful response into our own models using @TransformQuery.ContentfulField
and @TransformQuery.ContentfulEntryModel
. I'm guessing there's no way we could get back the rawFields
with this approach?
In a different use case we do use the CDAEntry
you've mentioned above with rawFields
so yeah, that's an option but we'd need to move away from Unwrapping and I was just wondering whether there was an alternative without having to do that.
Thanks!
So right now, there is no way to get rawFields
with unwrapping, unfortunately.
So right now, there is no way to get
rawFields
with unwrapping, unfortunately.
Alright, thanks for letting us know @rafalniski, appreciate the quick reply!
When you make an api call to receive an entry with a rich Text field inside, the response looks like this:
When you receive a RichText field via java through
.observeAndTransform()
and you try to serialise , you get thisThere is no way to receive the rawJson representation of richText unless you manually process the object and that means you cannot annotate all the entries when there is a RichText field.