Exception: GraphQL::Schema::Object::FieldsAreRequiredError

Inherits:
Error
  • Object
show all
Defined in:
lib/graphql/schema/object.rb

Overview

Raised when an Object doesn’t have any field defined and hasn’t explicitly opted out of this requirement

Instance Method Summary collapse

Constructor Details

#initialize(object_type) ⇒ FieldsAreRequiredError

Returns a new instance of FieldsAreRequiredError.



13
14
15
16
# File 'lib/graphql/schema/object.rb', line 13

def initialize(object_type)
  message = "Object types must have fields, but #{object_type.graphql_name} doesn't have any. Define a field for this type, remove it from your schema, or add `has_no_fields(true)` to its definition."
  super(message)
end