Skip to content

Conversation

@erikkessler1
Copy link
Contributor

@erikkessler1 erikkessler1 commented Dec 14, 2023

Problem

The way we override the Schema#query method makes it so that we don't call add_type_and_traverse when setting the new query type like graphql-ruby does here. Currently we only add and traverse the query type when accessing the query.

The following script demonstrates this:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'apollo-federation'
end

class CatType < GraphQL::Schema::Object
end

class QueryType < GraphQL::Schema::Object
  field :cat, CatType, null: false
end

class Schema < GraphQL::Schema
  include ApolloFederation::Schema

  query QueryType
end

p Schema.get_type('Cat')
#=> nil

Solution

This PR makes it so that we call super(federation_query_object) when the new query object is being set.

Copy link
Contributor

@sethc2 sethc2 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this.

@sethc2 sethc2 merged commit 72cc8b7 into Gusto:main Apr 2, 2024
grxy pushed a commit that referenced this pull request Apr 2, 2024
## [3.8.5](v3.8.4...v3.8.5) (2024-04-02)

### Bug Fixes

* ensure query object is traversed ([#270](#270)) ([72cc8b7](72cc8b7))
@grxy
Copy link
Collaborator

grxy commented Apr 2, 2024

🎉 This PR is included in version 3.8.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@grxy grxy added the released label Apr 2, 2024
Kaytal pushed a commit to lensrentals/apollo-federation-ruby that referenced this pull request Oct 1, 2024
* Add a broken test

* Ensure the new type is traversed
Kaytal pushed a commit to lensrentals/apollo-federation-ruby that referenced this pull request Oct 1, 2024
## [3.8.5](Gusto/apollo-federation-ruby@v3.8.4...v3.8.5) (2024-04-02)

### Bug Fixes

* ensure query object is traversed ([Gusto#270](Gusto#270)) ([72cc8b7](Gusto@72cc8b7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants