Module: Zodra::ParamsValidator

Defined in:
lib/zodra/params_validator.rb

Constant Summary collapse

STRING_TYPES =
%i[string uuid binary].freeze
NUMERIC_TYPES =
%i[integer decimal number].freeze

Class Method Summary collapse

Class Method Details

.call(params, schema:) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/zodra/params_validator.rb', line 8

def self.call(params, schema:)
  errors = {}

  schema.attributes.each do |attr_name, attribute|
    validate_attribute(params, attr_name, attribute, errors)
  end

  errors
end