title: How to manage GraphQL query loop?
body: <p>Let's say we have this GraphQL Schema:</p>
  
  <pre><code>gql`
    type Department {
      id: ID!
      name: String!
      programs(programId: ID): [Program]! # filter if an ID is provided
    }
  
    type Program {
      id: ID!
      name: String!
      department: Department
    }
  
    extend type Query {
      getDepartments: [Department]
    }
  `
  </code></pre>
  
  <p>The [probable] issue here is that you can get into this loop: </p>
  
  <pre><code>{
    getDepartments {
      name
      programs(1) {
        name
        department {
          name
          program(1) {
            ...
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>I'm new to GraphQL so, first I would like to know if this is a problem ? I have that feeling but it might be OK.</p>
  
  <p>I tried to use this alternative:</p>
  
  <pre><code>gql`
    type Department {
      id: ID!
      name: String!
      programs(programId: ID): [Program] # filter if an ID is provided
    }
  
    type Program {
      id: ID!
      name: String!
    }
  
    extend type Query {
      getDepartments: [Department]
      getDepartmentForProgram(programId: ID!): Department
    }
  `
  </code></pre>
  
  <p>With this, children can not get parents directly, it is now a top query. My second concern is to know if this is a good alternative, especially if the first one is a problem.</p>
  
  <p>Thanks in advance.</p>