{"action":"created","comment":{"url":"https://api.github.com/repos/Clever/wag/pulls/comments/77397084","id":77397084,"diff_hunk":"@@ -0,0 +1,35 @@\n+package swagger\n+\n+import (\n+\t\"regexp\"\n+\n+\t\"github.com/go-openapi/strfmt\"\n+)\n+\n+func InitCustomFormats() {\n+\tm := mongoID(\"\")\n+\tstrfmt.Default.Add(\"mongo-id\", &m, isMongoID)\n+}\n+\n+var mongoRegExp = regexp.MustCompile(\"^[0-9a-f]{24}$\")\n+\n+func isMongoID(str string) bool {\n+\treturn mongoRegExp.MatchString(str)","path":"swagger/formats.go","position":17,"original_position":17,"commit_id":"e86e66f86c2e1c53c3a85141c01c06edbf4c2df6","original_commit_id":"dc6cd7afd00e9b23865cc4787d7d53ca19508fc2","user":{"login":"kvigen","id":5514539,"avatar_url":"https://avatars.githubusercontent.com/u/5514539?v=3","gravatar_id":"","url":"https://api.github.com/users/kvigen","html_url":"https://github.com/kvigen","followers_url":"https://api.github.com/users/kvigen/followers","following_url":"https://api.github.com/users/kvigen/following{/other_user}","gists_url":"https://api.github.com/users/kvigen/gists{/gist_id}","starred_url":"https://api.github.com/users/kvigen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvigen/subscriptions","organizations_url":"https://api.github.com/users/kvigen/orgs","repos_url":"https://api.github.com/users/kvigen/repos","events_url":"https://api.github.com/users/kvigen/events{/privacy}","received_events_url":"https://api.github.com/users/kvigen/received_events","type":"User","site_admin":false},"body":"Oh, and one other thing. I couldn't see a way to make types marked `mongo-id` into `bson.ObjectId` in the go-swagger generated types, so our models would still be strings, and the inconsistency didn't seem great.","created_at":"2016-09-02T19:03:54Z","updated_at":"2016-09-02T19:03:54Z","html_url":"https://github.com/Clever/wag/pull/43#discussion_r77397084","pull_request_url":"https://api.github.com/repos/Clever/wag/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/Clever/wag/pulls/comments/77397084"},"html":{"href":"https://github.com/Clever/wag/pull/43#discussion_r77397084"},"pull_request":{"href":"https://api.github.com/repos/Clever/wag/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/Clever/wag/pulls/43","id":83718843,"html_url":"https://github.com/Clever/wag/pull/43","diff_url":"https://github.com/Clever/wag/pull/43.diff","patch_url":"https://github.com/Clever/wag/pull/43.patch","issue_url":"https://api.github.com/repos/Clever/wag/issues/43","number":43,"state":"open","locked":false,"title":"Custom string formats","user":{"login":"kvigen","id":5514539,"avatar_url":"https://avatars.githubusercontent.com/u/5514539?v=3","gravatar_id":"","url":"https://api.github.com/users/kvigen","html_url":"https://github.com/kvigen","followers_url":"https://api.github.com/users/kvigen/followers","following_url":"https://api.github.com/users/kvigen/following{/other_user}","gists_url":"https://api.github.com/users/kvigen/gists{/gist_id}","starred_url":"https://api.github.com/users/kvigen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvigen/subscriptions","organizations_url":"https://api.github.com/users/kvigen/orgs","repos_url":"https://api.github.com/users/kvigen/repos","events_url":"https://api.github.com/users/kvigen/events{/privacy}","received_events_url":"https://api.github.com/users/kvigen/received_events","type":"User","site_admin":false},"body":"This adds support for a `mongo-id` string format. It can be defined with a swagger.yml like:\r\n```\r\nauthorID:\r\n  type: string\r\n  format: mongo-id\r\n```\r\n\r\nRight now it only applies to input parameters because as far as I can tell go-swagger doesn't add that type of validation to the objects defined in '#/definitions`. I think that's fine for now, as we can see how people use this and then adjust.","created_at":"2016-09-01T22:37:05Z","updated_at":"2016-09-02T19:03:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3600928230867515b0929fd926ffa7be61b0e89","assignee":{"login":"kvigen","id":5514539,"avatar_url":"https://avatars.githubusercontent.com/u/5514539?v=3","gravatar_id":"","url":"https://api.github.com/users/kvigen","html_url":"https://github.com/kvigen","followers_url":"https://api.github.com/users/kvigen/followers","following_url":"https://api.github.com/users/kvigen/following{/other_user}","gists_url":"https://api.github.com/users/kvigen/gists{/gist_id}","starred_url":"https://api.github.com/users/kvigen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvigen/subscriptions","organizations_url":"https://api.github.com/users/kvigen/orgs","repos_url":"https://api.github.com/users/kvigen/repos","events_url":"https://api.github.com/users/kvigen/events{/privacy}","received_events_url":"https://api.github.com/users/kvigen/received_events","type":"User","site_admin":false},"assignees":[{"login":"kvigen","id":5514539,"avatar_url":"https://avatars.githubusercontent.com/u/5514539?v=3","gravatar_id":"","url":"https://api.github.com/users/kvigen","html_url":"https://github.com/kvigen","followers_url":"https://api.github.com/users/kvigen/followers","following_url":"https://api.github.com/users/kvigen/following{/other_user}","gists_url":"https://api.github.com/users/kvigen/gists{/gist_id}","starred_url":"https://api.github.com/users/kvigen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvigen/subscriptions","organizations_url":"https://api.github.com/users/kvigen/orgs","repos_url":"https://api.github.com/users/kvigen/repos","events_url":"https://api.github.com/users/kvigen/events{/privacy}","received_events_url":"https://api.github.com/users/kvigen/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Clever/wag/pulls/43/commits","review_comments_url":"https://api.github.com/repos/Clever/wag/pulls/43/comments","review_comment_url":"https://api.github.com/repos/Clever/wag/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Clever/wag/issues/43/comments","statuses_url":"https://api.github.com/repos/Clever/wag/statuses/e86e66f86c2e1c53c3a85141c01c06edbf4c2df6","head":{"label":"Clever:custom-string-formats","ref":"custom-string-formats","sha":"e86e66f86c2e1c53c3a85141c01c06edbf4c2df6","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":65332703,"name":"wag","full_name":"Clever/wag","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/wag","description":"sWAGger - Web API Generator","fork":false,"url":"https://api.github.com/repos/Clever/wag","forks_url":"https://api.github.com/repos/Clever/wag/forks","keys_url":"https://api.github.com/repos/Clever/wag/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/wag/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/wag/teams","hooks_url":"https://api.github.com/repos/Clever/wag/hooks","issue_events_url":"https://api.github.com/repos/Clever/wag/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/wag/events","assignees_url":"https://api.github.com/repos/Clever/wag/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/wag/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/wag/tags","blobs_url":"https://api.github.com/repos/Clever/wag/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/wag/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/wag/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/wag/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/wag/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/wag/languages","stargazers_url":"https://api.github.com/repos/Clever/wag/stargazers","contributors_url":"https://api.github.com/repos/Clever/wag/contributors","subscribers_url":"https://api.github.com/repos/Clever/wag/subscribers","subscription_url":"https://api.github.com/repos/Clever/wag/subscription","commits_url":"https://api.github.com/repos/Clever/wag/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/wag/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/wag/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/wag/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/wag/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/wag/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/wag/merges","archive_url":"https://api.github.com/repos/Clever/wag/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/wag/downloads","issues_url":"https://api.github.com/repos/Clever/wag/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/wag/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/wag/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/wag/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/wag/labels{/name}","releases_url":"https://api.github.com/repos/Clever/wag/releases{/id}","deployments_url":"https://api.github.com/repos/Clever/wag/deployments","created_at":"2016-08-09T22:34:45Z","updated_at":"2016-08-09T23:19:20Z","pushed_at":"2016-09-02T02:19:49Z","git_url":"git://github.com/Clever/wag.git","ssh_url":"git@github.com:Clever/wag.git","clone_url":"https://github.com/Clever/wag.git","svn_url":"https://github.com/Clever/wag","homepage":null,"size":11332,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"Clever:master","ref":"master","sha":"55ff8999b6f5b044550f2ae892e6156c5465e750","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":65332703,"name":"wag","full_name":"Clever/wag","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/wag","description":"sWAGger - Web API Generator","fork":false,"url":"https://api.github.com/repos/Clever/wag","forks_url":"https://api.github.com/repos/Clever/wag/forks","keys_url":"https://api.github.com/repos/Clever/wag/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/wag/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/wag/teams","hooks_url":"https://api.github.com/repos/Clever/wag/hooks","issue_events_url":"https://api.github.com/repos/Clever/wag/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/wag/events","assignees_url":"https://api.github.com/repos/Clever/wag/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/wag/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/wag/tags","blobs_url":"https://api.github.com/repos/Clever/wag/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/wag/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/wag/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/wag/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/wag/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/wag/languages","stargazers_url":"https://api.github.com/repos/Clever/wag/stargazers","contributors_url":"https://api.github.com/repos/Clever/wag/contributors","subscribers_url":"https://api.github.com/repos/Clever/wag/subscribers","subscription_url":"https://api.github.com/repos/Clever/wag/subscription","commits_url":"https://api.github.com/repos/Clever/wag/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/wag/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/wag/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/wag/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/wag/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/wag/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/wag/merges","archive_url":"https://api.github.com/repos/Clever/wag/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/wag/downloads","issues_url":"https://api.github.com/repos/Clever/wag/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/wag/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/wag/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/wag/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/wag/labels{/name}","releases_url":"https://api.github.com/repos/Clever/wag/releases{/id}","deployments_url":"https://api.github.com/repos/Clever/wag/deployments","created_at":"2016-08-09T22:34:45Z","updated_at":"2016-08-09T23:19:20Z","pushed_at":"2016-09-02T02:19:49Z","git_url":"git://github.com/Clever/wag.git","ssh_url":"git@github.com:Clever/wag.git","clone_url":"https://github.com/Clever/wag.git","svn_url":"https://github.com/Clever/wag","homepage":null,"size":11332,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Clever/wag/pulls/43"},"html":{"href":"https://github.com/Clever/wag/pull/43"},"issue":{"href":"https://api.github.com/repos/Clever/wag/issues/43"},"comments":{"href":"https://api.github.com/repos/Clever/wag/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/Clever/wag/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/Clever/wag/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Clever/wag/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/Clever/wag/statuses/e86e66f86c2e1c53c3a85141c01c06edbf4c2df6"}}}}
{"actor":{"display_login":"kvigen"}}