Question: wrap all top-level queries / mutations only
See original GitHub issueHey all, trying to figure out if I’m approaching this wrong or just not understanding. So, what I’d like to do is put a simple tracing middleware around any “top level” query. I.e. the request comes in and they ask for PersonA
and PersonB
query.
I’ve got one that runs, and I can filter out decently well by only measuring if parent
is null, which seems to work. But the downside is that it’s making my introspection query SUPER slow – proabbly because it’s hitting every prop and we have a huuuge schema which is split into multiple files and stitched together. Also, we’re on lambda, so we recompile this on every invocation (at least locally) so our dev cycles are suffering.
I’m wondering: is there some easy way to say wrap Query.* and Mutation.*
but not anything deeper? I saw #13 and looked at the applyMiddlewareToDeclaredResolvers
but it doesn’t seem to have much impact.
Thoughts? Am I missing something simple?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top GitHub Comments
@Abhijeetjaiswalit
@maticzav, I elected to use graphql-shield instead of rolling my own middleware. The fallbackRule option works perfectly for this kinda task.
I apologize that this comment is extremely off-topic in this issue, but in case anyone is interested, this is the way I’ve setup my authorization rules.
@maticzav, thanks for your wonderful graphql-shield module. It’s very well structured and has saved me so much time. I am very grateful for your efforts.