Module: Grape::Validations::ClassMethods

Included in:
API
Defined in:
lib/grape/validations.rb

Overview

This module is mixed into the API Class.

Instance Method Summary collapse

Instance Method Details

#document_attribute(names, opts) ⇒ Object



293
294
295
296
297
298
299
300
# File 'lib/grape/validations.rb', line 293

def document_attribute(names, opts)
  @last_description ||= {}
  @last_description[:params] ||= {}
  Array(names).each do |name|
    @last_description[:params][name[:full_name].to_s] ||= {}
    @last_description[:params][name[:full_name].to_s].merge!(opts)
  end
end

#params(&block) ⇒ Object



289
290
291
# File 'lib/grape/validations.rb', line 289

def params(&block)
  ParamsScope.new(api: self, type: Hash, &block)
end

#reset_validations!Object



284
285
286
287
# File 'lib/grape/validations.rb', line 284

def reset_validations!
  settings.peek[:declared_params] = []
  settings.peek[:validations] = []
end