{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/comments/67261718","id":67261718,"diff_hunk":"@@ -235,6 +235,11 @@ def parse_request_params(required)\n       end\n     end\n \n+    def param_type_is_array?(param_type)\n+      return false unless param_type\n+      param_type == 'Array' || param_type =~ /\\[\\w+\\]\\z/\n+    end","path":"lib/grape-swagger/endpoint.rb","position":16,"original_position":16,"commit_id":"29afe070cfe640d7359e590f78b390a9ceb04f53","original_commit_id":"29afe070cfe640d7359e590f78b390a9ceb04f53","user":{"login":"LeFnord","id":120214,"avatar_url":"https://avatars.githubusercontent.com/u/120214?v=3","gravatar_id":"","url":"https://api.github.com/users/LeFnord","html_url":"https://github.com/LeFnord","followers_url":"https://api.github.com/users/LeFnord/followers","following_url":"https://api.github.com/users/LeFnord/following{/other_user}","gists_url":"https://api.github.com/users/LeFnord/gists{/gist_id}","starred_url":"https://api.github.com/users/LeFnord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeFnord/subscriptions","organizations_url":"https://api.github.com/users/LeFnord/orgs","repos_url":"https://api.github.com/users/LeFnord/repos","events_url":"https://api.github.com/users/LeFnord/events{/privacy}","received_events_url":"https://api.github.com/users/LeFnord/received_events","type":"User","site_admin":false},"body":"@dblock … the whole `('[', '[][')` junk could be removed by avoiding the introducing of it here [endpoint.rb#L224](https://github.com/ruby-grape/grape-swagger/blob/master/lib/grape-swagger/endpoint.rb#L224)\r\n\r\nI had to make a decision, should the name of the parameter indicating if it is a Hash, Array or not, this solution following the rails naming convention for form data\r\n\r\nquestions is, is it really needed … think removing it, could made many things easier\r\n","created_at":"2016-06-15T23:02:50Z","updated_at":"2016-06-15T23:02:50Z","html_url":"https://github.com/ruby-grape/grape-swagger/pull/455#discussion_r67261718","pull_request_url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455","_links":{"self":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/comments/67261718"},"html":{"href":"https://github.com/ruby-grape/grape-swagger/pull/455#discussion_r67261718"},"pull_request":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455","id":73657223,"html_url":"https://github.com/ruby-grape/grape-swagger/pull/455","diff_url":"https://github.com/ruby-grape/grape-swagger/pull/455.diff","patch_url":"https://github.com/ruby-grape/grape-swagger/pull/455.patch","issue_url":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/455","number":455,"state":"open","locked":false,"title":"Allow passing of Array with brackets (eg. Array[String], Array[Integer])","user":{"login":"TySpring","id":13591547,"avatar_url":"https://avatars.githubusercontent.com/u/13591547?v=3","gravatar_id":"","url":"https://api.github.com/users/TySpring","html_url":"https://github.com/TySpring","followers_url":"https://api.github.com/users/TySpring/followers","following_url":"https://api.github.com/users/TySpring/following{/other_user}","gists_url":"https://api.github.com/users/TySpring/gists{/gist_id}","starred_url":"https://api.github.com/users/TySpring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TySpring/subscriptions","organizations_url":"https://api.github.com/users/TySpring/orgs","repos_url":"https://api.github.com/users/TySpring/repos","events_url":"https://api.github.com/users/TySpring/events{/privacy}","received_events_url":"https://api.github.com/users/TySpring/received_events","type":"User","site_admin":false},"body":"According to docs in Grape, you can pass a parameter of type array with a nested type, like so:\r\n```ruby\r\nparams do\r\n  requires :my_param, type: Array[String], documentation: { param_type: 'body' }\r\nend\r\n```\r\n(See https://github.com/ruby-grape/grape#custom-types-and-coercions section for example).\r\n\r\nBefore this PR, if you do this, the swagger JSON that is generated looks like this:\r\n```JSON\r\n\"my_param\": {\r\n    \"type\": \"string\",\r\n    \"description\": \"this is my param that is supposed to be an array of strings\"\r\n}\r\n```\r\n\r\nNow, it looks like this:\r\n```JSON\r\n\"my_param\": {\r\n    \"type\": \"array\",\r\n    \"description\": \"This is my param that is an array of strings\",\r\n    \"items\": {\r\n        \"type\": \"string\"\r\n    }\r\n}\r\n```\r\n\r\n","created_at":"2016-06-13T23:05:07Z","updated_at":"2016-06-15T23:02:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc2d362d555851d0c58235b482e83f9c8475f7ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455/commits","review_comments_url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455/comments","review_comment_url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/455/comments","statuses_url":"https://api.github.com/repos/ruby-grape/grape-swagger/statuses/29afe070cfe640d7359e590f78b390a9ceb04f53","head":{"label":"TySpring:array-of-primitive-types","ref":"array-of-primitive-types","sha":"29afe070cfe640d7359e590f78b390a9ceb04f53","user":{"login":"TySpring","id":13591547,"avatar_url":"https://avatars.githubusercontent.com/u/13591547?v=3","gravatar_id":"","url":"https://api.github.com/users/TySpring","html_url":"https://github.com/TySpring","followers_url":"https://api.github.com/users/TySpring/followers","following_url":"https://api.github.com/users/TySpring/following{/other_user}","gists_url":"https://api.github.com/users/TySpring/gists{/gist_id}","starred_url":"https://api.github.com/users/TySpring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TySpring/subscriptions","organizations_url":"https://api.github.com/users/TySpring/orgs","repos_url":"https://api.github.com/users/TySpring/repos","events_url":"https://api.github.com/users/TySpring/events{/privacy}","received_events_url":"https://api.github.com/users/TySpring/received_events","type":"User","site_admin":false},"repo":{"id":60806150,"name":"grape-swagger","full_name":"TySpring/grape-swagger","owner":{"login":"TySpring","id":13591547,"avatar_url":"https://avatars.githubusercontent.com/u/13591547?v=3","gravatar_id":"","url":"https://api.github.com/users/TySpring","html_url":"https://github.com/TySpring","followers_url":"https://api.github.com/users/TySpring/followers","following_url":"https://api.github.com/users/TySpring/following{/other_user}","gists_url":"https://api.github.com/users/TySpring/gists{/gist_id}","starred_url":"https://api.github.com/users/TySpring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TySpring/subscriptions","organizations_url":"https://api.github.com/users/TySpring/orgs","repos_url":"https://api.github.com/users/TySpring/repos","events_url":"https://api.github.com/users/TySpring/events{/privacy}","received_events_url":"https://api.github.com/users/TySpring/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TySpring/grape-swagger","description":"Add swagger compliant documentation to your grape API","fork":true,"url":"https://api.github.com/repos/TySpring/grape-swagger","forks_url":"https://api.github.com/repos/TySpring/grape-swagger/forks","keys_url":"https://api.github.com/repos/TySpring/grape-swagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TySpring/grape-swagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TySpring/grape-swagger/teams","hooks_url":"https://api.github.com/repos/TySpring/grape-swagger/hooks","issue_events_url":"https://api.github.com/repos/TySpring/grape-swagger/issues/events{/number}","events_url":"https://api.github.com/repos/TySpring/grape-swagger/events","assignees_url":"https://api.github.com/repos/TySpring/grape-swagger/assignees{/user}","branches_url":"https://api.github.com/repos/TySpring/grape-swagger/branches{/branch}","tags_url":"https://api.github.com/repos/TySpring/grape-swagger/tags","blobs_url":"https://api.github.com/repos/TySpring/grape-swagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TySpring/grape-swagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TySpring/grape-swagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/TySpring/grape-swagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TySpring/grape-swagger/statuses/{sha}","languages_url":"https://api.github.com/repos/TySpring/grape-swagger/languages","stargazers_url":"https://api.github.com/repos/TySpring/grape-swagger/stargazers","contributors_url":"https://api.github.com/repos/TySpring/grape-swagger/contributors","subscribers_url":"https://api.github.com/repos/TySpring/grape-swagger/subscribers","subscription_url":"https://api.github.com/repos/TySpring/grape-swagger/subscription","commits_url":"https://api.github.com/repos/TySpring/grape-swagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/TySpring/grape-swagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/TySpring/grape-swagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/TySpring/grape-swagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/TySpring/grape-swagger/contents/{+path}","compare_url":"https://api.github.com/repos/TySpring/grape-swagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TySpring/grape-swagger/merges","archive_url":"https://api.github.com/repos/TySpring/grape-swagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TySpring/grape-swagger/downloads","issues_url":"https://api.github.com/repos/TySpring/grape-swagger/issues{/number}","pulls_url":"https://api.github.com/repos/TySpring/grape-swagger/pulls{/number}","milestones_url":"https://api.github.com/repos/TySpring/grape-swagger/milestones{/number}","notifications_url":"https://api.github.com/repos/TySpring/grape-swagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TySpring/grape-swagger/labels{/name}","releases_url":"https://api.github.com/repos/TySpring/grape-swagger/releases{/id}","deployments_url":"https://api.github.com/repos/TySpring/grape-swagger/deployments","created_at":"2016-06-09T20:51:06Z","updated_at":"2016-06-09T20:51:07Z","pushed_at":"2016-06-14T17:36:21Z","git_url":"git://github.com/TySpring/grape-swagger.git","ssh_url":"git@github.com:TySpring/grape-swagger.git","clone_url":"https://github.com/TySpring/grape-swagger.git","svn_url":"https://github.com/TySpring/grape-swagger","homepage":null,"size":1210,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ruby-grape:master","ref":"master","sha":"6ef800cd7c9e8287ffc35972ae1cf87755c81408","user":{"login":"ruby-grape","id":13624553,"avatar_url":"https://avatars.githubusercontent.com/u/13624553?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-grape","html_url":"https://github.com/ruby-grape","followers_url":"https://api.github.com/users/ruby-grape/followers","following_url":"https://api.github.com/users/ruby-grape/following{/other_user}","gists_url":"https://api.github.com/users/ruby-grape/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-grape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-grape/subscriptions","organizations_url":"https://api.github.com/users/ruby-grape/orgs","repos_url":"https://api.github.com/users/ruby-grape/repos","events_url":"https://api.github.com/users/ruby-grape/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-grape/received_events","type":"Organization","site_admin":false},"repo":{"id":5107466,"name":"grape-swagger","full_name":"ruby-grape/grape-swagger","owner":{"login":"ruby-grape","id":13624553,"avatar_url":"https://avatars.githubusercontent.com/u/13624553?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-grape","html_url":"https://github.com/ruby-grape","followers_url":"https://api.github.com/users/ruby-grape/followers","following_url":"https://api.github.com/users/ruby-grape/following{/other_user}","gists_url":"https://api.github.com/users/ruby-grape/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-grape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-grape/subscriptions","organizations_url":"https://api.github.com/users/ruby-grape/orgs","repos_url":"https://api.github.com/users/ruby-grape/repos","events_url":"https://api.github.com/users/ruby-grape/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-grape/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-grape/grape-swagger","description":"Add swagger compliant documentation to your grape API","fork":false,"url":"https://api.github.com/repos/ruby-grape/grape-swagger","forks_url":"https://api.github.com/repos/ruby-grape/grape-swagger/forks","keys_url":"https://api.github.com/repos/ruby-grape/grape-swagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-grape/grape-swagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-grape/grape-swagger/teams","hooks_url":"https://api.github.com/repos/ruby-grape/grape-swagger/hooks","issue_events_url":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-grape/grape-swagger/events","assignees_url":"https://api.github.com/repos/ruby-grape/grape-swagger/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-grape/grape-swagger/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-grape/grape-swagger/tags","blobs_url":"https://api.github.com/repos/ruby-grape/grape-swagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-grape/grape-swagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-grape/grape-swagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-grape/grape-swagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-grape/grape-swagger/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-grape/grape-swagger/languages","stargazers_url":"https://api.github.com/repos/ruby-grape/grape-swagger/stargazers","contributors_url":"https://api.github.com/repos/ruby-grape/grape-swagger/contributors","subscribers_url":"https://api.github.com/repos/ruby-grape/grape-swagger/subscribers","subscription_url":"https://api.github.com/repos/ruby-grape/grape-swagger/subscription","commits_url":"https://api.github.com/repos/ruby-grape/grape-swagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-grape/grape-swagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-grape/grape-swagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-grape/grape-swagger/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-grape/grape-swagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-grape/grape-swagger/merges","archive_url":"https://api.github.com/repos/ruby-grape/grape-swagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-grape/grape-swagger/downloads","issues_url":"https://api.github.com/repos/ruby-grape/grape-swagger/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-grape/grape-swagger/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-grape/grape-swagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-grape/grape-swagger/labels{/name}","releases_url":"https://api.github.com/repos/ruby-grape/grape-swagger/releases{/id}","deployments_url":"https://api.github.com/repos/ruby-grape/grape-swagger/deployments","created_at":"2012-07-19T08:39:49Z","updated_at":"2016-06-14T23:48:40Z","pushed_at":"2016-06-15T21:01:02Z","git_url":"git://github.com/ruby-grape/grape-swagger.git","ssh_url":"git@github.com:ruby-grape/grape-swagger.git","clone_url":"https://github.com/ruby-grape/grape-swagger.git","svn_url":"https://github.com/ruby-grape/grape-swagger","homepage":null,"size":1501,"stargazers_count":657,"watchers_count":657,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":327,"mirror_url":null,"open_issues_count":88,"forks":327,"open_issues":88,"watchers":657,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455"},"html":{"href":"https://github.com/ruby-grape/grape-swagger/pull/455"},"issue":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/455"},"comments":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/issues/455/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/pulls/455/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-grape/grape-swagger/statuses/29afe070cfe640d7359e590f78b390a9ceb04f53"}}}}
{"actor":{"display_login":"LeFnord"}}