Closed IvanRodriCalleja closed 1 year ago
I created a reproduction repository just in case it is easier https://github.com/IvanRodriCalleja/juniper_interface_issue
@IvanRodriCalleja this is a known issue on 0.15.x
that is already fixed on master
. There is no plans to backport this fix to 0.15.x
, as master
Interface
s are completely redesigned.
Works perfect!!
Thanks to point to the issues, i didn't find them.
Hi,
I don't know if the problems is a misunderstood from my side, if i am using interface wrong or if it is an issue. The problem is related to using an interface when i implement the interface to my models (via impl not struct) the definition of the interface is not in the result schema i have to define it in the implementation but then it uses the interface method.
Let me explain it better, i am doing an initial POC implementing the relay schema (at the moment not conections) to see how to have relay support in Juniper so i created the following:
I created a
Node
interface with anid
function and each model has theNode
implementation for the interface, the result of this schema is:From what i understand this is not correct and the schema result should be:
If i want to have this definition i should have the following rust implementation:
As you can see i added the
id
function resolver to each of the implementation so now it is duplicated but the schema is how i want it to be.When i consume any of the model throw the
NodeValue
for examlpe forNodeValue::Ship()
(like the node(id: "") query) the id is resolved by theimpl Node for Ship
interface but if i have a simple relation likeVec<Ship>
this is resolved by ´impl Ship´ function but i expect to always use theid
function fromimpl Node for Ship
.So my question is, is it the expected behaviour and i understood wrong? is the implementation wrong on my side? do you think it is a bug?