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



184
185
186
187
188
189
190
191
192
# File 'lib/grape/validations.rb', line 184

def document_attribute(names, opts)
  @last_description ||= {}
  @last_description[:params] ||= {}

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

#params(&block) ⇒ Object



180
181
182
# File 'lib/grape/validations.rb', line 180

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

#reset_validations!Object



175
176
177
178
# File 'lib/grape/validations.rb', line 175

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