def method_added(method_name)
super
return unless Apipie.active_dsl?
return unless Apipie.apipie_provided?
Apipie.remove_method_description(self, method_name)
description = Apipie.define_method_description(self, method_name)
if Apipie.configuration.validate == true
old_method = instance_method(method_name)
define_method(method_name) do |*args|
if Apipie.configuration.validate == true
description.params.each do |_, param|
if param.required && !params.has_key?(param.name)
raise ArgumentError.new("Expecting #{param.name} parameter.")
end
if params.has_key?(param.name)
param.validate(params["#{param.name}""#{param.name}"])
end
end
end
old_method.bind(self).call(*args)
end
end
end