neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Generate resolvers for relationship types

Open moxious opened this issue 6 years ago • 1 comments

Related to a discussion with Will, if I write a type like this:

type UPVOTE @relation(name: "UPVOTE") {
  from: User!
  to: Response!
}

It would be nice to have a resolver for this auto-generated as well. This requires that the 'from/to' property naming be respected. (Related issue: https://github.com/neo4j-graphql/neo4j-graphql-js/issues/235 was a mis-understanding of how this is generated currently)

Every relationship acts as a "pre-join" of sorts. By generating resolvers, certain queries become very easy:

{
    BUYS {
        from {
            name
        }
        to {
            name
        }
    }
}

A different tack at this by starting from user and navigating to product would of course still be possible, but in some cases I think to go at it "relationship first", and they're easy enough to auto-generate

moxious avatar Apr 24 '19 18:04 moxious

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham