{"action":"opened","issue":{"url":"https://api.github.com/repos/intridea/grape/issues/892","labels_url":"https://api.github.com/repos/intridea/grape/issues/892/labels{/name}","comments_url":"https://api.github.com/repos/intridea/grape/issues/892/comments","events_url":"https://api.github.com/repos/intridea/grape/issues/892/events","html_url":"https://github.com/intridea/grape/issues/892","id":54277255,"number":892,"title":"Missing optional Array params default to the Hash instead of Array","user":{"login":"adamcooper","id":12883,"avatar_url":"https://avatars.githubusercontent.com/u/12883?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcooper","html_url":"https://github.com/adamcooper","followers_url":"https://api.github.com/users/adamcooper/followers","following_url":"https://api.github.com/users/adamcooper/following{/other_user}","gists_url":"https://api.github.com/users/adamcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcooper/subscriptions","organizations_url":"https://api.github.com/users/adamcooper/orgs","repos_url":"https://api.github.com/users/adamcooper/repos","events_url":"https://api.github.com/users/adamcooper/events{/privacy}","received_events_url":"https://api.github.com/users/adamcooper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-14T02:37:42Z","updated_at":"2015-01-14T02:37:42Z","closed_at":null,"body":"If if declare a param as a `type: Array` with nested params\r\n\r\n```ruby\r\nparams do\r\n  optional :comments, type: Array do\r\n    optional :description, type: String\r\n  end\r\nend\r\npost do\r\n  { params: params.slice(:comments), declared: declared(params) }\r\nend\r\n```\r\n\r\nand it is missing from the incoming params (or has a default of `nil`) then it defaults to a `Hash`\r\n\r\n```\r\ncurl -X POST http://localhost:9292/api/entities  -d '{}' -H \"Content-Type: application/json\"\r\n\r\n{\"params\":{},\"declared\":{\"comments\":{\"description\":null}}}\r\n```\r\n\r\nThis only occurs on the `optional` as the `group` and `requires` both throw validation errors.  \r\n\r\nThere is a workaround by setting a `default: []` on the `Array` param.\r\n\r\n"}}