graphql-query-complexity
graphql-query-complexity copied to clipboard
Feature request: Add directive estimation support for "initial complexity"
Imagine we have an external service that we're calling out to in order to populate the foo
array field.
I can request any number of elements for that, but the issue is that asking for any number drastically increases complexity, whereas the relative complexity between requesting 1 and 2 entries is much lower.
It would be good to have an "initial" field on the complexity directive, e.g.
@complexity(value: 1, multipliers: :["limit"], initial: 10)
in this example, requesting with a limit of 1 would be a complexity of 11, and requesting 2 would be a complexity if 12, etc.
If we like this suggestion I'm happy to take a crack at implementation
This seems like a valuable addition to add. I'm happy to review / merge a PR if you are still interested in adding this.