{"action":"created","comment":{"url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/comments/189498265","pull_request_review_id":121687283,"id":189498265,"diff_hunk":"@@ -98,11 +106,29 @@ function ($value) {\n         $twig->addFunction(\n             new \\Twig_Function(\n                 'flowParameterType',\n-                function (\\Swagger\\Annotations\\Parameter $parameter) {\n+                function (\\Swagger\\Annotations\\Parameter $parameter) use ($swagger) {\n                     if ($parameter->enum) {\n                         return flowTypeEscape($parameter->type, $parameter->enum);\n                     }\n \n+                    if ($parameter->ref) {\n+                        foreach ($swagger->parameters as $param) {\n+                            $stripped = stripParameters($parameter->ref);\n+\n+                            if ($stripped === $param->name) {\n+                                if ($param->type === 'integer') {","path":"src/Command/Generate.php","position":30,"original_position":30,"commit_id":"45fe1a40a390914ac9b6185be88350eb242fbd73","original_commit_id":"45fe1a40a390914ac9b6185be88350eb242fbd73","user":{"login":"ovr","id":572096,"avatar_url":"https://avatars3.githubusercontent.com/u/572096?v=4","gravatar_id":"","url":"https://api.github.com/users/ovr","html_url":"https://github.com/ovr","followers_url":"https://api.github.com/users/ovr/followers","following_url":"https://api.github.com/users/ovr/following{/other_user}","gists_url":"https://api.github.com/users/ovr/gists{/gist_id}","starred_url":"https://api.github.com/users/ovr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovr/subscriptions","organizations_url":"https://api.github.com/users/ovr/orgs","repos_url":"https://api.github.com/users/ovr/repos","events_url":"https://api.github.com/users/ovr/events{/privacy}","received_events_url":"https://api.github.com/users/ovr/received_events","type":"User","site_admin":false},"body":"Тут стоять - смотри в twig что у нас юзается \r\n```\r\n{{ flowParameterType(parameter)|raw }}\r\n```\r\n\r\nflowParameterType - это фильтр - как раз на это дело ;)\r\n\r\nhttps://github.com/SocialConnect/swagger-codegen/blob/45fe1a40a390914ac9b6185be88350eb242fbd73/src/Command/Generate.php#L135\r\n\r\nи тут есть case на `integer`\r\n\r\nудали пожалуйста if и проверь еще раз\r\n\r\nСпасибо!","created_at":"2018-05-21T05:34:35Z","updated_at":"2018-05-21T05:34:35Z","html_url":"https://github.com/SocialConnect/swagger-codegen/pull/2#discussion_r189498265","pull_request_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/comments/189498265"},"html":{"href":"https://github.com/SocialConnect/swagger-codegen/pull/2#discussion_r189498265"},"pull_request":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2","id":189202670,"html_url":"https://github.com/SocialConnect/swagger-codegen/pull/2","diff_url":"https://github.com/SocialConnect/swagger-codegen/pull/2.diff","patch_url":"https://github.com/SocialConnect/swagger-codegen/pull/2.patch","issue_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/2","number":2,"state":"open","locked":false,"title":"[Feature] Allow to handle parameters which have declared as ref","user":{"login":"s0lus","id":4124371,"avatar_url":"https://avatars2.githubusercontent.com/u/4124371?v=4","gravatar_id":"","url":"https://api.github.com/users/s0lus","html_url":"https://github.com/s0lus","followers_url":"https://api.github.com/users/s0lus/followers","following_url":"https://api.github.com/users/s0lus/following{/other_user}","gists_url":"https://api.github.com/users/s0lus/gists{/gist_id}","starred_url":"https://api.github.com/users/s0lus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s0lus/subscriptions","organizations_url":"https://api.github.com/users/s0lus/orgs","repos_url":"https://api.github.com/users/s0lus/repos","events_url":"https://api.github.com/users/s0lus/events{/privacy}","received_events_url":"https://api.github.com/users/s0lus/received_events","type":"User","site_admin":false},"body":"Hey, @ovr!\r\n\r\nI want to extend functional for this tool. And i want to add handling of parameters, which declared as`ref`. I have a example to simplify understand for what this feature do.\r\n\r\n**TL;DR** Properly handling swagger definitions, which have a following view: ` @SWG\\Parameter(ref=\"#/parameters/fields\")`\r\n\r\nFor example i have definitions for fields `fields`, which i will reuse in other definitions (i.e. in many other places)\r\n\r\n```php\r\n/**\r\n *  @SWG\\Parameter(\r\n *    name=\"fields\",\r\n *    type=\"string\",\r\n *    in=\"query\",\r\n *    description=\"description\"\r\n *  )\r\n */\r\n```\r\n\r\nUsage:\r\n\r\n```php\r\n/**\r\n * @SWG\\Get(\r\n *  tags={\"Tags\"},\r\n *  path=\"path\",\r\n *  operationId=\"operationId\",\r\n *  @SWG\\Parameter(ref=\"#/parameters/fields\"),\r\n * )\r\n */\r\n```\r\n\r\n**Expected output will be:**\r\n```js\r\nfields?: string\r\n```\r\n\r\n**Actual output:** (because it's not handling properly)\r\n```js\r\n?:\r\n```\r\n\r\nThanks, and have a nice day!","created_at":"2018-05-19T19:18:46Z","updated_at":"2018-05-21T05:34:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a4ad1b0a43fc9994c572e50f7bbe67508246c60","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2/commits","review_comments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2/comments","review_comment_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/2/comments","statuses_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/statuses/45fe1a40a390914ac9b6185be88350eb242fbd73","head":{"label":"SocialConnect:strip-parameters","ref":"strip-parameters","sha":"45fe1a40a390914ac9b6185be88350eb242fbd73","user":{"login":"SocialConnect","id":8386838,"avatar_url":"https://avatars2.githubusercontent.com/u/8386838?v=4","gravatar_id":"","url":"https://api.github.com/users/SocialConnect","html_url":"https://github.com/SocialConnect","followers_url":"https://api.github.com/users/SocialConnect/followers","following_url":"https://api.github.com/users/SocialConnect/following{/other_user}","gists_url":"https://api.github.com/users/SocialConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/SocialConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SocialConnect/subscriptions","organizations_url":"https://api.github.com/users/SocialConnect/orgs","repos_url":"https://api.github.com/users/SocialConnect/repos","events_url":"https://api.github.com/users/SocialConnect/events{/privacy}","received_events_url":"https://api.github.com/users/SocialConnect/received_events","type":"Organization","site_admin":false},"repo":{"id":85779790,"name":"swagger-codegen","full_name":"SocialConnect/swagger-codegen","owner":{"login":"SocialConnect","id":8386838,"avatar_url":"https://avatars2.githubusercontent.com/u/8386838?v=4","gravatar_id":"","url":"https://api.github.com/users/SocialConnect","html_url":"https://github.com/SocialConnect","followers_url":"https://api.github.com/users/SocialConnect/followers","following_url":"https://api.github.com/users/SocialConnect/following{/other_user}","gists_url":"https://api.github.com/users/SocialConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/SocialConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SocialConnect/subscriptions","organizations_url":"https://api.github.com/users/SocialConnect/orgs","repos_url":"https://api.github.com/users/SocialConnect/repos","events_url":"https://api.github.com/users/SocialConnect/events{/privacy}","received_events_url":"https://api.github.com/users/SocialConnect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SocialConnect/swagger-codegen","description":"Generate your clients by Swagger Spec","fork":false,"url":"https://api.github.com/repos/SocialConnect/swagger-codegen","forks_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/forks","keys_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/teams","hooks_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/hooks","issue_events_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/events{/number}","events_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/events","assignees_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/assignees{/user}","branches_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/branches{/branch}","tags_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/tags","blobs_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/refs{/sha}","trees_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/statuses/{sha}","languages_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/languages","stargazers_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/stargazers","contributors_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/contributors","subscribers_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/subscribers","subscription_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/subscription","commits_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/commits{/sha}","git_commits_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/commits{/sha}","comments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/comments{/number}","issue_comment_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/comments{/number}","contents_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/contents/{+path}","compare_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/merges","archive_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/downloads","issues_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues{/number}","pulls_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls{/number}","milestones_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/milestones{/number}","notifications_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/labels{/name}","releases_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/releases{/id}","deployments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/deployments","created_at":"2017-03-22T03:15:41Z","updated_at":"2018-04-21T19:39:36Z","pushed_at":"2018-05-19T19:19:25Z","git_url":"git://github.com/SocialConnect/swagger-codegen.git","ssh_url":"git@github.com:SocialConnect/swagger-codegen.git","clone_url":"https://github.com/SocialConnect/swagger-codegen.git","svn_url":"https://github.com/SocialConnect/swagger-codegen","homepage":"","size":116,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"SocialConnect:master","ref":"master","sha":"8f593812abf72fd87894a6bb37031785301b5d7a","user":{"login":"SocialConnect","id":8386838,"avatar_url":"https://avatars2.githubusercontent.com/u/8386838?v=4","gravatar_id":"","url":"https://api.github.com/users/SocialConnect","html_url":"https://github.com/SocialConnect","followers_url":"https://api.github.com/users/SocialConnect/followers","following_url":"https://api.github.com/users/SocialConnect/following{/other_user}","gists_url":"https://api.github.com/users/SocialConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/SocialConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SocialConnect/subscriptions","organizations_url":"https://api.github.com/users/SocialConnect/orgs","repos_url":"https://api.github.com/users/SocialConnect/repos","events_url":"https://api.github.com/users/SocialConnect/events{/privacy}","received_events_url":"https://api.github.com/users/SocialConnect/received_events","type":"Organization","site_admin":false},"repo":{"id":85779790,"name":"swagger-codegen","full_name":"SocialConnect/swagger-codegen","owner":{"login":"SocialConnect","id":8386838,"avatar_url":"https://avatars2.githubusercontent.com/u/8386838?v=4","gravatar_id":"","url":"https://api.github.com/users/SocialConnect","html_url":"https://github.com/SocialConnect","followers_url":"https://api.github.com/users/SocialConnect/followers","following_url":"https://api.github.com/users/SocialConnect/following{/other_user}","gists_url":"https://api.github.com/users/SocialConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/SocialConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SocialConnect/subscriptions","organizations_url":"https://api.github.com/users/SocialConnect/orgs","repos_url":"https://api.github.com/users/SocialConnect/repos","events_url":"https://api.github.com/users/SocialConnect/events{/privacy}","received_events_url":"https://api.github.com/users/SocialConnect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SocialConnect/swagger-codegen","description":"Generate your clients by Swagger Spec","fork":false,"url":"https://api.github.com/repos/SocialConnect/swagger-codegen","forks_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/forks","keys_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/teams","hooks_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/hooks","issue_events_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/events{/number}","events_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/events","assignees_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/assignees{/user}","branches_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/branches{/branch}","tags_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/tags","blobs_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/refs{/sha}","trees_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/statuses/{sha}","languages_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/languages","stargazers_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/stargazers","contributors_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/contributors","subscribers_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/subscribers","subscription_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/subscription","commits_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/commits{/sha}","git_commits_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/git/commits{/sha}","comments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/comments{/number}","issue_comment_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/comments{/number}","contents_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/contents/{+path}","compare_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/merges","archive_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/downloads","issues_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues{/number}","pulls_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls{/number}","milestones_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/milestones{/number}","notifications_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/labels{/name}","releases_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/releases{/id}","deployments_url":"https://api.github.com/repos/SocialConnect/swagger-codegen/deployments","created_at":"2017-03-22T03:15:41Z","updated_at":"2018-04-21T19:39:36Z","pushed_at":"2018-05-19T19:19:25Z","git_url":"git://github.com/SocialConnect/swagger-codegen.git","ssh_url":"git@github.com:SocialConnect/swagger-codegen.git","clone_url":"https://github.com/SocialConnect/swagger-codegen.git","svn_url":"https://github.com/SocialConnect/swagger-codegen","homepage":"","size":116,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2"},"html":{"href":"https://github.com/SocialConnect/swagger-codegen/pull/2"},"issue":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/2"},"comments":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/SocialConnect/swagger-codegen/statuses/45fe1a40a390914ac9b6185be88350eb242fbd73"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ovr"}}