-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for "global object identification" and the Node interface #2507
Comments
I imagine it could be done similarly to how we do federation. Though I’m not clear on how you determine the subtype, is it encoded in the ID? The spec seems somewhat vague on the point so I’m guessing we can’t assume much about the ID structure, which makes the design somewhat tricky. |
Ah, yes. That's an important detail I forgot to mention! In our code, we have typed all of our IDs. In the schema, they are simply |
How do you determine the type of the id though? Is the type prefixed to the id |
Took a stab at an implementation here if you could take a look. I've never used the spec myself so I'm not sure what the best DX would be here, so I just followed what we did for federation. |
Sorry for the late reply!
Sorry, I should have written about that as well. We've made a structure for this that constructs ID's like this:
It's prefixed.
Thanks! I'll take a look and give you some feedback as soon as possible! |
I want to implement support for global object identification in my service. In particular, I want to implement the
Node
interface and theQuery.node
field. The latter is non-trivial; we currently have an implementation that requires us to manually add each type that implements Node to a custom data structure that we use to resolve theID
. So, each type willextend Node[TYPE]
and we add theTYPE
to a slightly complex structure manually to handle the resolver.I am curious if anyone has implemented this in a more general manner that is more straight forward to use?
The dream scenario would be to have something where we simply do
case class Foo(...) extends Node
. Or perhapscase class Foo(...) extends Node[Foo]
where everything else required forQuery.node
is handled automatically.The text was updated successfully, but these errors were encountered: