Skip to content
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

How do you use NodeGraphType to define an Interface #23

Open
RehanSaeed opened this issue Jul 13, 2018 · 1 comment
Open

How do you use NodeGraphType to define an Interface #23

RehanSaeed opened this issue Jul 13, 2018 · 1 comment
Labels
question Further information is requested

Comments

@RehanSaeed
Copy link

RehanSaeed commented Jul 13, 2018

I would like to use NodeGraphType to implement the NodeInterface type. I'm trying to get my head around why NodeGraphType exists and how to use it. I think it:

  1. Implements Interface<NodeInterface>(); for you.
  2. Implements the If field for you using Id(x => x.Id) instead of defining it yourself:
this.Field(x => x.Id, type: typeof(NonNullGraphType<IdGraphType>))
    .Description("The unique identifier of the droid.");
  1. Registers the type globally, so that given you implement QueryGraphType, lets you resolve any object globally by it's ID.

I've also found a few problems:

  1. It assumes that the ID is of type string. Can I use a System.Guid instead?
  2. The GetById is not async and does not accept a CancellationToken. Ideally it should have the signature:
Task<Droid> GetById(T id, CancellationToken cancellationToken = default);

Where T is a generic type to allow you to specify the type of the ID. Allowing you to use a Guid.

@benmccallum
Copy link

+1, our FEDs are asking for Relay support now and I'm thinking I'm going to have to implement this since you haven't heard back. Will open source it when I can.

@sungam3r sungam3r added the question Further information is requested label Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants