Get a tree recursively

I want to use the GraphQL API to fetch the content of files of a repository. As far as I understand, there is currently no way to recursively get all files in a repository through GraphQL, as asked there: GraphQL equivalent of /repos/:owner/:repo/git/trees/:tree_sha?recursive=1 - #2 by lee-dohm.

I guess my question is then: why not? It is already implemented through REST, would it be a burden for GraphQL? I know recursive queries isn’t a thing in GraphQL, but it is not a thing in REST either, and a simple parameter there solves this.

I think it’s too bad, I got into GraphQL thinking I could achieve this in a simple request, avoiding over-fetch, but at this point, I am rather thinking to do a GraphQL request to get repositories, a REST request to get files recursively, and another GraphQL request to fetch their content at once. where I could do all this in a single request with a simple recursive argument or a special field on the Repository Object.

I know about the very-very-nested query workaround, any other ideas are welcome, but I am curious about this.

1 Like