Skip to content

Nested support for Custom Models #128

Open
@D-Fox

Description

@D-Fox

Motivation

I want to fetch my model A class using client.getItems(A.class, params). The problem is that conversion for custom types is not working deeper in hierarchy.

@ContentItemMapping("a")
class A {
@ContentItemMapping("b") List<B> bList;
}

@ContentItemMapping("b")
class B {
  @ElementMapping("name") String name;
  @ContentItemMapping("b") List<C> cList;
}
     
@ContentItemMapping("c")
class C {
  @ElementMapping("name") String name;
}

Class A will contain list of B classes, but inside this class List<C> cList will be mapped to empty list (String name inside B class is ok).

If i fetch class B direcly using client.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 for ContentItem object model, not custom models.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions