ardatan / ardatan/graphql-tools
Ability to get names of all the stitched queries in a middleware
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 830
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 45
Description
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.
Contributor guide
Research direction
Start by tracing how middleware receives the `info` object and how schema stitching represents nested stitched queries. The issue names no source files or tests, so first locate the middleware and stitching entry points and check existing documentation for `info`. Done means middleware can access the names of both the main query and stitched queries in the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100