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

Is it possible to apply wildcard rules to specific query/mutation fields

Slmii opened this issue ยท comments

Question about GraphQL Shield

I've been looking in the docs but could find anything about (I might've missed it) but is it apply the rules specified in a wildcard * to a specific query/mutation field rule.

For example

Mutation: {
        '*': and(isAuthenticated, hasPermission),
        addUser: validateInput, // this would also have the rules applied in the wildcard
 }

If I want to achieve the above I need to do

Mutation: {
        '*': and(isAuthenticated, hasPermission),
        addUser: and(isAuthenticated, hasPermission, validateInput)
 }

I saw something related to this question in #680 but its not been updated for a while.

Question about GraphQL concepts

Please describe the concept you are interested in. If possible also provide links and source of the problem that you have.

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

Hey @Slmii ๐Ÿ‘‹,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.

https://opencollective.com/graphql-shield

PS.: We offer priority support for all financial contributors. Don't forget to add priority label once you start contributing ๐Ÿ˜„

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hey! ๐Ÿ‘‹

Thank you for being so patient. I don't think it's possible since this is a very edge case scenario. It would be difficult to find a balance in the API that would allow it.

Related to #928. I will keep the discussion in that thread.