lib/apipie/validator.rb in apipie-rails-0.9.4 vs lib/apipie/validator.rb in apipie-rails-1.0.0

- old
+ new

@@ -470,25 +470,29 @@ def validate(value) %w[true false 1 0].include?(value.to_s) end def self.build(param_description, argument, options, block) - if argument == :bool || argument == :boolean + if argument == :bool || argument == :boolean || boolean_array?(argument) self.new(param_description) end end - def expected_type - 'boolean' + private_class_method def self.boolean_array?(argument) + argument.is_a?(Array) && (argument - [true, false]) == [] end def description string = %w(true false 1 0).map { |value| format_description_value(value) }.join(', ') "Must be one of: #{string}." end def ignore_allow_blank? true + end + + def expected_type + 'boolean' end end class NestedValidator < BaseValidator