graphql-tools
graphql-tools copied to clipboard
Ability to get names of all the stitched queries in a middleware
I am trying to implement a rate limiter for my GraphQL server. The way I am implementing is that each query will be mapped (by its name) to a rate limit configuration. This enables me to configure each GraphQL query differently to throttle it.
Using the info object in a middleware, I was able to get the name of the main query, but I was not able to see the name of the stitched query (or queries).
If there was a way to get the name of the stitched queries from info object, or, via any other mechanism, it'd be good.
So, I have checked the documentation, tried info object in the middleware. Nothing has worked for me, so far.
Example:
{
locations {
name
reviewsForLocation {
rating
}
}
}
Here, the main query is locations and the stitched query is reviewsForLocation. I'd like to get the name of both the queries (types) in the middleware.