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.14k stars 732 forks source link

Support for Apollo Federation @interfaceObject #6210

Open cli00004 opened 1 year ago

cli00004 commented 1 year ago

Product

Hot Chocolate

Is your feature request related to a problem?

Apollo Federation has introduced @interfaceObject which isn't supported in HotChocolate.ApolloFederation package. This is an import feature that not only reduces code duplication in subgraphs, but also help us provide capability to resolve a external interface reference in a polymorphic manner

The solution you'd like

Please add support for @interfaceObject and support resolving interface object type in subgraphs

darren-clark commented 1 year ago

I just ran across this today, and the overall issue I believe is not supporting Apollo Federation 2.0.

I wrote my own interfaceObject directive, and it was output in the schema, but then rover refused to merge the graphs because the one from HotChocolate didn't have a @link directive specifying it was using v2.0

cli00004 commented 1 year ago

@darren-clark , Also we need the entity resolver to be able to resolve on the interface type which i don't think it's supported atm

darren-clark commented 1 year ago

It isn't. I fiddled a bit today to see if I could get something working with manually created schema for federation. Specifically trying to get an entity resolve for an interface to work.

I was able to get it to call a resolver for a base class. However even though the resolver returned a derived class, the response from HotChocolate was empty. Probably because the query was ... on BaseInterface { __typename field } and the resolver returned DerivedImplementation so they got removed.