-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: exclude invalid fields in analyzer #44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes to make the tests more specific about expectations. This looks good to me otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change related to when we log, but otherwise looks good!
lib/graphql-hive/client.rb
Outdated
if response.code.to_i >= 400 && response.code.to_i < 500 | ||
@options[:logger].warn("Unsuccessful response: #{response.code} - #{response.body}") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this get added to this PR? Are you certain response.body
is safe to log without exposing tokens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its mostly for debugging purposes. to be safe, we can parse and log specific fields instead of the entire body. i'll remove this for now and address it in a separate PR!
Context
When encountering invalid fields in a query, the analyzer would throw an error:
We want to handle these cases gracefully.
Changes
on_enter_field
method in theGraphQL::Hive::Analyzer
to validate both the parent type and the field existence before adding to@used_fields
.Testing