-
-
Notifications
You must be signed in to change notification settings - Fork 782
Resolvers for sub fields #8263
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
Comments
I do not follow what you want to achieve. Why dont you define this on the author type? Do you want different resolvers depending on the path the execution takes? |
The latter is correct, which is particularly needed when we have types inheriting. In our scenario we have an Account interface with several implementations. There's a lot of available properties, so we have them organized into several objects such as "Location" which are properties on Account. For a Being able to do
|
To solve this you have to use scoped state which is inherited by child resolverS. Then do a decision based on this. You could even store a delegate in the state that represents the changed execution flow and combine it in essence with a middleware. You could I think get very close to the API you suggest. As for the core I do not see it as I would from the code expect that we would pull the field up. You are defining in the type API fields for this type only. So this would break predictability of our API. |
Product
Hot Chocolate
Is your feature request related to a problem?
Resolvers are not run for properties of properties...
descriptor.Field(x => x.Foo.Bar).Resolve(ctx => "bar") // This is never run
I have a use case for it where I have several types implementing a shared interface. Depending on the implementation type, different downstream APIs should be called to fetch certain fields. I have created a minimal repository with a basic test to reproduce: https://github.com/TylerSiegrist/HotChocolate.Example.Resolver.Subfields
The solution you'd like
Resolvers are executed for properties of properties.
The text was updated successfully, but these errors were encountered: