Closed
Description
I am using 0.19.2 and I have the following endpoint:
resource :foos do
params do
requires :foo, type: Hash do
requires :name, type: String
optional :arr, type: Array do
requires :param1, type: String
requires :param2, type: String
end
end
end
post do
puts "original: #{params.to_hash['foo']}"
puts "declared: #{declared(params).to_hash['foo']}"
{}
end
end
When I call it with
{
foo: {
name: 'test',
arr: []
}
}
I get this output:
original: {"name"=>"test"}
declared: {"name"=>"test", "arr"=>{"param1"=>nil, "param2"=>nil}}
In other words, for some reason the empty arr
array has become a hash containing arr
's required fields.