I'm trying to define GraphQL type definitions. As far as I understand a class has to have a type definition named like the class, plus an appended Type
. I have a class called CourseType
, which leads me to this type definition:
app/graphql/types/course_type_type.rb
module Types
class CourseTypeType < Types::BaseObject
field :id, ID, null: false
field :title, String, null: true
end
end
When I try to open the GraphiQL site, I see the following error in the rails console:
Unhandled to_type_name input: {:Types=>Types::CourseTypeType} (Hash)
I assume that the problem occurs because of the class name, ending with Type
, as I have another class Course
, with a type definition named CourseType
, which works fine.
I didn't find any similar error or documentation on this on Google. How do I have to write this correctly? Thank you.