-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Right now I've plugged in the basic queryComplexity validationRule but noticed that i'm getting many logs of complexity queries. It turns out that clients are sometimes sending me POST objects with entire schemas full of queries and only calling one via operationName. I am therefore getting many scores logging, eventually i get NaNs logged then eventually it's erroring out complaining that my variables are missing in my query. For example
"{\"errors\":[{\"message\":\"Argument \\\"site\\\" of required type \\\"Site!\\\" was provided the variable \\\"$site\\\" which was not provided a runtime value.
When I take out the extra querys in the incoming POST, I actually get a correct logged query complexity score and no error.
So one option I have working is to manually call getComplexity which takes a query- here i can filter out all queries except for the one matching operationName. However, this is pretty hard to do if there is a query with a ... fragment.
I wonder if this is a feature we can have built into the module from the get go? Only score what the user is actually calling based on operationName ? thanks.