Giter VIP home page Giter VIP logo

Comments (2)

sliepie avatar sliepie commented on June 24, 2024

In my opinion @mkmarek shouldn't integrate Relay specific stuff into this project, since there are more GraphQL clients than Relay. It also deviates this project from the graphql-js reference implementation. I'd rather see an companion project target on Relay that implemented the all specific requirements for it. Facebook is also working actively on Relay 2 where they possibly could introduce breaking changes for the server-side requirements, and a project that implements the Relay specific implementation should support both Relay 1 and 2.

The node field is something you can do yourselves, like I have done. Just add a field named node to your root query and add a custom resolver where you deconstruct the global id e.g. ClrType.FullName:IdOfInt32. This allows you to figure out what type Relay ask for and what the actual id of the item is. Based on that info you should be able to resolve item and return the correct object.

One tip I have for you: I have implemented the resolvers for the complex types in separate classes, and I have a mapping for my GraphQLTypes and corresponding resolvers. In the resolve method of the node field, I extract the CLR type out of the given global id and then I use the mapping to find the resolver I need to invoke.

from graphql-dotnetcore.

cdroulers avatar cdroulers commented on June 24, 2024

Sounds absolutely right! Thanks for the good post!

If I end up using dotnetcore, it'll probably be using graphql-dotnet since it seems more active and already has Relay support.

The syntax is very verbose compared to this, but it has a lot more features so far. Thanks for your response!

from graphql-dotnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.