-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
Support for defining field extensions property in Apollo resolvers #1279
Comments
This Extensions field could be just the solution for the issue with not being able to send a dynamic I was able to do so with this field but the lack of typing and documentation makes me fear it would eventually be removed |
Fold into #1306 |
Unable to add extra Metadata to field.extensions - HELP |
What I'm trying to do:
My end goal is to implement DoS protection using
graphql-query-complexity
and more specifically using thefieldExtensionsEstimator
from that library. This makes use of the field extensions property ingraphql-js
to label individual fields with a complexity cost function allowing for a very expressive cost calculation mechanism.The problem
As far as I can tell there is no supported/documented mechanism for defining field extensions in
graphql-tools
so I would have to define my schema usinggraphql-js
directly. Having said that the following does work:A more complete working example can be found at digicatapult/graphql-complexity-experiment.
The problem therefore is that the extensions property in the above is both not documented and not included in the typings.
Solution
Firstly modify the interface
IResolverOptions
to include the extensions property like:to match the equivalent property in
graphql-js
. Secondly this behaviour should be documented in theapollo-server
docs.Can I do this?
If the above sounds good then I would be happy to submit a PR for this.
The text was updated successfully, but these errors were encountered: