{"action":"created","comment":{"url":"https://api.github.com/repos/beego/bee/pulls/comments/82499733","pull_request_review_id":3405928,"id":82499733,"diff_hunk":"@@ -770,6 +770,30 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string\n \n \t\t\t\tvar tagValues []string\n \t\t\t\tstag := reflect.StructTag(strings.Trim(field.Tag.Value, \"`\"))\n+\t\t\t\t\n+\t\t\t\tdefaultValue := stag.Get(\"doc\")\n+\t\t\t\tif defaultValue != \"\"{\n+\t\t\t\t\tr, _ := regexp.Compile(`default\\((.*)\\)`)\n+\t\t\t\t\tif r.MatchString(defaultValue) {\n+\t\t\t\t\t\tres := r.FindStringSubmatch(defaultValue)\n+\t\t\t\t\t\tmp.Default = res[1]\n+\t\t\t\t\t\tswitch realType{\n+\t\t\t\t\t\t\tcase \"int\",\"int64\", \"int32\", \"int16\", \"int8\":\n+\t\t\t\t\t\t\t\tmp.Default, _ = strconv.Atoi(res[1])","path":"g_docs.go","position":13,"original_position":13,"commit_id":"31406ebe5a48da20cc37209da700e4c4f1bd13dc","original_commit_id":"31406ebe5a48da20cc37209da700e4c4f1bd13dc","user":{"login":"astaxie","id":233907,"avatar_url":"https://avatars.githubusercontent.com/u/233907?v=3","gravatar_id":"","url":"https://api.github.com/users/astaxie","html_url":"https://github.com/astaxie","followers_url":"https://api.github.com/users/astaxie/followers","following_url":"https://api.github.com/users/astaxie/following{/other_user}","gists_url":"https://api.github.com/users/astaxie/gists{/gist_id}","starred_url":"https://api.github.com/users/astaxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astaxie/subscriptions","organizations_url":"https://api.github.com/users/astaxie/orgs","repos_url":"https://api.github.com/users/astaxie/repos","events_url":"https://api.github.com/users/astaxie/events{/privacy}","received_events_url":"https://api.github.com/users/astaxie/received_events","type":"User","site_admin":false},"body":"I think we need to handler the error here and follow. As if the real type is int while the default value is not int. Then we need to panic it and tell the user which is wrong.","created_at":"2016-10-08T09:55:35Z","updated_at":"2016-10-08T09:55:39Z","html_url":"https://github.com/beego/bee/pull/292#discussion_r82499733","pull_request_url":"https://api.github.com/repos/beego/bee/pulls/292","_links":{"self":{"href":"https://api.github.com/repos/beego/bee/pulls/comments/82499733"},"html":{"href":"https://github.com/beego/bee/pull/292#discussion_r82499733"},"pull_request":{"href":"https://api.github.com/repos/beego/bee/pulls/292"}}},"pull_request":{"url":"https://api.github.com/repos/beego/bee/pulls/292","id":88538919,"html_url":"https://github.com/beego/bee/pull/292","diff_url":"https://github.com/beego/bee/pull/292.diff","patch_url":"https://github.com/beego/bee/pull/292.patch","issue_url":"https://api.github.com/repos/beego/bee/issues/292","number":292,"state":"open","locked":false,"title":"Default values in structure","user":{"login":"ihippik","id":7252016,"avatar_url":"https://avatars.githubusercontent.com/u/7252016?v=3","gravatar_id":"","url":"https://api.github.com/users/ihippik","html_url":"https://github.com/ihippik","followers_url":"https://api.github.com/users/ihippik/followers","following_url":"https://api.github.com/users/ihippik/following{/other_user}","gists_url":"https://api.github.com/users/ihippik/gists{/gist_id}","starred_url":"https://api.github.com/users/ihippik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihippik/subscriptions","organizations_url":"https://api.github.com/users/ihippik/orgs","repos_url":"https://api.github.com/users/ihippik/repos","events_url":"https://api.github.com/users/ihippik/events{/privacy}","received_events_url":"https://api.github.com/users/ihippik/received_events","type":"User","site_admin":false},"body":"Swagger default value for golang stucture.\r\n\r\nformat: \r\n`doc:\"default(my_defaul_value)\"`\r\n\r\n```\r\ntype MyStruct struct {\r\n\tTemplate string `json:\"template\" doc:\"default(<h1>Hello, {{ name }}! </h1>)\"`\r\n\tName string `json:\"name\"`\r\n\tMyNumber int64 `json:\"temp\"  doc:\"default(10)\"`\r\n\tMyBool bool `json:\"bl\"  doc:\"default(true)\"`\r\n\tMyFloat float64 `json:\"fl\"  doc:\"default(12.1234)\"`\r\n}\r\n```","created_at":"2016-10-08T08:35:51Z","updated_at":"2016-10-08T09:55:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ece6d743e2b9c7ef70881f5985dde0836ac5d6a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/beego/bee/pulls/292/commits","review_comments_url":"https://api.github.com/repos/beego/bee/pulls/292/comments","review_comment_url":"https://api.github.com/repos/beego/bee/pulls/comments{/number}","comments_url":"https://api.github.com/repos/beego/bee/issues/292/comments","statuses_url":"https://api.github.com/repos/beego/bee/statuses/31406ebe5a48da20cc37209da700e4c4f1bd13dc","head":{"label":"ihippik:patch-4","ref":"patch-4","sha":"31406ebe5a48da20cc37209da700e4c4f1bd13dc","user":{"login":"ihippik","id":7252016,"avatar_url":"https://avatars.githubusercontent.com/u/7252016?v=3","gravatar_id":"","url":"https://api.github.com/users/ihippik","html_url":"https://github.com/ihippik","followers_url":"https://api.github.com/users/ihippik/followers","following_url":"https://api.github.com/users/ihippik/following{/other_user}","gists_url":"https://api.github.com/users/ihippik/gists{/gist_id}","starred_url":"https://api.github.com/users/ihippik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihippik/subscriptions","organizations_url":"https://api.github.com/users/ihippik/orgs","repos_url":"https://api.github.com/users/ihippik/repos","events_url":"https://api.github.com/users/ihippik/events{/privacy}","received_events_url":"https://api.github.com/users/ihippik/received_events","type":"User","site_admin":false},"repo":{"id":65985947,"name":"bee","full_name":"ihippik/bee","owner":{"login":"ihippik","id":7252016,"avatar_url":"https://avatars.githubusercontent.com/u/7252016?v=3","gravatar_id":"","url":"https://api.github.com/users/ihippik","html_url":"https://github.com/ihippik","followers_url":"https://api.github.com/users/ihippik/followers","following_url":"https://api.github.com/users/ihippik/following{/other_user}","gists_url":"https://api.github.com/users/ihippik/gists{/gist_id}","starred_url":"https://api.github.com/users/ihippik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihippik/subscriptions","organizations_url":"https://api.github.com/users/ihippik/orgs","repos_url":"https://api.github.com/users/ihippik/repos","events_url":"https://api.github.com/users/ihippik/events{/privacy}","received_events_url":"https://api.github.com/users/ihippik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ihippik/bee","description":"Bee is a tool for helping develop with beego app framework.","fork":true,"url":"https://api.github.com/repos/ihippik/bee","forks_url":"https://api.github.com/repos/ihippik/bee/forks","keys_url":"https://api.github.com/repos/ihippik/bee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ihippik/bee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ihippik/bee/teams","hooks_url":"https://api.github.com/repos/ihippik/bee/hooks","issue_events_url":"https://api.github.com/repos/ihippik/bee/issues/events{/number}","events_url":"https://api.github.com/repos/ihippik/bee/events","assignees_url":"https://api.github.com/repos/ihippik/bee/assignees{/user}","branches_url":"https://api.github.com/repos/ihippik/bee/branches{/branch}","tags_url":"https://api.github.com/repos/ihippik/bee/tags","blobs_url":"https://api.github.com/repos/ihippik/bee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ihippik/bee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ihippik/bee/git/refs{/sha}","trees_url":"https://api.github.com/repos/ihippik/bee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ihippik/bee/statuses/{sha}","languages_url":"https://api.github.com/repos/ihippik/bee/languages","stargazers_url":"https://api.github.com/repos/ihippik/bee/stargazers","contributors_url":"https://api.github.com/repos/ihippik/bee/contributors","subscribers_url":"https://api.github.com/repos/ihippik/bee/subscribers","subscription_url":"https://api.github.com/repos/ihippik/bee/subscription","commits_url":"https://api.github.com/repos/ihippik/bee/commits{/sha}","git_commits_url":"https://api.github.com/repos/ihippik/bee/git/commits{/sha}","comments_url":"https://api.github.com/repos/ihippik/bee/comments{/number}","issue_comment_url":"https://api.github.com/repos/ihippik/bee/issues/comments{/number}","contents_url":"https://api.github.com/repos/ihippik/bee/contents/{+path}","compare_url":"https://api.github.com/repos/ihippik/bee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ihippik/bee/merges","archive_url":"https://api.github.com/repos/ihippik/bee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ihippik/bee/downloads","issues_url":"https://api.github.com/repos/ihippik/bee/issues{/number}","pulls_url":"https://api.github.com/repos/ihippik/bee/pulls{/number}","milestones_url":"https://api.github.com/repos/ihippik/bee/milestones{/number}","notifications_url":"https://api.github.com/repos/ihippik/bee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ihippik/bee/labels{/name}","releases_url":"https://api.github.com/repos/ihippik/bee/releases{/id}","deployments_url":"https://api.github.com/repos/ihippik/bee/deployments","created_at":"2016-08-18T09:50:55Z","updated_at":"2016-08-18T09:50:57Z","pushed_at":"2016-10-08T08:35:27Z","git_url":"git://github.com/ihippik/bee.git","ssh_url":"git@github.com:ihippik/bee.git","clone_url":"https://github.com/ihippik/bee.git","svn_url":"https://github.com/ihippik/bee","homepage":null,"size":590,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"beego:develop","ref":"develop","sha":"244e9ccdc972146bcd622565a75600950253a02c","user":{"login":"beego","id":3884041,"avatar_url":"https://avatars.githubusercontent.com/u/3884041?v=3","gravatar_id":"","url":"https://api.github.com/users/beego","html_url":"https://github.com/beego","followers_url":"https://api.github.com/users/beego/followers","following_url":"https://api.github.com/users/beego/following{/other_user}","gists_url":"https://api.github.com/users/beego/gists{/gist_id}","starred_url":"https://api.github.com/users/beego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beego/subscriptions","organizations_url":"https://api.github.com/users/beego/orgs","repos_url":"https://api.github.com/users/beego/repos","events_url":"https://api.github.com/users/beego/events{/privacy}","received_events_url":"https://api.github.com/users/beego/received_events","type":"Organization","site_admin":false},"repo":{"id":14003071,"name":"bee","full_name":"beego/bee","owner":{"login":"beego","id":3884041,"avatar_url":"https://avatars.githubusercontent.com/u/3884041?v=3","gravatar_id":"","url":"https://api.github.com/users/beego","html_url":"https://github.com/beego","followers_url":"https://api.github.com/users/beego/followers","following_url":"https://api.github.com/users/beego/following{/other_user}","gists_url":"https://api.github.com/users/beego/gists{/gist_id}","starred_url":"https://api.github.com/users/beego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beego/subscriptions","organizations_url":"https://api.github.com/users/beego/orgs","repos_url":"https://api.github.com/users/beego/repos","events_url":"https://api.github.com/users/beego/events{/privacy}","received_events_url":"https://api.github.com/users/beego/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/beego/bee","description":"Bee is a tool for helping develop with beego app framework.","fork":false,"url":"https://api.github.com/repos/beego/bee","forks_url":"https://api.github.com/repos/beego/bee/forks","keys_url":"https://api.github.com/repos/beego/bee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beego/bee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beego/bee/teams","hooks_url":"https://api.github.com/repos/beego/bee/hooks","issue_events_url":"https://api.github.com/repos/beego/bee/issues/events{/number}","events_url":"https://api.github.com/repos/beego/bee/events","assignees_url":"https://api.github.com/repos/beego/bee/assignees{/user}","branches_url":"https://api.github.com/repos/beego/bee/branches{/branch}","tags_url":"https://api.github.com/repos/beego/bee/tags","blobs_url":"https://api.github.com/repos/beego/bee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beego/bee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beego/bee/git/refs{/sha}","trees_url":"https://api.github.com/repos/beego/bee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beego/bee/statuses/{sha}","languages_url":"https://api.github.com/repos/beego/bee/languages","stargazers_url":"https://api.github.com/repos/beego/bee/stargazers","contributors_url":"https://api.github.com/repos/beego/bee/contributors","subscribers_url":"https://api.github.com/repos/beego/bee/subscribers","subscription_url":"https://api.github.com/repos/beego/bee/subscription","commits_url":"https://api.github.com/repos/beego/bee/commits{/sha}","git_commits_url":"https://api.github.com/repos/beego/bee/git/commits{/sha}","comments_url":"https://api.github.com/repos/beego/bee/comments{/number}","issue_comment_url":"https://api.github.com/repos/beego/bee/issues/comments{/number}","contents_url":"https://api.github.com/repos/beego/bee/contents/{+path}","compare_url":"https://api.github.com/repos/beego/bee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beego/bee/merges","archive_url":"https://api.github.com/repos/beego/bee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beego/bee/downloads","issues_url":"https://api.github.com/repos/beego/bee/issues{/number}","pulls_url":"https://api.github.com/repos/beego/bee/pulls{/number}","milestones_url":"https://api.github.com/repos/beego/bee/milestones{/number}","notifications_url":"https://api.github.com/repos/beego/bee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beego/bee/labels{/name}","releases_url":"https://api.github.com/repos/beego/bee/releases{/id}","deployments_url":"https://api.github.com/repos/beego/bee/deployments","created_at":"2013-10-30T23:53:16Z","updated_at":"2016-10-08T07:57:21Z","pushed_at":"2016-10-08T08:35:51Z","git_url":"git://github.com/beego/bee.git","ssh_url":"git@github.com:beego/bee.git","clone_url":"https://github.com/beego/bee.git","svn_url":"https://github.com/beego/bee","homepage":null,"size":854,"stargazers_count":310,"watchers_count":310,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":187,"mirror_url":null,"open_issues_count":91,"forks":187,"open_issues":91,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/beego/bee/pulls/292"},"html":{"href":"https://github.com/beego/bee/pull/292"},"issue":{"href":"https://api.github.com/repos/beego/bee/issues/292"},"comments":{"href":"https://api.github.com/repos/beego/bee/issues/292/comments"},"review_comments":{"href":"https://api.github.com/repos/beego/bee/pulls/292/comments"},"review_comment":{"href":"https://api.github.com/repos/beego/bee/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/beego/bee/pulls/292/commits"},"statuses":{"href":"https://api.github.com/repos/beego/bee/statuses/31406ebe5a48da20cc37209da700e4c4f1bd13dc"}}}}
{"actor":{"display_login":"astaxie"}}