{"action":"created","issue":{"url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/47","labels_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/47/comments","events_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/47/events","html_url":"https://github.com/tomas-abrahamsson/gpb/issues/47","id":118316028,"number":47,"title":"Name resolution issue in gpb_parse.post_process_all_files/2","user":{"login":"mmmries","id":80008,"avatar_url":"https://avatars.githubusercontent.com/u/80008?v=3","gravatar_id":"","url":"https://api.github.com/users/mmmries","html_url":"https://github.com/mmmries","followers_url":"https://api.github.com/users/mmmries/followers","following_url":"https://api.github.com/users/mmmries/following{/other_user}","gists_url":"https://api.github.com/users/mmmries/gists{/gist_id}","starred_url":"https://api.github.com/users/mmmries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmmries/subscriptions","organizations_url":"https://api.github.com/users/mmmries/orgs","repos_url":"https://api.github.com/users/mmmries/repos","events_url":"https://api.github.com/users/mmmries/events{/privacy}","received_events_url":"https://api.github.com/users/mmmries/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-23T03:52:28Z","updated_at":"2015-11-24T19:22:42Z","closed_at":"2015-11-24T15:56:52Z","body":"I have two simple proto files like this:\r\n\r\n### import.proto\r\n```protobuf\r\npackage chat;\r\nimport \"imported.proto\";\r\nmessage WebsocketServerContainer {\r\n  required string name = 1;\r\n  optional authorization.Failure failure = 2;\r\n}\r\n```\r\n\r\n### imported.proto\r\n```protobuf\r\npackage authorization;\r\nmessage Failure {\r\n  optional uint32 status_code = 1;\r\n  optional string reason = 2;\r\n}\r\n```\r\n\r\nI then scan, parse and `gpb_parse:post_process_one_file/1` each of these messages individually. Then when I merge these together into a single list of defs I get a data structure like:\r\n\r\n```erlang\r\n[\r\n  {package, [chat]},\r\n  {import, \"imported.proto\"},\r\n  {{msg, ['.', 'WebsocketServerContainer']},[\r\n    {field, name, 1, undefined, string, required, []},\r\n    {field, failure, 2, undefined, {ref, [authorization, '.', 'Failure']}, optional, []}\r\n  ]},\r\n  {package, [authorization]},\r\n  {{msg, ['.', 'Failure']},[\r\n    {field, status_code, 1, undefined, uint32, optional, []},\r\n    {field, reason, 2, undefined, string, optional, []}]\r\n  }\r\n]\r\n```\r\n\r\nAnd when I pass that to `gpb_parse:post_process_all_files/2` I get back an error tuple like:\r\n\r\n```erlang\r\n{error,[\r\n  {ref_to_undefined_msg_or_enum,{{\r\n    ['.','WebsocketServerContainer'],failure},\r\n    [authorization,'.','Failure']}}]}\r\n```\r\n\r\nI've also tried reversing the order of the defs so that `authorization.Failure` is passed in before it gets used, but that didn't work either. Am I missing a call somewhere?"},"comment":{"url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/comments/159379188","html_url":"https://github.com/tomas-abrahamsson/gpb/issues/47#issuecomment-159379188","issue_url":"https://api.github.com/repos/tomas-abrahamsson/gpb/issues/47","id":159379188,"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},"created_at":"2015-11-24T19:22:42Z","updated_at":"2015-11-24T19:22:42Z","body":"No problems at all! You're welcome!"}}