Usually, in GraphQL/Rails you have a query_type.rb
file that would look something like this:
module Types
class QueryType < Types::BaseObject
# Add root-level fields here.
# They will be entry points for queries on your schema.
field :test_field, String, null: false do
description 'Test field'
end
def test_field
'My test field!'
end
end
end
All of my queries are in this file full implemented. Is there a way to do something like mutation_type.rb
does and scope the query implementations out into other files? Maybe something like this?:
query_type.rb:
module Types
class QueryType < Types::BaseObject
# Add root-level fields here.
# They will be entry points for queries on your schema.
field :test_field, String, null: false, query: Types::TestFieldType
end
end
test_field_type.rb:
module Types
class TestFieldType < Types::BaseObject
description 'Test Field'
def test_field
'My Test field!'
end
end
end