graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

No way to add reference resolver to interface

Open rdb00 opened this issue 1 year ago • 3 comments

Product

Hot Chocolate

Version

13.6.1

Link to minimal reproduction

https://github.com/ChilliCream/graphql-platform/blob/984e263eb5f71d81c935d343e043f186543ae8e1/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor.cs#L6

Steps to reproduce

Create a new InterfaceType<> class and create the Configure method. On IInterfaceTypeDescriptor, there is no Key() method to add a key and reference resolver to the interface like there is on IObjectTypeDescriptor.

What is expected?

Because @interfaceObject is supported, I would expect there to be the Key() method to add the key and a reference resolver (which is required to use @interfaceObject).

What is actually happening?

No way to add a reference resolver, resulting in an error from Apollo when attempting to resolve the interface. This would be a feature request if not for the fact that @interfaceObject is supposed to be supported. But maybe there is another way to register a reference resolver to the interface that isn't documented.

Relevant log output

No response

Additional context

No response

rdb00 avatar Nov 07 '24 22:11 rdb00

Can you just add it manually?

descriptor.Directive(new KeyDirective(fieldName));

jarlef avatar Nov 11 '24 14:11 jarlef

The problem then is registering a reference resolver. KeyInterface also works for getting the directive on the interface, but there's no way to register a reference resolver. I tried using the [ReferenceResolver] way of registering, but that didn't work either. Also I tried this on HC 14 and the same issue seems to be present.

rdb00 avatar Nov 12 '24 18:11 rdb00

This could be considered a duplicate of this issue. @interfaceObject IS supported now, but we still just don't have a way to register a ref resolver on the actual interface (the type marked with @interfaceObject is fine I believe). https://github.com/ChilliCream/graphql-platform/issues/6210

rdb00 avatar Mar 27 '25 16:03 rdb00