-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Hide deprecation warning when GraphQL::Schema::Visibility is included #5451
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
Conversation
right now i get this deprecation, even when i have Schema::Visibility included in my schema > DEPRECATION: "Query.internalAdminUsers" field returned `false` for `.visible?` but `GraphQL::Schema::Visibility` isn't configured yet. > > Address this warning by adding: > > use GraphQL::Schema::Visibility > > to the definition for your schema. (Future GraphQL-Ruby versions won't check `.visible?` methods by default.) > > Alternatively, for legacy behavior, add: > > use GraphQL::Schema::Warden # legacy visibility behavior > > For more information see: https://graphql-ruby.org/authorization/visibility.html > /Users/schpet/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/graphql-2.5.13/lib/graphql/schema/warden.rb:207:in 'block in GraphQL::Schema::Warden#initialize'
|
Hey, thanks for sharing this fix! Does graphql-ruby provide any more of the backtrace than that? Out of curiousity, I'm wondering where/why it's initializing a |
|
@rmosolgo thanks for checking this out! here's a more full dump below. happy to provide a full repro if that's helpful, but might take me a couple days to get to it. |
|
👋 Sorry I haven't followed up on this in a while. I don't think hiding this warning is the right thing because it is using I'd like to figure out why it's using the legacy module here when it shouldn't. Here's what stands out to me: The code jumps right from Rspec to GraphQL-Ruby's Do you mind sharing the source for the test that emits this warning? My guess is that the code being called doesn't produce the right default when called in this way. Once we track it down, I can update it to use the right thing. |
|
@rmosolgo thanks for checking this out again :-)
i've pushed up a repo here that reproduces it: ❯ bundle exec rspec spec/graphql/schema_spec.rb
GraphqlRubyWarningReproSchema
DEPRECATION: GraphqlRubyWarningReproSchema's "Query.internalAdminUsers" field returned `false` for `.visible?` but `GraphQL::Schema::Visibility` isn't configured yet.
Address this warning by adding:
use GraphQL::Schema::Visibility
to the definition for GraphqlRubyWarningReproSchema. (Future GraphQL-Ruby versions won't check `.visible?` methods by default.)
Alternatively, for legacy behavior, add:
use GraphQL::Schema::Warden # legacy visibility behavior
For more information see: https://graphql-ruby.org/authorization/visibility.html
triggers deprecation warning when querying hidden field
Finished in 0.04937 seconds (files took 0.5929 seconds to load)
1 example, 0 failuresi'll read through your comment again later and try to narrow it down (maybe the |
|
Hey, thanks for sharing that repro. I pulled it, bundled it, ran the tests, and saw the warning. In this case, the warning applies: the schema doesn't include When I add either one of those Does your real app schema have one of those |
|
@rmosolgo ah of course 🤦🏻♂️. i've looked at the reproduction, and the tests triggering this, and then realized my schema did have the |
right now i get this deprecation, even when i have Schema::Visibility
included in my schema