graphql-cost-analysis
graphql-cost-analysis copied to clipboard
Query with default values will cause error: "Argument \"input\" has invalid value...
As title,
I'm getting this error when I've got custom scalars, when the custom scalar validation rejects the input: the nicely informative message from my custom scalar is not shown, but the error from graphql/execution/values.js#getArgumentValues
(as in the stack trace above) is shown instead.
Is the correct function being called here? The particular exception block being triggered is commented:
// Note: ValuesOfCorrectType validation should catch this before
// execution. This is a runtime check to ensure execution does not
// continue with an invalid argument value.
Looks like getArgumentValues
is being called out-of-order as far as the execution pipeline is concerned?
NB the original error from validation is also reported in the result, so ValuesOfCorrectType
is also being run, but this doesn't stop related errors also being generated from the cost evaluation.
I get exactly the same problem as the screenshot. This literally means the GraphQL API users can't pass $input
variable like at all!
I believe this line passes wrong variables
.
https://github.com/pa-bru/graphql-cost-analysis/blob/b0f41119955654b52f8943ceaf4eb35dfb68db4e/src/costAnalysis.js#L349