{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-protobuf/pulls/comments/92661854","pull_request_review_id":13181807,"id":92661854,"diff_hunk":"@@ -0,0 +1,132 @@\n+// ProtobufRuntime/Sources/Protobuf/ProtobufTextEncoding.swift - Text format encoding support\n+//\n+// This source file is part of the Swift.org open source project\n+//\n+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors\n+// Licensed under Apache License v2.0 with Runtime Library Exception\n+//\n+// See http://swift.org/LICENSE.txt for license information\n+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors\n+//\n+// -----------------------------------------------------------------------------\n+///\n+/// Text format serialization engine.\n+///\n+// -----------------------------------------------------------------------------\n+\n+import Foundation\n+\n+public struct TextEncodingVisitor: Visitor {\n+    private var encoder: TextEncoder\n+    public var result: String {return encoder.result}\n+    private var nameResolver: (Int) -> String?\n+\n+    public init(message: Message) throws {\n+        self.encoder = TextEncoder()\n+        self.nameResolver =\n+            ProtoNameResolvers.protoFieldNameResolver(for: message)\n+        try withAbstractVisitor {(visitor: inout Visitor) in\n+            try message.traverse(visitor: &visitor)\n+        }\n+    }\n+\n+    public init(message: Message, encoder: TextEncoder) throws {\n+        self.encoder = encoder\n+        self.nameResolver =\n+            ProtoNameResolvers.protoFieldNameResolver(for: message)\n+        try withAbstractVisitor {(visitor: inout Visitor) in\n+            try message.traverse(visitor: &visitor)\n+        }\n+    }\n+\n+    mutating public func withAbstractVisitor(clause: (inout Visitor) throws -> ()) throws {\n+        var visitor: Visitor = self\n+        try clause(&visitor)\n+        encoder.text = (visitor as! TextEncodingVisitor).encoder.text\n+    }\n+\n+    mutating public func visitUnknown(bytes: Data) {\n+        // TODO: Does text encoding have any provision for representing proto2 unknown field?","path":"Sources/SwiftProtobuf/TextEncodingVisitor.swift","position":49,"original_position":49,"commit_id":"9131ed1faf86bfcd1fa28af275daf3c3685b83e2","original_commit_id":"9131ed1faf86bfcd1fa28af275daf3c3685b83e2","user":{"login":"thomasvl","id":5279928,"avatar_url":"https://avatars.githubusercontent.com/u/5279928?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasvl","html_url":"https://github.com/thomasvl","followers_url":"https://api.github.com/users/thomasvl/followers","following_url":"https://api.github.com/users/thomasvl/following{/other_user}","gists_url":"https://api.github.com/users/thomasvl/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasvl/subscriptions","organizations_url":"https://api.github.com/users/thomasvl/orgs","repos_url":"https://api.github.com/users/thomasvl/repos","events_url":"https://api.github.com/users/thomasvl/events{/privacy}","received_events_url":"https://api.github.com/users/thomasvl/received_events","type":"User","site_admin":false},"body":"If we do swap debugDescription to use text format (#148), we likely will want them so the info is complete.","created_at":"2016-12-15T17:47:13Z","updated_at":"2016-12-15T17:47:13Z","html_url":"https://github.com/apple/swift-protobuf/pull/169#discussion_r92661854","pull_request_url":"https://api.github.com/repos/apple/swift-protobuf/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/comments/92661854"},"html":{"href":"https://github.com/apple/swift-protobuf/pull/169#discussion_r92661854"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift-protobuf/pulls/169","id":97402948,"html_url":"https://github.com/apple/swift-protobuf/pull/169","diff_url":"https://github.com/apple/swift-protobuf/pull/169.diff","patch_url":"https://github.com/apple/swift-protobuf/pull/169.patch","issue_url":"https://api.github.com/repos/apple/swift-protobuf/issues/169","number":169,"state":"open","locked":false,"title":"Protobuf text format support","user":{"login":"tbkka","id":21696764,"avatar_url":"https://avatars.githubusercontent.com/u/21696764?v=3","gravatar_id":"","url":"https://api.github.com/users/tbkka","html_url":"https://github.com/tbkka","followers_url":"https://api.github.com/users/tbkka/followers","following_url":"https://api.github.com/users/tbkka/following{/other_user}","gists_url":"https://api.github.com/users/tbkka/gists{/gist_id}","starred_url":"https://api.github.com/users/tbkka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbkka/subscriptions","organizations_url":"https://api.github.com/users/tbkka/orgs","repos_url":"https://api.github.com/users/tbkka/repos","events_url":"https://api.github.com/users/tbkka/events{/privacy}","received_events_url":"https://api.github.com/users/tbkka/received_events","type":"User","site_admin":false},"body":"I forked the initial text format support by @BradLarson and am in the process of significantly overhauling it:\r\n* Many more tests, most copied directly from Google's C++ unit tests\r\n* Much simplified compared to the original JSON support code\r\n* Corrected support for number formats (octal, hex, decimal integers)\r\n* Corrected support for bytes fields\r\n* Corrected support for UTF-8 strings\r\n* Support for a lot of legacy variations (e.g., semicolons between message fields, \"<...>\" message syntax, etc\r\n* Support for maps\r\n* Extensions\r\n* Handling of WKTs, including Google's specialized Any format.\r\n","created_at":"2016-12-10T00:20:06Z","updated_at":"2016-12-15T17:47:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53749ca85fa0af0ae6db17bb48b174a19f8eb1fd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-protobuf/pulls/169/commits","review_comments_url":"https://api.github.com/repos/apple/swift-protobuf/pulls/169/comments","review_comment_url":"https://api.github.com/repos/apple/swift-protobuf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift-protobuf/issues/169/comments","statuses_url":"https://api.github.com/repos/apple/swift-protobuf/statuses/9131ed1faf86bfcd1fa28af275daf3c3685b83e2","head":{"label":"tbkka:tbkka-protobuf-text","ref":"tbkka-protobuf-text","sha":"9131ed1faf86bfcd1fa28af275daf3c3685b83e2","user":{"login":"tbkka","id":21696764,"avatar_url":"https://avatars.githubusercontent.com/u/21696764?v=3","gravatar_id":"","url":"https://api.github.com/users/tbkka","html_url":"https://github.com/tbkka","followers_url":"https://api.github.com/users/tbkka/followers","following_url":"https://api.github.com/users/tbkka/following{/other_user}","gists_url":"https://api.github.com/users/tbkka/gists{/gist_id}","starred_url":"https://api.github.com/users/tbkka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbkka/subscriptions","organizations_url":"https://api.github.com/users/tbkka/orgs","repos_url":"https://api.github.com/users/tbkka/repos","events_url":"https://api.github.com/users/tbkka/events{/privacy}","received_events_url":"https://api.github.com/users/tbkka/received_events","type":"User","site_admin":false},"repo":{"id":69613338,"name":"swift-protobuf","full_name":"tbkka/swift-protobuf","owner":{"login":"tbkka","id":21696764,"avatar_url":"https://avatars.githubusercontent.com/u/21696764?v=3","gravatar_id":"","url":"https://api.github.com/users/tbkka","html_url":"https://github.com/tbkka","followers_url":"https://api.github.com/users/tbkka/followers","following_url":"https://api.github.com/users/tbkka/following{/other_user}","gists_url":"https://api.github.com/users/tbkka/gists{/gist_id}","starred_url":"https://api.github.com/users/tbkka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbkka/subscriptions","organizations_url":"https://api.github.com/users/tbkka/orgs","repos_url":"https://api.github.com/users/tbkka/repos","events_url":"https://api.github.com/users/tbkka/events{/privacy}","received_events_url":"https://api.github.com/users/tbkka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tbkka/swift-protobuf","description":"Plugin and runtime library for using protobuf with Swift","fork":true,"url":"https://api.github.com/repos/tbkka/swift-protobuf","forks_url":"https://api.github.com/repos/tbkka/swift-protobuf/forks","keys_url":"https://api.github.com/repos/tbkka/swift-protobuf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tbkka/swift-protobuf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tbkka/swift-protobuf/teams","hooks_url":"https://api.github.com/repos/tbkka/swift-protobuf/hooks","issue_events_url":"https://api.github.com/repos/tbkka/swift-protobuf/issues/events{/number}","events_url":"https://api.github.com/repos/tbkka/swift-protobuf/events","assignees_url":"https://api.github.com/repos/tbkka/swift-protobuf/assignees{/user}","branches_url":"https://api.github.com/repos/tbkka/swift-protobuf/branches{/branch}","tags_url":"https://api.github.com/repos/tbkka/swift-protobuf/tags","blobs_url":"https://api.github.com/repos/tbkka/swift-protobuf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tbkka/swift-protobuf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tbkka/swift-protobuf/git/refs{/sha}","trees_url":"https://api.github.com/repos/tbkka/swift-protobuf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tbkka/swift-protobuf/statuses/{sha}","languages_url":"https://api.github.com/repos/tbkka/swift-protobuf/languages","stargazers_url":"https://api.github.com/repos/tbkka/swift-protobuf/stargazers","contributors_url":"https://api.github.com/repos/tbkka/swift-protobuf/contributors","subscribers_url":"https://api.github.com/repos/tbkka/swift-protobuf/subscribers","subscription_url":"https://api.github.com/repos/tbkka/swift-protobuf/subscription","commits_url":"https://api.github.com/repos/tbkka/swift-protobuf/commits{/sha}","git_commits_url":"https://api.github.com/repos/tbkka/swift-protobuf/git/commits{/sha}","comments_url":"https://api.github.com/repos/tbkka/swift-protobuf/comments{/number}","issue_comment_url":"https://api.github.com/repos/tbkka/swift-protobuf/issues/comments{/number}","contents_url":"https://api.github.com/repos/tbkka/swift-protobuf/contents/{+path}","compare_url":"https://api.github.com/repos/tbkka/swift-protobuf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tbkka/swift-protobuf/merges","archive_url":"https://api.github.com/repos/tbkka/swift-protobuf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tbkka/swift-protobuf/downloads","issues_url":"https://api.github.com/repos/tbkka/swift-protobuf/issues{/number}","pulls_url":"https://api.github.com/repos/tbkka/swift-protobuf/pulls{/number}","milestones_url":"https://api.github.com/repos/tbkka/swift-protobuf/milestones{/number}","notifications_url":"https://api.github.com/repos/tbkka/swift-protobuf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tbkka/swift-protobuf/labels{/name}","releases_url":"https://api.github.com/repos/tbkka/swift-protobuf/releases{/id}","deployments_url":"https://api.github.com/repos/tbkka/swift-protobuf/deployments","created_at":"2016-09-29T22:36:14Z","updated_at":"2016-09-29T22:36:16Z","pushed_at":"2016-12-15T03:45:56Z","git_url":"git://github.com/tbkka/swift-protobuf.git","ssh_url":"git@github.com:tbkka/swift-protobuf.git","clone_url":"https://github.com/tbkka/swift-protobuf.git","svn_url":"https://github.com/tbkka/swift-protobuf","homepage":"","size":3404,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apple:master","ref":"master","sha":"6e48bc424cc0a764fd5de591c4fbfdc67e6451af","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":67177488,"name":"swift-protobuf","full_name":"apple/swift-protobuf","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift-protobuf","description":"Plugin and runtime library for using protobuf with Swift","fork":false,"url":"https://api.github.com/repos/apple/swift-protobuf","forks_url":"https://api.github.com/repos/apple/swift-protobuf/forks","keys_url":"https://api.github.com/repos/apple/swift-protobuf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift-protobuf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift-protobuf/teams","hooks_url":"https://api.github.com/repos/apple/swift-protobuf/hooks","issue_events_url":"https://api.github.com/repos/apple/swift-protobuf/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift-protobuf/events","assignees_url":"https://api.github.com/repos/apple/swift-protobuf/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift-protobuf/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift-protobuf/tags","blobs_url":"https://api.github.com/repos/apple/swift-protobuf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift-protobuf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift-protobuf/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift-protobuf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift-protobuf/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift-protobuf/languages","stargazers_url":"https://api.github.com/repos/apple/swift-protobuf/stargazers","contributors_url":"https://api.github.com/repos/apple/swift-protobuf/contributors","subscribers_url":"https://api.github.com/repos/apple/swift-protobuf/subscribers","subscription_url":"https://api.github.com/repos/apple/swift-protobuf/subscription","commits_url":"https://api.github.com/repos/apple/swift-protobuf/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift-protobuf/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift-protobuf/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift-protobuf/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift-protobuf/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift-protobuf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift-protobuf/merges","archive_url":"https://api.github.com/repos/apple/swift-protobuf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift-protobuf/downloads","issues_url":"https://api.github.com/repos/apple/swift-protobuf/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift-protobuf/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift-protobuf/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift-protobuf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift-protobuf/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift-protobuf/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift-protobuf/deployments","created_at":"2016-09-02T00:51:55Z","updated_at":"2016-12-15T07:49:44Z","pushed_at":"2016-12-15T13:54:20Z","git_url":"git://github.com/apple/swift-protobuf.git","ssh_url":"git@github.com:apple/swift-protobuf.git","clone_url":"https://github.com/apple/swift-protobuf.git","svn_url":"https://github.com/apple/swift-protobuf","homepage":"","size":3399,"stargazers_count":628,"watchers_count":628,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":40,"forks":47,"open_issues":40,"watchers":628,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/169"},"html":{"href":"https://github.com/apple/swift-protobuf/pull/169"},"issue":{"href":"https://api.github.com/repos/apple/swift-protobuf/issues/169"},"comments":{"href":"https://api.github.com/repos/apple/swift-protobuf/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift-protobuf/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-protobuf/statuses/9131ed1faf86bfcd1fa28af275daf3c3685b83e2"}}}}
{"actor":{"display_login":"thomasvl"}}