-
-
Notifications
You must be signed in to change notification settings - Fork 749
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
Allow extending interface types #7757
Comments
I have not found a useful use-case for this. How should this work? Also from an internal execution standpoint. If its just about the GraphQL type representation, than this is already possible. You can create a InterfaceTypeExtension and add more fields to your type. But introducing a secondary interface that represents addition fields is just a dead type from which we would infer usage without any usage of the type itself by the type system. |
Thanks for getting back to me! I described my use-case in general terms in the OP. I will give specifics below, but I'm unclear how my initial description is insufficient, so there's a danger that the below is also insufficient. Please let me know if anything is unclear. First, a more elaborate general description: In my view, the use-case is exactly the same as being able to extend object types. For object types, it is possible to add fields (resolvers) without modifying the original type. These fields are added to GraphQL and resolve as if they had been defined on the type itself. Similarly, I want to add extensions to interfaces in exactly the same way, using Here is a more specific example: First, here's how and why I use object extensions: Consider a type This works great for GraphQL object types, and means I have full separation of my domain layer and my GraphQL layer. Unfortunately, it does not work for GraphQL interfaces. Let's extend the example by adding a second type My current workaround is to have an empty interface Proposed solution: Add an |
Product
Hot Chocolate
Is your feature request related to a problem?
Related: #5974
Currently, HC allows extending all types implementing an interface, but not the interface itself.
Adding the ability to extend interfaces would greatly help domain-focused codebases where the domain types do not correspond exactly to the GraphQL types, and where one wants to keep the GraphQL layer as a separate layer on top of the domain layer. I do that in my codebases - I use explicit binding globally, and use type extensions to have full control over what goes in the GraphQL schema.
The solution you'd like
Allow extending interfaces just like we can now extend object types.
In #5974, it was mentioned that a type interceptor might be used, but I do not know how to accomplish this using a type interceptor. I just want to write a normal, friendly type extension class and have it apply to the interface itself.
The text was updated successfully, but these errors were encountered: