Customisation of responses in the Delivery API (v12) ?
p
I need more control of the output from the Delivery API and for it to return my own Dto's. I kind of had it working pretty well via a custom
IOutputExpansionStrategy
mapping strongly typed
IPublishedContent
and
IPublishedElement
onto my DTO's but I am now running into issues with the following error: > A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support cycles. This relates to BlockList properties and I'm guessing is an issue caused by the potential for deep/infinite nesting. I can't seem to find a way around it which has lead me to question my current approach to achieve what I am after. Has anyone done anything similar or taken a different approach or can offer some pointers here?
I've managed to resolve this by making further changes to my object mapping. Instead of implementing my mapping in my
IOutputExpansionStrategy
I am now doing it in my
IApiPropertyRenderer
not that I think it makes much difference.
7 Views