-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested support for Custom Models #128
Comments
Hello @D-Fox. Thanks for the issue. I will take a look at it and create a test for that to verify if I get the problem right. There might be a problem when a circular reference is modeled in Kontent (maybe the reason why it is not implemented). Would it be OK for you to just extend the possibility to specify how many levels should the mapping works? It should prevent an infinite loop for circular reference (I might find another solution without the necessity of the depth parameter using some memorization - we have it in other SDKs - but I haven't seen this codebase for a while). |
Thanks for the reply. Parameter similar to the |
Hello @D-Fox, I have created a test for your situation in #129. Does the test fit the situation you are describing? I have also drafted an enhancement in the linked pull request (hence the test is passing). But it is a change in the SDK's core and it would require a longer time to put to production to ensure we don't make any breaking changes for current users of the SDKs. |
Motivation
I want to fetch my model
A
class usingclient.getItems(A.class, params)
. The problem is that conversion for custom types is not working deeper in hierarchy.Class
A
will contain list ofB
classes, but inside this classList<C> cList
will be mapped to empty list (String name insideB
class is ok).If i fetch class
B
direcly usingclient.getItems(B.class, params)
,List<C> cList
will be mapped correctly. So it seems it's not working only if im deeper in hierarchy.Proposed solution
Add support to nested custom models mapping.
Additional context
There is also parameter
linkedItemsDepth(int)
, but it seems that this is only valid forContentItem
object model, not custom models.The text was updated successfully, but these errors were encountered: