ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.25k stars 744 forks source link

NodeResolver for interface types #5414

Open tobias-tengler opened 2 years ago

tobias-tengler commented 2 years ago

Is your feature request related to a problem?

I have an interface type with two implementing object types. Both object types refer to the same entity, so they share the same Id. This Id is also part of the aforementioned interface. Other object types have properties referencing these Ids. Since a global Id must be unique for a type, these properties referencing the interface type can not point to a concrete implementation. They have to be serialized for the interface type. This works fine.

The problem is with object identification. I currently have no way to specify a node resolver for an interface type. So I can't fetch the interface type through the node(s) field.

The solution you'd like

The global object identification spec speaks of identifying objects, but it's never explicitly said that an object must be an object type.

I think the best solution would be to allow to define a node resolver for an interface type.

Product

Hot Chocolate

SvenQuintens commented 1 year ago

Having now the same issue but then on input types, where you cannot receive IDs for an interface type with the [property: ID(nameof(InterfaceType))] attribute.