graphql-ruby
graphql-ruby copied to clipboard
[Warden] Empty types are not reliably pruned from the schema
@rmosolgo @xuorig @jturkel the smaller remaining piece of https://github.com/rmosolgo/graphql-ruby/issues/1333.
The warden currently contains some basic logic to try and hide types which end up empty. But similar to #1333 this turns into a general reachability problem which is not correctly handled in all cases right now. For example:
type Query {
a: A
P: P
}
# First chain
type P { x: Q }
type Q { x: R }
type R { x: String }
# Second chain
type A { x: B }
type B { x: C }
type C { x: D }
type D { x: P }
If I filter out type R then the entire schema should end up empty, but that doesn't happen right now.
Per https://github.com/rmosolgo/graphql-ruby/issues/1333#issuecomment-397817135 this fortunately doesn't affect the correctness of executing general queries. It only affects introspection (which may incorrectly contain types that should be hidden) and in rare cases it may result in confusing/misleading error messages when a query references a type that is hidden.