cfree
02/15/2021, 11:01 PMschema.prisma
, making tweaks to the db here and there until the prisma models look right. I’d like to minimize changes to my graphql schema and resolvers.
I’m now at the point where I want to integrate prisma 2 with apollo, but I still need to create the typeDefs…? I was using prisma-binding and I can’t decide whether to do the SDL-first approach or use Nexus. Which is more popular?
SDL-first seems more straightforward, but requires manually writing a new resolver for each grapqhl type… and resolvers for nested queries too…? Nexus seems like a more-natural transition away from prisma-binding, but the syntax is confusing. Any suggestions/recommendations?Andrew Hollenbach
02/16/2021, 12:09 AMcfree
02/16/2021, 1:11 AMschema.prisma
and the typedefsnikolasburk
prisma-binding
to an SDL-first approach?
but I’m honestly not entirely sure what I need to do to connect theThe "connection" between the Prisma schema and the GraphQL typeDefs are effectively your resolvers which are implemented using Prisma Client.and the typedefsschema.prisma
I was using prisma-binding and I can’t decide whether to do the SDL-first approach or use Nexus. Which is more popular?This really depends on your personal preferences, lots of folks like the SDL-first approach (and it's probably the most popular in the JS ecosystem overall). If you're a fan of TypeScript, you could consider switching to Nexus since it works really well with TypeScript 🙂
nikolasburk
cfree
02/16/2021, 4:18 PMnikolasburk
Will that help me avoid having to manually write all these relation resolvers?Nexus itself won't help you with this per se as it's "just" a GraphQL schema library. However, there is an integration library for Prisma Nexus, the
nexus-plugin-prisma
which would solve this problem. Unfortunately there's another however though: This plugin is currently being rewritten and will have a different API soon. So, as for the state of tooling today there isn't really an option that helps you with the rewrite of the relation resolvers 😞 if you can wait 2-3 more months, the plugin will most likely be in a state where this is available again with a new API.cfree
02/16/2021, 5:31 PMnexus-plugin-prisma
plugin would get me where I need to be, I’m fine having to upgrade later (as long as there is feature parity)
this is my third time rewriting this app 😆 I finally get everything the way I want it, but now I need to upgrade everything from prisma 1 to prisma 2…. I get that this ecosystem is solving a hard problem and it’s obvious that a lot of work has been put into documentation, but man… the upgrade fatigue is real! 😅cfree
02/16/2021, 5:52 PMcfree
02/16/2021, 6:35 PMnikolasburk
cfree
02/18/2021, 2:42 PMnikolasburk
cfree
02/18/2021, 4:08 PMresolve
function, but that doesn’t seem to be necessary for all objectType
s. I’ll refer to the Nexus docs instead of nagging you. Thanks for the help!nikolasburk