melvinkcx / graphql-utilities

Oneshot middleware, query cost analysis, depth limiting, etc for graphql-core>=3.0 (formerly, graphql-core-next)
https://graphql-utilities.readthedocs.io/
MIT License
20 stars 1 forks source link

Feature: do not count specific fields when calculating depth #12

Open art1415926535 opened 4 years ago

art1415926535 commented 4 years ago

Some schema may be created like normal or relay:

normal:

{
  allUsers { id username }
}

relay:

{
  allUsers { edges { node { id username } } }
}

I think, need skip edges and node in depth analysis.

The configuration can be implemented for example like this:


{
    "depth_analysis": {
        "max_depth": 2,  # Maximum depth allowed
        "skip": [EdgeClass, NodeClass],  # Do not count
     }
}