Class: Druid::Query::PostaggregationsValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/druid/query.rb

Constant Summary collapse

TYPES =
%w(timeseries groupBy topN)

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/druid/query.rb', line 172

def validate_each(record, attribute, value)
  if TYPES.include?(record.queryType)
    value.each(&:valid?) # trigger validation
    value.each do |avalue|
      avalue.errors.messages.each do |msg|
        record.errors.add(attribute, msg)
      end
    end
  else
    record.errors.add(attribute, "is not supported by type=#{record.queryType}") if value
  end
end