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

fix: remove parent_type.fields check in analyzer #46

Merged
merged 6 commits into from
Dec 6, 2024

Conversation

al-yanna
Copy link
Contributor

@al-yanna al-yanna commented Dec 5, 2024

Context

Follow-up to #44

For direct fields in Union types, for example, __typename in

query {
  searchResult(query: $query) {
    __typename
    ... on Project {
      id
    }
  }
}

the parent_type.fields[node.name] check results in

undefined method `fields' for class [UnionType] (NoMethodError)

Changes

  • Update parent_type.fields check to be node&.respond_to?(:name)

Testing

  • Unit test (Analyzer)

@al-yanna al-yanna marked this pull request as ready for review December 5, 2024 17:43
Copy link
Collaborator

@aryascripts aryascripts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but this is looking good!

lib/graphql-hive/analyzer.rb Outdated Show resolved Hide resolved
Co-authored-by: Arya Bhimani <[email protected]>
@al-yanna al-yanna requested a review from aryascripts December 6, 2024 14:59
@rperryng rperryng merged commit 980ea7d into rperryng:master Dec 6, 2024
4 checks passed
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.

3 participants