maticzav / graphql-shield

๐Ÿ›ก A GraphQL tool to ease the creation of permission layer.

Home Page:https://graphql-shield.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context object not typed on rule arguments

sreuter opened this issue ยท comments

Question about GraphQL Shield

When using graphql-shield in conjunction with apollo-server, it seems like the type of the context provided to apollo-server is not automatically forwarded into the rule definition context. I can manually set the context type on each rule of course, but I wonder if there's maybe just something I'm missing. Should this just work?

Thank you.

Screen Shot 2021-03-21 at 7 45 38 pm

  • I have checked other questions and found none that matches mine.

Hey @sreuter ๐Ÿ‘‹,

Thank you for opening an issue. We will get back to you as soon as we can. Have you seen our Open Collective page? Please consider contributing financially to our project. This will help us involve more contributors and get to issues like yours faster.

https://opencollective.com/graphql-shield

We offer priority support for all financial contributors. Don't forget to add priority label once you become one! ๐Ÿ˜„

We offer priority support for all financial contributors. Don't forget to add priority label once you become one! ๐Ÿ˜„

Love it, did it (as QuestMate) but can't add tag :)

Hi @sreuter!

Thank you for becoming a backer of GraphQL Shield! You are not missing anything. GraphQL Shield relies on GraphQL Middleware and GraphQL Middleware is netural when it comes to servers. That's why we don't automatically derive the type of the context from your server.

I've been planning on making GraphQL Shield type-safe, which includes context, for some time. Some things, behind the scenes, have started steering this boat in the right direction, and your sponsorship is definitely a big contribution on that part. I'll let you know when this feature roles out.

For the time being, I suggest we keep it this issue open for future references.