diff --git a/README.rst b/README.rst index ea1c7466c..06bae5fde 100644 --- a/README.rst +++ b/README.rst @@ -712,6 +712,8 @@ For an enumeration type: value ? value.split(',') : [] end +The processed value will be available in ``@api_params``. + ============ Validators ============ diff --git a/lib/apipie/validator.rb b/lib/apipie/validator.rb index 3eda6020f..97bb34e3c 100644 --- a/lib/apipie/validator.rb +++ b/lib/apipie/validator.rb @@ -398,7 +398,7 @@ def self.validate(value) class BooleanValidator < BaseValidator def validate(value) - %w[true false 1 0].include?(value.to_s) + %w[true false 1 0].include?(value.to_s.downcase) end def self.build(param_description, argument, options, block) @@ -406,6 +406,10 @@ def self.build(param_description, argument, options, block) self.new(param_description) end end + + def process_value(value) + %w[true 1].include?(value.to_s.downcase) + end def expected_type 'boolean'