Android: Auto generated POJO class having different class names of repeated children objects

Hi,
I have added one graphql file which has some repeated children objects in it(lets say we have children as repeatable). And the auto generated POJO classes have different naming conventions like Children, Children1, Children2,etc.,

Ex:
query TestQuery() {
testQuery() {
active //variable
children{ //this children is repeatable
active
children{
active
children{
active
children{

				}
			}
		 
		}
	
	}
}

}

POJO class:
Apollo graphql is auto generating TestQuery, Children, Children1, Children2, Children3 as individual classes but those children classes are all same objects which are repeatable.

How to hanlde this scenario to get Children as repeatable I mean Children object inside Children class which is not as Children1.

Hi :wave:

This is on purpose. There needs to be a way to terminate the recursion.

If all the classes were the same:

class Children(val active: Boolean, val children: List<Children>)

Then there’d be no way to terminate the recursion. The lastly nested child must not have a children property:

// last level of nesting
class Children3(val active: Boolean)

And in order to do that, you need intermediate Children1 and Children2 classes.

1 Like

Hi,
Thanks for the replay. I got your point.

1 Like