Skip to content
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

Allow null input objects in arguments during field usage analysis #4078

Merged
merged 2 commits into from May 27, 2022

Conversation

lyricsboy
Copy link
Contributor

Problem

When passing in an explicit null value for a nullable input object-type argument on a field, field usage analysis will raise an exception like this:

NoMethodError: undefined method `arguments' for nil:NilClass
    graphql-ruby/lib/graphql/analysis/ast/field_usage.rb:43:in `block in extract_deprecated_arguments'
    graphql-ruby/lib/graphql/analysis/ast/field_usage.rb:37:in `each_pair'
    graphql-ruby/lib/graphql/analysis/ast/field_usage.rb:37:in `extract_deprecated_arguments'
    graphql-ruby/lib/graphql/analysis/ast/field_usage.rb:22:in `on_leave_field'

Solution

Skip arguments with null values during field usage analysis.

@rmosolgo rmosolgo added this to the 2.0.9 milestone May 27, 2022
@rmosolgo
Copy link
Owner

Thanks for this fix! It looks good to me.

It looks like adding a new field to the dummy schema broke some assertions about the introspection result on that schema, do you mind updating those tests to include the newly-added field?

@lyricsboy
Copy link
Contributor Author

Thanks! All tests are passing locally for me now.

@rmosolgo rmosolgo merged commit dea841b into rmosolgo:master May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants