|
|
|
|
|
by n_e
1104 days ago
|
|
> GraphQL doesn't allow for recursive types. It does, this schema works: type Item {
id: ID!
children: [Item!]!
}
type Query {
root: Item!
}
GraphQL queries describe the shape of the response, so with this schema it's not possible to ask recursively for "the full tree up to an arbitrary depth". One way to solve this would be to add a "descendants" field that returns a list of all the children, grand-children... |
|
IE:
So you have to build your schema with a maximum supported depth. This is not infinitely recursive which is a limitation of the GQL type system.