title: How to model recursive data structures in GraphQL
body: <p>I have a tree data structure that I would like to return via a GraphQL API. </p>
  
  <p>The structure is not particularly large (small enough not to be a problem to return it in one call).</p>
  
  <p>The maximum depth of the structure is not set.</p>
  
  <p>I have modeled the structure as something like:</p>
  
  <pre><code>type Tag{
      id: String!
      children: [Tag]
  }
  </code></pre>
  
  <p>The problem appears when one wants to get the tags to an arbitrary depth.</p>
  
  <p>To get all the children to (for example) level 3 one would write a query like:</p>
  
  <p><code>
     {
        tags { 
           id
           children {
                id
                children {
                    id
                }
           }
        }
     }
  </code></p>
  
  <p>Is there a way to write a query to return all the tags to an arbitrary depth?</p>
  
  <p>If not what is the recommended way to model a structure like the one above in a GraphQL API.</p>