{"action":"closed","issue":{"url":"https://api.github.com/repos/ruby-grape/grape/issues/1436","repository_url":"https://api.github.com/repos/ruby-grape/grape","labels_url":"https://api.github.com/repos/ruby-grape/grape/issues/1436/labels{/name}","comments_url":"https://api.github.com/repos/ruby-grape/grape/issues/1436/comments","events_url":"https://api.github.com/repos/ruby-grape/grape/issues/1436/events","html_url":"https://github.com/ruby-grape/grape/issues/1436","id":163967508,"number":1436,"title":"Param type Array always rejected as invalid","user":{"login":"davidmccoy","id":6517566,"avatar_url":"https://avatars.githubusercontent.com/u/6517566?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmccoy","html_url":"https://github.com/davidmccoy","followers_url":"https://api.github.com/users/davidmccoy/followers","following_url":"https://api.github.com/users/davidmccoy/following{/other_user}","gists_url":"https://api.github.com/users/davidmccoy/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmccoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmccoy/subscriptions","organizations_url":"https://api.github.com/users/davidmccoy/orgs","repos_url":"https://api.github.com/users/davidmccoy/repos","events_url":"https://api.github.com/users/davidmccoy/events{/privacy}","received_events_url":"https://api.github.com/users/davidmccoy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-05T23:19:29Z","updated_at":"2016-07-07T15:39:49Z","closed_at":"2016-07-07T15:39:48Z","body":"I'm having a lot of trouble with params using the Array datatype with Grape 0.16.2. For example, this API param requirement:\r\n\r\n```\r\nparams do\r\n  requires :swipes, type: Array\r\nend\r\n```\r\n\r\nwith this input, an array of hashes: \r\n\r\n```{ \"swipes\":  [ {user_id: 1, other_id: 5}, {user_id: 5, other_id: 2} ]  }```\r\n\r\nproduces this error:\r\n\r\n```{\"error\":\"swipes is invalid\"}```\r\n\r\nHowever, when I change the param datatype to a Hash, all of a sudden the exact same input (an array of hashes) is accepted and the params are converted into a hash of hashes!\r\n\r\n```\r\nparams do\r\n  requires :swipes, type: Hash\r\nend\r\n```\r\n\r\nplus this input:\r\n\r\n```{ \"swipes\":  [ {user_id: 1, other_id: 5}, {user_id: 5, other_id: 2} ]  }```\r\n\r\nsuccessfully passes the param validations and results in these params:\r\n\r\n```{ \"swipes\": { \"0\": { \"user_id\": \"1\", \"other_id\": \"5\" }, \"1\": { \"user_id\": \"5\", \"other_id\": \"2\" } } }```\r\n\r\nAm I missing something completely obvious? Thanks!"}}
{"actor":{"display_login":"dblock"}}