doyensec / GQLSpection

GQLSpection - parses GraphQL introspection schema and generates possible queries
Apache License 2.0
66 stars 7 forks source link

If recursion depth reached, truncate the query smartly #20

Closed execveat closed 1 year ago

execveat commented 1 year ago

Right now once the depth counter is reached, no more subqueries will get sent and the message !!! MAX RECURSION DEPTH REACHED !!! gets appended instead.

This usually leaves GraphQL query in an incorrect status, - it can't be sent without modifications. Try to truncate the query smartly (or comment out the part of the query that would prevent it from working).

Here's an idea. Instead of this:

a {
  b
  c {
    !!! MAX RECURSION DEPTH REACHED !!!
  }
  d
}

do this:

a {
  b
  # c {}
  d
}