How do you write GraphQL SDL?

Simon's profile photo
Simon@ponjimon

ยท

Nov 7, 2021

How do you write GraphQL SDL?

Just typing it out as it is or are you using some generators or other helper tools?

Brian Lovin's profile photo
Brian Lovin@brian

ยท

Nov 7, 2021

I write stuff like this: https://github.com/brianlovin/briOS/blob/main/src/graphql/queries/questions.ts and then graphql-codegen turns that into a strongly typed set of definitions and React hooks here: https://github.com/brianlovin/briOS/blob/main/src/graphql/types.generated.ts

Simon's profile photo
Simon@ponjimon

ยท

Nov 7, 2021

I forgot to mention, I was more asking about the API / backend side of it :)

Brian Lovin's profile photo
Brian Lovin@brian

ยท

Nov 7, 2021

Got it โ€” if you poke through those links, you'll land in the backend. I might not fully understand the question though. All the resolvers are written by hand, and there's definitely ways to make that process better. For example, I'm keeping an eye on https://nexus.prisma.io.