Type-safe GraphQL resolvers with garph

preview_player
Показать описание
Write resolvers without the codegen and debugging. Infer types with code-first GraphQL schemas.

#graphql #webdev
Рекомендации по теме
Комментарии
Автор

I am looking into if there is something in the GraphQL landscape that offers a similar DX and velocity as building an API with tRPC.
Do you know any specific tools you think can achieve that or do you think that for smaller scale projects tRPC is probably the better option?

I have briefly been looking into Garph with GQty + Yoga and also currently looking at your video about pothos.

What would be your recommendation?

wezter
Автор

The problems with typing resolvers is that the type can have their own resolvers those are not considered on the GQL Schema level what ever you use.
As instance let's look on on the Cart type.

Let's guess that Query.cart resolver returns cart without "subTotal" field, and then Cart.subTotal resolver calculates the subTotal using the parent.items array.
Or, similar example Money type has a resolver for formatted field, to allow format money on the type level and don't move responsibility on that to the more important business entities.

At the end to correctly type resolvers we need to combine Schema and Resolvers themselves -- so, garpgh doesn't help with that. Unfortunately

dimitro.cardellini