Module: Grape::DSL::Validations::ClassMethods

Defined in:
lib/grape/dsl/validations.rb

Instance Method Summary collapse

Instance Method Details

#document_attribute(names, opts) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/grape/dsl/validations.rb', line 18

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



14
15
16
# File 'lib/grape/dsl/validations.rb', line 14

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

#reset_validations!Object



9
10
11
12
# File 'lib/grape/dsl/validations.rb', line 9

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