apollographql / federation-hotchocolate

HotChocolate support for Apollo Federation
https://www.apollographql.com/docs/federation/
MIT License
16 stars 8 forks source link

Reference Resolver on Interface not working #67

Open cli00004 opened 10 months ago

cli00004 commented 10 months ago

I have an interface type in Graph 1 and an interfaceObject in Graph 2 matching each other (let's say interface A). When a query initiated from graph 2 referencing object from graph 1 with reference resolver, graph 1 will throw exception The apollo gateway tries to resolve an entity for which no EntityResolver method was found even though I have defined the reference resolver in the interface type in Graph 1

Updates: It looks like EntitiesResolver only tries to locate resolver from ObjectType, but by definition here https://www.apollographql.com/docs/federation/federated-types/interfaces#interface-reference-resolver , resolvers can also be defined in interface type image

dariuszkuc commented 10 months ago

Hello 👋 Can you provide a link to a github repository that reproduces the issue?

cli00004 commented 10 months ago

hi @dariuszkuc , sorry I won't be able to provide the github as that's currently under private corporate account, but I debug through it and found issue happens here https://github.com/apollographql/federation-hotchocolate/blob/80a2b4be83d824ed6558efca0e5541aa8b5fe86a/Federation/Helpers/EntitiesResolver.cs#L28 where the EntitiesResolver only looks for resolvers in ObjectType, but I have an ReferenceResolver defined in a InterfaceType class, which should be supported in Federation 2.0, hope this makes sense