When I am using a field with an underscore, it is unable to resolve it on the type. The interesting thing is that this works fine when using the GraphQL::ObjectType.define {...} syntax.
Example:
class Types::RoomType < Types::BaseObject
description "A room"
field :id, ID, null: false
field :name, String, null: false
field :room_type, Integer, null: false
end
Where Types::BaseObject inherits from GraphQL::Schema::Object
The specific error being returned is "Field 'room_type' doesn't exist on type 'Room'".
Thanks for the help!
The new default behavior is to camelize field and argument names, so that field is roomType. You can override this by passing camelize: false to field(...), or you can override it in your base class / method.
See camelize option:
http://graphql-ruby.org/api-doc/1.8.0/GraphQL/Schema/Field#initialize-instance_method
Feel free to reopen this if it doesn't work for you!
Got it! Thanks for the help!
Can this new behavior be added to the changelog or to the new class based API page? It totally caught me off guard.
Most helpful comment
Can this new behavior be added to the changelog or to the new class based API page? It totally caught me off guard.