americanexpress/nodes

Support for recursive relationships

andlien opened this issue · 1 comments

Hi! Thank you for developing this client!

Is there any way to use nodes with recursive relationships? For instance, is it possible to generate the following query

{
  query {
    cars(id: 1) {
      id
      owner {
        cars {
          id
        }
      }
    }
  }
}

to list all cars owned by the owner of this car?

Currently the query-generation results in a stack overflow

Hi Anders,

Right now no, there is no break when recursively generating the query.

I think the cleanest approach to adding this feature would be to add a new annotation to support something like @GraphQLRecursive(depth = 1).

Then in the recursive getChildren() in GraphQLRequestEntity method on line 240 adding a depth parameter with a sane default to break out of