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



241
242
243
244
245
246
247
248
# File 'lib/grape/validations.rb', line 241

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



237
238
239
# File 'lib/grape/validations.rb', line 237

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

#reset_validations!Object



232
233
234
235
# File 'lib/grape/validations.rb', line 232

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