-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide parts of schema #365
Comments
You can create a SchemaMapping for the fields and return null / empty if the user don't have permission. |
Thanks for raising this. It seems quite related to #116 although it's not entirely clear whether the same directives would be used for this as well or whether hiding would have to be expressed differently. More generally if defining authorization should result in field errors or those errors simply being hidden. /cc @rwinch It's also not clear to me what should be hidden? We have the schema printing endpoint that returns the full schema. There is GraphQL introspection that could be used. There are GraphQL responses as well. Anything else? I imagine any hiding mechanism should cover all of those or otherwise it's not really hiding it. Any further details around the actual use case and needs would be helpful to hear and keep in mind. Some examples from real world APIs could also be worth checking (GitHub's comes to mind as having such a feature). |
I imagine the usecase is to have certain fields/types appear as if they don’t exist in the schema for the user who doesn’t have permission to see them. Must not disclose the permission requirements to the user. |
It sounds like this should be enforced at the schema printing level and introspection level at least. When it comes to responses themselves, nulling out a field that's not marked as nullable in the schema will cause issues. Back to the use case itself, it seems that this can be useful for:
GraphQL Java seems to support that through field visbility and other frameworks do too. |
Are there any relevant conclusions available? It seems that this feature would be helpful to me. |
Hi, just highlighting for consideration, I think it would be useful to hide certain parts (fields, types) of the schema based on authorization. There are some uses of it if you google "graphql hide fields". I personally haven't used this feature.
The text was updated successfully, but these errors were encountered: