federation-hotchocolate icon indicating copy to clipboard operation
federation-hotchocolate copied to clipboard

Reference Resolver on Interface not working

Open cli00004 opened this issue 2 years ago • 2 comments

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

cli00004 avatar Jan 10 '24 02:01 cli00004

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

dariuszkuc avatar Jan 10 '24 05:01 dariuszkuc

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

cli00004 avatar Jan 10 '24 20:01 cli00004