Exception: Graphiti::Errors::MissingEnumAllowList

Inherits:
Base
  • Object
show all
Defined in:
lib/graphiti/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, filter_name, enum_type) ⇒ MissingEnumAllowList

Returns a new instance of MissingEnumAllowList.



207
208
209
210
211
# File 'lib/graphiti/errors.rb', line 207

def initialize(resource_class, filter_name, enum_type)
  @resource_class = resource_class
  @filter_name = filter_name
  @enum_type = enum_type
end

Instance Method Details

#messageObject



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/graphiti/errors.rb', line 213

def message
  <<~MSG
    #{@resource_class.name} You declared an attribute or filter of type "#{@enum_type}" without providing a list of permitted values, which is required.

    When declaring an attribute:

    attribute :status, :#{@enum_type}, allow: ['published', 'draft']

    When declaring a filter:

    filter :status, :#{@enum_type}, allow: ['published', 'draft'] do
      # ...
    end
  MSG
end