graphqlgen icon indicating copy to clipboard operation
graphqlgen copied to clipboard

Prisma scaffolding plugin

Open schickling opened this issue 6 years ago • 2 comments

Once we're supporting GraphQL directives (see #83) and a plugin system (see #84), there could be a Prisma plugin that automatically scaffolds the relation resolvers (similar to the forwardTo functionality of graphql-binding). Here is an example (syntax still WIP):

schema.graphql

# import Post from '../generated/prisma.graphql'

type Query {
  feed: [Post!]! @prisma(query: "posts")
}

Further idea: This combined with the usage of graphql-import could lead to a very concise and minimal setup where for most cases it's enough to change something in your datamodel.prisma and the schema.graphql file + resolvers will be adjusted automatically.

schickling avatar Oct 18 '18 12:10 schickling

From this discussion, Nikolas mentions that "It is true that the client requires you to implement type resolvers for types that have relations to other types"

Just trying to understand - does this idea solve that use case? I am having to define lots of type resolvers for relations that I did not have to write under prisma-bindings, it's quite a bit of boilerplate code

vjsingh avatar Nov 27 '18 18:11 vjsingh

@schickling Any update on this? When adding new relation fields in my datamodel.prisma I have to add boilerplate resolvers, and these are adding up quickly

vjsingh avatar Jan 31 '19 13:01 vjsingh