Skip to content

Feature Request: expose the node to estimators #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
noc7c9 opened this issue Mar 16, 2021 · 1 comment · Fixed by #46
Closed

Feature Request: expose the node to estimators #45

noc7c9 opened this issue Mar 16, 2021 · 1 comment · Fixed by #46

Comments

@noc7c9
Copy link
Contributor

noc7c9 commented Mar 16, 2021

Hiya, first off thanks for the amazing library.

I'm trying to implement a custom estimation that depends on which fields are selected under a type.

Here's an example:

query {
    a: someType { id } # Only id is selected, so calculation happens one way
    b: someType { id, some, fields } # More than id is selected so calculation happens another way
}

I don't believe that the exact behavior I want is achievable with childComplexity unfortunately, I need access to the selectionSet for the given node.

Hopefully that made some sense!

@ivome
Copy link
Collaborator

ivome commented Mar 17, 2021

We could just pass the node as part of the estimator args. This would enable a whole bunch of additional functionality and ways to calculate the complexity of a field. Could potentially also be relevant for #41

Happy to merge a PR if you want to add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants