Skip to content

QueryComplexityRule seems to attempt to parse input variables repeatedly #1468

Open
@ingluisjimenez

Description

@ingluisjimenez

I am trying to enable the QueryComplexity rule and noticing that when the rule executes, it attempts to parse the values of the inputs multiple times for each Field definition.

The issue I am running into is that I have a custom scalar type that does some validation when parseValue() or parseLiteral() are called and log when it fails validation, and this validation process seems to be running (hundreds) multiple times, while I would expect that code to run at most once while the QueryComplexity is traversing through the schema. This ends up generating hundreds of error log lines when the custom scalar type fails validation, but also, it seems sub-optimal in that the rule attempts to extract/parse the same values from the input over and over.

Is this intentional behavior? Should my custom scalar type memoize the return value of parseValue() and prevent triggering the validation repeatedly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions