-
Notifications
You must be signed in to change notification settings - Fork 305
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 @SchemaMapping
and @BatchMapping
for schema interface types
#871
Comments
This is a noticeable gap when migrating from graphql-kickstart, which was able to identify schema mappings to interface based resolvers. |
Thanks for the good description, and helping me to understand the problem. We can make a change such that if the type of a Let me know if you have any comments. I think we can get this into 1.3. |
@SchemaMapping
and @BatchMapping
for schema interface types
Just to check my understanding, you will register the same batch function for each concrete type automatically unless a concrete type already has a concrete type-specific batch function registered? If so, that sounds great! |
Yes, that is what I meant. This is now available in 1.3.0-SNAPSHOT and we'll be releasing 1.3.0-RC1 tomorrow. If you'd like to give this a try and provide feedback, that would be much appreciated! |
I apologize for the long delay and for not being able to test out the SNAPSHOT and RC versions, but I was finally able to try out 1.3.0 today and it works exactly as I'd expect. Thank you! |
Instead of requesting to re-open #294, I'm creating a new issue.
First off, thank you for this library! It has come a long way since I first started looking into Java + GraphQL over 2 years ago. There have been a lot of great QoL improvements everywhere! Thank you!
Between issues #294 and #236 the suggestion was to create a base batching function and then write a new batching function for each concrete type citing that DGS and NestJS don't support the functionality requested. I'd like to revisit this.
Here's my use-case:
I should be able to write a single test that executes
activities()
testing all of theActivity
fields which should always pass no matter whether I have one or ten concrete implementations of Activity (though, per the GraphQL spec, I must have at least one).Right now, I only have a handful of Activity types, but I plan to add more in the future. As I do, with the current state of the library, I will have to just remember to make sure to implement dataloaders for each new concrete type or risk a 500 error on a frontend query that is fetching one of the
.users
or.labels
attributes.I would like to point out that Python's Graphene library supports setting resolvers on an Interface type and therefore dataloaders so that I don't have to implement the same resolvers on all concrete types (Sadly, this isn't clearly documented as an example, otherwise I'd post a link. I've used it in production code and it just works). That being said, I have to usually supply a TypeResolver to help it out a bit.
Here is what I expect to work:
However, here is my workaround:
The text was updated successfully, but these errors were encountered: