{"action":"created","comment":{"url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/comments/74718372","id":74718372,"diff_hunk":"@@ -1059,60 +1059,95 @@ opt_tuple_to_atom_if_defined_true(Opt, Opts) ->\n possibly_prefix_suffix_msgs(Defs, Opts) ->\n     Prefix = proplists:get_value(msg_name_prefix, Opts, \"\"),\n     Suffix = proplists:get_value(msg_name_suffix, Opts, \"\"),\n-    ToLower = proplists:get_value(msg_name_to_lower, Opts, false),\n-\n-    if Prefix == \"\", Suffix == \"\", ToLower == false ->\n+    ToLower = case proplists:get_value(msg_name_to_lower, Opts, false) of\n+                  false ->\n+                      false;\n+                  true ->\n+                      to_lower\n+              end,\n+    ToLowerOrSnake = case proplists:get_value(msg_name_to_snake_case, Opts, ToLower) of\n+                         true ->\n+                             snake_case;\n+                         T ->\n+                             T\n+                     end,\n+\n+    if Prefix == \"\", Suffix == \"\", ToLowerOrSnake == false ->\n             Defs;\n        true ->\n-            prefix_suffix_msgs(Prefix, Suffix, ToLower, Defs)\n+            prefix_suffix_msgs(Prefix, Suffix, ToLowerOrSnake, Defs)\n     end.\n \n \n-prefix_suffix_msgs(Prefix, Suffix, ToLower, Defs) ->\n+prefix_suffix_msgs(Prefix, Suffix, ToLowerOrSnake, Defs) ->\n     lists:map(fun({{msg,Name}, Fields}) ->\n-                      {{msg,prefix_suffix_name(Prefix, Suffix, ToLower, Name)},\n-                       prefix_suffix_fields(Prefix, Suffix, ToLower, Fields)};\n+                      {{msg,prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, Name)},\n+                       prefix_suffix_fields(Prefix, Suffix, ToLowerOrSnake, Fields)};\n                  ({{extensions,Name}, Exts}) ->\n                       {{extensions,\n-                        prefix_suffix_name(Prefix, Suffix, ToLower, Name)},\n+                        prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, Name)},\n                        Exts};\n                  ({{service,Name}, RPCs}) ->\n-                      {{service,maybe_tolower_name(Name, ToLower)},\n-                       prefix_suffix_rpcs(Prefix, Suffix, ToLower, RPCs)};\n+                      {{service, maybe_tolower_or_snake_name(Name, ToLowerOrSnake)},\n+                       prefix_suffix_rpcs(Prefix, Suffix, ToLowerOrSnake, RPCs)};\n                  ({package,Name}) ->\n-                      {package,maybe_tolower_name(Name,ToLower)};\n+                      {package, maybe_tolower_or_snake_name(Name,ToLowerOrSnake)};\n                  ({proto3_msgs,Names}) ->\n                       {proto3_msgs,\n-                       [prefix_suffix_name(Prefix, Suffix, ToLower, Name)\n+                       [prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, Name)\n                         || Name <- Names]};\n                  (OtherElem) ->\n                       OtherElem\n               end,\n               Defs).\n \n-prefix_suffix_fields(Prefix, Suffix, ToLower, Fields) ->\n+prefix_suffix_fields(Prefix, Suffix, ToLowerOrSnake, Fields) ->\n     lists:map(\n       fun(#?gpb_field{type={msg,MsgName}}=F) ->\n-              NewMsgName = prefix_suffix_name(Prefix, Suffix, ToLower, MsgName),\n+              NewMsgName = prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, MsgName),\n               F#?gpb_field{type={msg,NewMsgName}};\n+         (#?gpb_field{type={map,KeyType,{msg,MsgName}}}=F) ->\n+              NewMsgName = prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, MsgName),\n+              F#?gpb_field{type={map,KeyType,{msg,NewMsgName}}};\n+         (#gpb_oneof{fields=Fs}=F) ->\n+              Fs2 = prefix_suffix_fields(Prefix, Suffix, ToLowerOrSnake, Fs),\n+              F#gpb_oneof{fields=Fs2};\n          (#?gpb_field{}=F) ->\n               F\n       end,\n       Fields).\n \n-prefix_suffix_name(Prefix, Suffix, ToLower, Name) ->\n-    Name1 = maybe_tolower_name(Name, ToLower),\n-    Name2 = lists:concat([Prefix, Name1, Suffix]),\n+prefix_suffix_name(Prefix, Suffix, ToLowerOrSnake, Name) ->\n+    Name1 = maybe_tolower_or_snake_name(Name, ToLowerOrSnake),\n+    Prefix1 = case Prefix of\n+                  {by_proto, PrefixList} ->\n+                      proplists:get_value(Name1, PrefixList, \"\");","path":"src/gpb_parse.yrl","position":91,"original_position":83,"commit_id":"c474380b85f40ed82fbae3c2121c6b616c4baafd","original_commit_id":"dde28cbbfbd34924386da0d9c38318e2a792d1a9","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"body":"Hm, `post_process_all_files` has all msgs, including imported, already in the list of defs and no way (as far as I can tell) to know which proto each message came from, so I don't think that is going to work.","created_at":"2016-08-15T03:50:10Z","updated_at":"2016-08-15T03:50:10Z","html_url":"https://github.com/tomas-abrahamsson/gpb/pull/76#discussion_r74718372","pull_request_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/comments/74718372"},"html":{"href":"https://github.com/tomas-abrahamsson/gpb/pull/76#discussion_r74718372"},"pull_request":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76","id":81259917,"html_url":"https://github.com/tomas-abrahamsson/gpb/pull/76","diff_url":"https://github.com/tomas-abrahamsson/gpb/pull/76.diff","patch_url":"https://github.com/tomas-abrahamsson/gpb/pull/76.patch","issue_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/76","number":76,"state":"open","locked":false,"title":"Snake case support, by_proto prefix, oneof/maps fix","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"body":"This PR covers the issues: #73 #74 and #75 \r\n\r\nIn addition to adding `msg_name_to_snake_case`, `by_proto` and the fixes for oneof/maps this also has a few changes to make it work better with rebar3. Mainly moving the `compile_descriptor` hook to a `pre_hook` instead of `post`.","created_at":"2016-08-15T00:46:06Z","updated_at":"2016-08-15T03:50:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e36dc8d6d8a8ccfba9c0d17d768e3a9dce547734","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76/commits","review_comments_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76/comments","review_comment_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/76/comments","statuses_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/statuses/c474380b85f40ed82fbae3c2121c6b616c4baafd","head":{"label":"tsloughter:master","ref":"master","sha":"c474380b85f40ed82fbae3c2121c6b616c4baafd","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"repo":{"id":65640563,"name":"gpb","full_name":"tsloughter/gpb","owner":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsloughter/gpb","description":"A Google Protobuf implementation for Erlang","fork":true,"url":"https://api.github.com/repos/tsloughter/gpb","forks_url":"https://api.github.com/repos/tsloughter/gpb/forks","keys_url":"https://api.github.com/repos/tsloughter/gpb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsloughter/gpb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsloughter/gpb/teams","hooks_url":"https://api.github.com/repos/tsloughter/gpb/hooks","issue_events_url":"https://api.github.com/repos/tsloughter/gpb/issues/events{/number}","events_url":"https://api.github.com/repos/tsloughter/gpb/events","assignees_url":"https://api.github.com/repos/tsloughter/gpb/assignees{/user}","branches_url":"https://api.github.com/repos/tsloughter/gpb/branches{/branch}","tags_url":"https://api.github.com/repos/tsloughter/gpb/tags","blobs_url":"https://api.github.com/repos/tsloughter/gpb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsloughter/gpb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsloughter/gpb/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsloughter/gpb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsloughter/gpb/statuses/{sha}","languages_url":"https://api.github.com/repos/tsloughter/gpb/languages","stargazers_url":"https://api.github.com/repos/tsloughter/gpb/stargazers","contributors_url":"https://api.github.com/repos/tsloughter/gpb/contributors","subscribers_url":"https://api.github.com/repos/tsloughter/gpb/subscribers","subscription_url":"https://api.github.com/repos/tsloughter/gpb/subscription","commits_url":"https://api.github.com/repos/tsloughter/gpb/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsloughter/gpb/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsloughter/gpb/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsloughter/gpb/issues/comments{/number}","contents_url":"https://api.github.com/repos/tsloughter/gpb/contents/{+path}","compare_url":"https://api.github.com/repos/tsloughter/gpb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsloughter/gpb/merges","archive_url":"https://api.github.com/repos/tsloughter/gpb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsloughter/gpb/downloads","issues_url":"https://api.github.com/repos/tsloughter/gpb/issues{/number}","pulls_url":"https://api.github.com/repos/tsloughter/gpb/pulls{/number}","milestones_url":"https://api.github.com/repos/tsloughter/gpb/milestones{/number}","notifications_url":"https://api.github.com/repos/tsloughter/gpb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsloughter/gpb/labels{/name}","releases_url":"https://api.github.com/repos/tsloughter/gpb/releases{/id}","deployments_url":"https://api.github.com/repos/tsloughter/gpb/deployments","created_at":"2016-08-13T23:03:13Z","updated_at":"2016-08-13T23:03:15Z","pushed_at":"2016-08-15T03:10:44Z","git_url":"git://github.com/tsloughter/gpb.git","ssh_url":"git@github.com:tsloughter/gpb.git","clone_url":"https://github.com/tsloughter/gpb.git","svn_url":"https://github.com/tsloughter/gpb","homepage":"","size":2462,"stargazers_count":0,"watchers_count":0,"language":"Erlang","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":"tomas-abrahamsson:master","ref":"master","sha":"dde495ce3dcd4a58d55fdcaee8f2a18617b366b1","user":{"login":"tomas-abrahamsson","id":850307,"avatar_url":"https://avatars.githubusercontent.com/u/850307?v=3","gravatar_id":"","url":"https://api.github.com/users/tomas-abrahamsson","html_url":"https://github.com/tomas-abrahamsson","followers_url":"https://api.github.com/users/tomas-abrahamsson/followers","following_url":"https://api.github.com/users/tomas-abrahamsson/following{/other_user}","gists_url":"https://api.github.com/users/tomas-abrahamsson/gists{/gist_id}","starred_url":"https://api.github.com/users/tomas-abrahamsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomas-abrahamsson/subscriptions","organizations_url":"https://api.github.com/users/tomas-abrahamsson/orgs","repos_url":"https://api.github.com/users/tomas-abrahamsson/repos","events_url":"https://api.github.com/users/tomas-abrahamsson/events{/privacy}","received_events_url":"https://api.github.com/users/tomas-abrahamsson/received_events","type":"User","site_admin":false},"repo":{"id":2049737,"name":"gpb","full_name":"tomas-abrahamsson/gpb","owner":{"login":"tomas-abrahamsson","id":850307,"avatar_url":"https://avatars.githubusercontent.com/u/850307?v=3","gravatar_id":"","url":"https://api.github.com/users/tomas-abrahamsson","html_url":"https://github.com/tomas-abrahamsson","followers_url":"https://api.github.com/users/tomas-abrahamsson/followers","following_url":"https://api.github.com/users/tomas-abrahamsson/following{/other_user}","gists_url":"https://api.github.com/users/tomas-abrahamsson/gists{/gist_id}","starred_url":"https://api.github.com/users/tomas-abrahamsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomas-abrahamsson/subscriptions","organizations_url":"https://api.github.com/users/tomas-abrahamsson/orgs","repos_url":"https://api.github.com/users/tomas-abrahamsson/repos","events_url":"https://api.github.com/users/tomas-abrahamsson/events{/privacy}","received_events_url":"https://api.github.com/users/tomas-abrahamsson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomas-abrahamsson/gpb","description":"A Google Protobuf implementation for Erlang","fork":false,"url":"https://api.github.com/repos/tomas-abrahamsson/gpb","forks_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/forks","keys_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/teams","hooks_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/hooks","issue_events_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/events{/number}","events_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/events","assignees_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/assignees{/user}","branches_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/branches{/branch}","tags_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/tags","blobs_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/statuses/{sha}","languages_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/languages","stargazers_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/stargazers","contributors_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/contributors","subscribers_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/subscribers","subscription_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/subscription","commits_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/contents/{+path}","compare_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/merges","archive_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/downloads","issues_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues{/number}","pulls_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls{/number}","milestones_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/milestones{/number}","notifications_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/labels{/name}","releases_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/releases{/id}","deployments_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/deployments","created_at":"2011-07-14T20:51:33Z","updated_at":"2016-08-13T13:25:09Z","pushed_at":"2016-08-15T03:10:45Z","git_url":"git://github.com/tomas-abrahamsson/gpb.git","ssh_url":"git@github.com:tomas-abrahamsson/gpb.git","clone_url":"https://github.com/tomas-abrahamsson/gpb.git","svn_url":"https://github.com/tomas-abrahamsson/gpb","homepage":"","size":2523,"stargazers_count":119,"watchers_count":119,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":5,"forks":39,"open_issues":5,"watchers":119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76"},"html":{"href":"https://github.com/tomas-abrahamsson/gpb/pull/76"},"issue":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/76"},"comments":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/tomas-abrahamsson/gpb/statuses/c474380b85f40ed82fbae3c2121c6b616c4baafd"}}}}
{"actor":{"display_login":"tsloughter"}}