-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
grape v1.1.0
ruby v2.4.4
API definition:
params do
requires :obj, type: Hash, allow_blank: false do
requires :id, type: Integer, allow_blank: false
optional :arr, type: Array, allow_blank: true do
requires :k, type: String, allow_blank: false
requires :v, type: String, allow_blank: false
end
end
end
put '/results' do
present(declared(params))
endRequest body:
{
"obj": {
"id": 1
}
}Response body:
{
"obj": {
"id": 1,
"arr": {
"k": null,
"v": null
}
}
}When nested array is missing from the request, declared transforms it into a Hash with nil values.
I would expect it to return nil or an empty array. It looks like there was an issue opened for it, but the specs written for it do not seem to be testing the issue. #1642