-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
Variables Passed in the request should be accessible by the context. Expose helpers to get arguments at any level #836
Comments
Also looking at the JavaScript reference implementation the analog of resolver context does seem to expose variables and values. |
There is a more efficient way to do that actually, although I have to put you some things together here for you so I will look into this tomorrow. But just to give you a hint how this would work. We can do a look ahead with the resolver context by using `CollectFields. Collect fields basically does all the hard work and gets you the field of the next level and prepares the arguments. This is also what we internally do when we complete an object. We have two overloads of We now only need to create the argument collection which will compute what the actual values are for each field. That should basically give you everything and in a much more performant way. I will paste some code examples tomorrow to get you started. |
Wow thanks for feedback and support. That would greatly appreciated! started looking into CollectFields but didn't quite get how to take advantage of it and I was squarely focused on resolving argument values at the time. For traversal the current method has a non-trivial amount of edge cases and being able to build the query at each step is w/o the expectation that the parent is already resolved would probably a better route. |
The
Wasn't clear if you meant this work was still pending or simply the last step. |
I think we have still to make the helpers public .... but I will do that with the next preview. |
I will put this in preview 41 tomorrow |
This one is not implemented and will be released as preview 43 |
The resolver context (IResolverContext) has now a property variables that gives access to the coerced variables of the execution context. |
Is your feature request related to a problem? Please describe.
I'm creating a resolver that translates SQL to GraphQL. In order to construct the hierarchy I effectively need the resolver context information of each child. Since I can walk the selections and have access the the schema I can create most the information I need at each level, I cannot however get access to variable values w/o adding them to the context or properties and then doing quite a bit of work to figure the argument values at each level.
Describe the solution you'd like
A clear way to get argument values from any field selection.
Describe alternatives you've considered
Per above passing variable values in context or properties and then doing the work to get the values thereafter which isn't trivial.
The text was updated successfully, but these errors were encountered: