Hide parts of the schema #792
Replies: 3 comments 1 reply
-
I think this is a useful addition and does not violate the specification. It seems that only introspection will be affected at runtime and has to do a bit of extra work. Apart from that, there should be no negative effects from adding this. Given the implementation is simple enough, i would be up for inclusion 👍 |
Beta Was this translation helpful? Give feedback.
-
Was just wondering if there was any attempt at implementing said suggestion? Thank you. |
Beta Was this translation helpful? Give feedback.
-
I ended up needing something similar to this and came up with this PR: #1434 Do you guys think this direction is something the project would be comfortable with? Would love to hear what other people have in mind for this. |
Beta Was this translation helpful? Give feedback.
-
So this already came up some times before: #649 & #405. But it never got anywhere
So I'm here to see if there is interest in getting this in even or that it's out of scope.
I'm really impressed by how GraphQL-Ruby has implemented this.
They list some great arguments about why this is useful:
This is in part a security through obscurity functionality BUT it's also a really functional feature to be able to have feature switches and test out new parts of the schema in production without it being part of the public schema immediately.
That last part (feature flagging, incremental rollout) is what interests me most about this feature (see for example how GitHub is using it to hide their discussions API behind a feature flag.
I have been browsing around and I think a possible (from the user perspective) implementation could look something like this:
GraphQL-Ruby implements the following rules for the
visible
callback result:These rules would as far as I'm concerned also apply to graphql-php since they seem reasonable and go a little further than simply hiding them from the introspection, they basically remove them from the schema entirely so they also cannot be called.
For a bit more detail check out the excellent GraphQL-Ruby docs page: https://graphql-ruby.org/authorization/visibility.
I'm mainly here to see IF this is even something that would be considered for inclusion in graphql-php so please give me some feedback on the idea (which is a shameless copy of the GraphQL-Ruby implementation and not a original idea) so I know if I should be moving forward or that it won't be accepted at all 😄
Beta Was this translation helpful? Give feedback.
All reactions