graphql-shield icon indicating copy to clipboard operation
graphql-shield copied to clipboard

Move from graphql-middleware to Resolvers Composition

Open dimatill opened this issue 2 years ago • 4 comments

Resolvers Composition is a small, well maintained, and well tested package being part of graphql-tools

dimatill avatar Oct 28 '22 16:10 dimatill

This would be amazing! I love graphql-shield, but do not use graphql-middleware. Resolver composition is nice but I do not like it's dot notation for naming. Your nested objects API is much cleaner & easier for typesafety when combined with codegen.

I'd be happy to write a PR for this if you'd like. It's only about 60 LOCs: https://github.com/ParabolInc/parabol/blob/fa767a6f719cec03a966d41cc45d1a077a1857fb/packages/server/graphql/composeResolvers.ts#L27-L91

mattkrick avatar Dec 03 '22 06:12 mattkrick

thank you @mattkrick ! I'll check it!

dimatill avatar Dec 04 '22 16:12 dimatill

Hi @mattkrick ! Looks like I'm doing something similar to what you've mentioned, using Resolvers Composition, preserving Fragments functionality, and solving the problem you've mentioned in your code about Permissions don't get applied to fields that don't have custom resolvers.

Please take a look at the draft PR, maybe you could share some thoughts about it

dimatill avatar Dec 07 '22 19:12 dimatill

looks good! i didn't realize the stock composeResolvers handlers a ruleTree using nested object notation instead of dot notation. It'll be great to have 1 less dependency!

mattkrick avatar Dec 14 '22 19:12 mattkrick