k0ff33
11/26/2018, 10:10 AMgraphql-yoga server? graphqlgen or graphql codegen? I’m starting a new project and want to hear some thoughts.k0ff33
11/26/2018, 10:11 AMprisma examples and graphql-boilerplates repos and they all work differentlynikolasburk
graphqlgen, it's the more recent tool for generating proper typings 🙂k0ff33
11/26/2018, 11:18 AMk0ff33
11/26/2018, 12:12 PMprisma-examples import schema from ./generated/prisma.graphql (cause it’s not generated through graphql-cli) and duplicate types instead. Is it really the best practice? I want to share certain schemas between prisma and yoga.nikolasburk
graphlq-import to import types from prisma.graphql into schema.graphql. I recently had a similar discussion in the #prisma-client channel: https://prisma.slack.com/archives/CCWDULGUW/p1542965781037400?thread_ts=1542861207.027200&cid=CCWDULGUWnikolasburk
k0ff33
11/26/2018, 12:22 PMgraphql-import example in prisma-examples repo in the future 🙂k0ff33
11/26/2018, 5:08 PMgraphql-schema-delegation example and it’s probably what I’m most after at the moment since the API is tightly coupled with Prisma, however, I don’t like the DX of lack of type safety. I’m not sure how to implement a hybrid setup that uses graphqlgen (with all type definitions) while delegating parts of the schema to Prisma directly. I don’t want to expose the full Prisma schema either so I’m not sure if graphql-import helps here?
I essentially don’t want to write resolvers for each type and non-scalar field as this would end up in loads of boilerplate-like code, such as:
import { UserResolvers } from '../generated/graphqlgen'
export const User: UserResolvers.Type = {
...UserResolvers.defaultResolvers,
permissions: (parent, args, ctx) =>
ctx.prisma.user({ id: parent.id }).permissions()
}k0ff33
11/27/2018, 9:46 AMnikolasburk
graphqlgen
2. Using Prisma bindings (schema delegation): Resolvers can't be entirely type-safe since the typings depend on the info object which is dynamic. For your current use case, it might be the more suitable way to go for now since you can use forwardTo to easily proxy the Prisma operations you want to expose.
Hope that helps!nikolasburk
k0ff33
11/27/2018, 12:03 PMk0ff33
11/27/2018, 3:59 PM