Quellcode durchsuchen

Initial commit of version 0.9.13

Tim Kientzle vor 9 Jahren
Commit
f45189854f
100 geänderte Dateien mit 19721 neuen und 0 gelöschten Zeilen
  1. 88 0
      CollectTests.awk
  2. 211 0
      LICENSE.txt
  3. 104 0
      Makefile
  4. 5 0
      Package.swift
  5. 7 0
      Protos/README.md
  6. 273 0
      Protos/conformance/conformance.proto
  7. 140 0
      Protos/google/protobuf/any.proto
  8. 41 0
      Protos/google/protobuf/any_test.proto
  9. 202 0
      Protos/google/protobuf/api.proto
  10. 820 0
      Protos/google/protobuf/descriptor.proto
  11. 97 0
      Protos/google/protobuf/duration.proto
  12. 53 0
      Protos/google/protobuf/empty.proto
  13. 246 0
      Protos/google/protobuf/field_mask.proto
  14. 130 0
      Protos/google/protobuf/map_lite_unittest.proto
  15. 66 0
      Protos/google/protobuf/map_proto2_unittest.proto
  16. 129 0
      Protos/google/protobuf/map_unittest.proto
  17. 123 0
      Protos/google/protobuf/map_unittest_proto3.proto
  18. 48 0
      Protos/google/protobuf/source_context.proto
  19. 96 0
      Protos/google/protobuf/struct.proto
  20. 111 0
      Protos/google/protobuf/timestamp.proto
  21. 180 0
      Protos/google/protobuf/type.proto
  22. 880 0
      Protos/google/protobuf/unittest.proto
  23. 46 0
      Protos/google/protobuf/unittest_arena.proto
  24. 430 0
      Protos/google/protobuf/unittest_custom_options.proto
  25. 58 0
      Protos/google/protobuf/unittest_drop_unknown_fields.proto
  26. 51 0
      Protos/google/protobuf/unittest_embed_optimize_for.proto
  27. 38 0
      Protos/google/protobuf/unittest_empty.proto
  28. 1048 0
      Protos/google/protobuf/unittest_enormous_descriptor.proto
  29. 73 0
      Protos/google/protobuf/unittest_import.proto
  30. 52 0
      Protos/google/protobuf/unittest_import_lite.proto
  31. 69 0
      Protos/google/protobuf/unittest_import_proto3.proto
  32. 41 0
      Protos/google/protobuf/unittest_import_public.proto
  33. 43 0
      Protos/google/protobuf/unittest_import_public_lite.proto
  34. 43 0
      Protos/google/protobuf/unittest_import_public_proto3.proto
  35. 407 0
      Protos/google/protobuf/unittest_lite.proto
  36. 44 0
      Protos/google/protobuf/unittest_lite_imports_nonlite.proto
  37. 82 0
      Protos/google/protobuf/unittest_mset.proto
  38. 52 0
      Protos/google/protobuf/unittest_mset_wire_format.proto
  39. 202 0
      Protos/google/protobuf/unittest_no_arena.proto
  40. 37 0
      Protos/google/protobuf/unittest_no_arena_import.proto
  41. 42 0
      Protos/google/protobuf/unittest_no_arena_lite.proto
  42. 138 0
      Protos/google/protobuf/unittest_no_field_presence.proto
  43. 54 0
      Protos/google/protobuf/unittest_no_generic_services.proto
  44. 67 0
      Protos/google/protobuf/unittest_optimize_for.proto
  45. 71 0
      Protos/google/protobuf/unittest_preserve_unknown_enum.proto
  46. 50 0
      Protos/google/protobuf/unittest_preserve_unknown_enum2.proto
  47. 391 0
      Protos/google/protobuf/unittest_proto3.proto
  48. 206 0
      Protos/google/protobuf/unittest_proto3_arena.proto
  49. 207 0
      Protos/google/protobuf/unittest_proto3_arena_lite.proto
  50. 206 0
      Protos/google/protobuf/unittest_proto3_lite.proto
  51. 114 0
      Protos/google/protobuf/unittest_well_known_types.proto
  52. 119 0
      Protos/google/protobuf/wrappers.proto
  53. 140 0
      Protos/unittest_swift_all_required_types.proto
  54. 58 0
      Protos/unittest_swift_cycle.proto
  55. 44 0
      Protos/unittest_swift_enum.proto
  56. 40 0
      Protos/unittest_swift_enum_optional_default.proto
  57. 42 0
      Protos/unittest_swift_extension.proto
  58. 46 0
      Protos/unittest_swift_fieldorder.proto
  59. 50 0
      Protos/unittest_swift_groups.proto
  60. 867 0
      Protos/unittest_swift_naming.proto
  61. 73 0
      Protos/unittest_swift_performance.proto
  62. 36 0
      Protos/unittest_swift_reserved.proto
  63. 128 0
      Protos/unittest_swift_runtime_proto2.proto
  64. 121 0
      Protos/unittest_swift_runtime_proto3.proto
  65. 49 0
      Protos/unittest_swift_startup.proto
  66. 54 0
      README.md
  67. 479 0
      Sources/Protobuf/Google_Protobuf_Any.swift
  68. 199 0
      Sources/Protobuf/Google_Protobuf_Duration_Extensions.swift
  69. 158 0
      Sources/Protobuf/Google_Protobuf_FieldMask_Extensions.swift
  70. 753 0
      Sources/Protobuf/Google_Protobuf_Struct.swift
  71. 322 0
      Sources/Protobuf/Google_Protobuf_Timestamp_Extensions.swift
  72. 258 0
      Sources/Protobuf/Google_Protobuf_Wrappers.swift
  73. 707 0
      Sources/Protobuf/ProtobufBinaryDecoding.swift
  74. 220 0
      Sources/Protobuf/ProtobufBinaryEncoding.swift
  75. 752 0
      Sources/Protobuf/ProtobufBinaryTypes.swift
  76. 155 0
      Sources/Protobuf/ProtobufDebugDescription.swift
  77. 30 0
      Sources/Protobuf/ProtobufEnum.swift
  78. 72 0
      Sources/Protobuf/ProtobufError.swift
  79. 453 0
      Sources/Protobuf/ProtobufExtensionFields.swift
  80. 255 0
      Sources/Protobuf/ProtobufExtensions.swift
  81. 114 0
      Sources/Protobuf/ProtobufFieldDecoder.swift
  82. 80 0
      Sources/Protobuf/ProtobufGroup.swift
  83. 124 0
      Sources/Protobuf/ProtobufHash.swift
  84. 1168 0
      Sources/Protobuf/ProtobufJSONDecoding.swift
  85. 296 0
      Sources/Protobuf/ProtobufJSONEncoding.swift
  86. 964 0
      Sources/Protobuf/ProtobufJSONTypes.swift
  87. 166 0
      Sources/Protobuf/ProtobufMessage.swift
  88. 80 0
      Sources/Protobuf/ProtobufMirror.swift
  89. 27 0
      Sources/Protobuf/ProtobufOneof.swift
  90. 95 0
      Sources/Protobuf/ProtobufRawMessage.swift
  91. 46 0
      Sources/Protobuf/ProtobufTraversal.swift
  92. 223 0
      Sources/Protobuf/ProtobufTypes.swift
  93. 45 0
      Sources/Protobuf/ProtobufUnknown.swift
  94. 47 0
      Sources/Protobuf/ProtobufUtility.swift
  95. 534 0
      Sources/Protobuf/api.pb.swift
  96. 121 0
      Sources/Protobuf/duration.pb.swift
  97. 42 0
      Sources/Protobuf/empty.pb.swift
  98. 261 0
      Sources/Protobuf/field_mask.pb.swift
  99. 63 0
      Sources/Protobuf/source_context.pb.swift
  100. 133 0
      Sources/Protobuf/timestamp.pb.swift

+ 88 - 0
CollectTests.awk

@@ -0,0 +1,88 @@
+#!/usr/bin/awk -f
+
+# ProtobufRuntime/Sources/Protobuf/ProtobufBinaryEncoding.swift - Binary encoding support
+#
+# This source file is part of the Swift.org open source project
+#
+# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+# Licensed under Apache License v2.0 with Runtime Library Exception
+#
+# See http://swift.org/LICENSE.txt for license information
+# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+#
+# -----------------------------------------------------------------------------
+#
+# The Linux version of XCTest cannot automatically
+# discover tests at run-time.  So you can either manually
+# maintain lists of tests or collect them at build time.
+#
+# This script is used by the Makefile to do the latter:
+#  = Scans each XCTest source file for 'class Foo: XCTestCase'
+#  = Looks for 'func test*' within those classes
+#  = Emits a class extension with the necessary 'allTests' property
+#  = Emits an XCTMain invocation to run all the classes
+#
+# The macOS version of XCTest has another mechanism for
+# finding tests at run-time, so this is not needed there.
+#
+# -----------------------------------------------------------------------------
+
+BEGIN {
+    CLASS=""
+    TESTCASES=""
+    TESTCASE_separator=""
+    printf("import XCTest\n")
+    printf("@testable import ProtobufTestSuite\n")
+    printf("\n")
+    printf("private func run_test(test:() -> ()) throws {\n")
+    printf("    test()\n")
+    printf("}\n")
+    printf("\n")
+    printf("private func run_test(test:() throws -> ()) throws {\n")
+    printf("    try test()\n")
+    printf("}\n")
+    printf("\n")
+    printf("\n")
+}
+
+/class .*:.* XCTestCase/ {
+    if (CLASS != "") {
+	printf("        ]\n")
+	printf("    }\n")
+	printf("}\n")
+    }
+    split($0, a, ":")
+    split(a[1], words, " ")
+    CLASS=words[2]
+    TESTCASES = TESTCASES TESTCASE_separator "\n" "        (testCaseClass: " CLASS ".self, allTests: " CLASS ".allTests)"
+    TESTCASE_separator = ","
+    printf("\n")
+    printf("extension %s {\n", CLASS)
+    printf("    static var allTests: [(String, (XCTestCase) throws -> ())] {\n")
+    printf("        return [")
+    FUNC_separator=""
+}
+
+
+/ *func *test.*/ {
+    split($0, a, "(")
+    split(a[1], words, " ")
+    FUNC=words[2]
+    printf("")
+    printf("%s\n            (\"%s\", {try run_test(test:($0 as! %s).%s)})", FUNC_separator, FUNC, CLASS, FUNC)
+    FUNC_separator = ","
+}
+
+END {
+    if (CLASS != "") {
+	printf("\n        ]\n")
+	printf("    }\n")
+	printf("}\n")
+    }
+    printf("\n")
+
+    printf("XCTMain(\n")
+    printf("    [")
+    printf(TESTCASES)
+    printf("\n    ]\n)\n")
+}

+ 211 - 0
LICENSE.txt

@@ -0,0 +1,211 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+    1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+    2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+    3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+    4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+    5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+    6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+    7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+    8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+    9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+    END OF TERMS AND CONDITIONS
+
+    APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+    Copyright [yyyy] [name of copyright owner]
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+   
+   
+## Runtime Library Exception to the Apache 2.0 License: ##
+
+
+    As an exception, if you use this Software to compile your source code and
+    portions of this Software are embedded into the binary product as a result,
+    you may redistribute such product without providing attribution as would
+    otherwise be required by Sections 4(a), 4(b) and 4(d) of the License.

+ 104 - 0
Makefile

@@ -0,0 +1,104 @@
+
+# How to run a 'swift' executable that supports the 'swift build', 'swift test', etc commands.
+SWIFT=swift
+
+# How to run a working version of protoc
+PROTOC=protoc
+
+# How to run awk on your system
+AWK=awk
+
+# Protos from Google's source tree that are used for testing purposes
+GOOGLE_TEST_PROTOS= \
+	any_test \
+	descriptor \
+	map_unittest \
+	map_unittest_proto3 \
+	unittest \
+	unittest_arena \
+	unittest_custom_options \
+	unittest_drop_unknown_fields \
+	unittest_embed_optimize_for \
+	unittest_empty \
+	unittest_import \
+	unittest_import_lite \
+	unittest_import_proto3 \
+	unittest_import_public \
+	unittest_import_public_lite \
+	unittest_import_public_proto3 \
+	unittest_lite_imports_nonlite \
+	unittest_lite \
+	unittest_mset \
+	unittest_mset_wire_format \
+	unittest_no_arena \
+	unittest_no_arena_import \
+	unittest_no_arena_lite \
+	unittest_no_field_presence \
+	unittest_no_generic_services \
+	unittest_optimize_for \
+	unittest_preserve_unknown_enum \
+	unittest_preserve_unknown_enum2 \
+	unittest_proto3 \
+	unittest_proto3_arena \
+	unittest_well_known_types
+
+# Protos from Google's source tree that are embedded into
+# the Protobuf library module
+GOOGLE_LIBRARY_PROTOS= api duration empty field_mask source_context timestamp type
+
+.PHONY: default all build check clean test regenerate regenerate-library-protos regenerate-test-protos regenerate-test-protos-local regenerate-test-protos-google
+
+default: build
+
+all: build
+
+# This also rebuilds LinuxMain.swift to include all of the test cases
+# (The awk script is very fast, so re-running it on every build is reasonable.)
+build:
+	${AWK} -f CollectTests.awk Tests/ProtobufTests/Test_*.swift > Tests/LinuxMain.swift
+	${SWIFT} build
+
+check test: build
+	${SWIFT} test
+
+clean:
+	swift build --clean
+	rm -rf .build
+
+#
+# Rebuild the generated .pb.swift test files by running
+# protoc over all the relevant inputs.
+#
+# Before running this, ensure that:
+#  * protoc-gen-swift is built and installed somewhere in your system PATH
+#  * protoc is built and installed
+#  * PROTOC at the top of this file is set correctly
+#
+regenerate: regenerate-library-protos regenerate-test-protos
+
+# Rebuild just the protos included in the runtime library
+regenerate-library-protos:
+	for t in ${GOOGLE_LIBRARY_PROTOS}; do \
+		echo google/protobuf/$$t.proto; \
+		${PROTOC} --swift_out=Sources/Protobuf -I Protos Protos/google/protobuf/$$t.proto; \
+		sed -i~ -e 's/^import Protobuf$$//' Sources/Protobuf/$$t.pb.swift; \
+	done
+
+# Rebuild just the protos used by the test suite
+regenerate-test-protos: regenerate-test-protos-google regenerate-test-protos-local
+
+# Rebuild just the protos used by the test suite that come from Google's sources
+regenerate-test-protos-google:
+	for t in ${GOOGLE_TEST_PROTOS}; do \
+		echo google/protobuf/$$t.proto; \
+		${PROTOC} --swift_out=Tests/ProtobufTests -I Protos Protos/google/protobuf/$$t.proto; \
+	done; \
+	echo conformance/conformance.proto; \
+	${PROTOC} --swift_out=Tests/ProtobufTests -I Protos/conformance -I Protos Protos/conformance/conformance.proto; \
+
+# Rebuild just the protos used by the test suite that come from local sources
+regenerate-test-protos-local:
+	for t in Protos/*.proto; do \
+		echo $$t; \
+		${PROTOC} --swift_out=Tests/ProtobufTests -IProtos $$t; \
+	done

+ 5 - 0
Package.swift

@@ -0,0 +1,5 @@
+import PackageDescription
+
+let package = Package(
+        name: "SwiftProtobufRuntime"
+)

+ 7 - 0
Protos/README.md

@@ -0,0 +1,7 @@
+Various test protos that are used to stress the code generator.
+
+Many of these were copied from Google's protoc project with only minor changes, hence the Google copyright notices.
+
+Others were created specifically to test Apple's Swift generator.
+
+Some are used in various Test cases, but others serve as tests just by verifying that they compile.

+ 273 - 0
Protos/conformance/conformance.proto

@@ -0,0 +1,273 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+package conformance;
+option java_package = "com.google.protobuf.conformance";
+
+import "google/protobuf/any.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/field_mask.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+import "google/protobuf/wrappers.proto";
+
+// This defines the conformance testing protocol.  This protocol exists between
+// the conformance test suite itself and the code being tested.  For each test,
+// the suite will send a ConformanceRequest message and expect a
+// ConformanceResponse message.
+//
+// You can either run the tests in two different ways:
+//
+//   1. in-process (using the interface in conformance_test.h).
+//
+//   2. as a sub-process communicating over a pipe.  Information about how to
+//      do this is in conformance_test_runner.cc.
+//
+// Pros/cons of the two approaches:
+//
+//   - running as a sub-process is much simpler for languages other than C/C++.
+//
+//   - running as a sub-process may be more tricky in unusual environments like
+//     iOS apps, where fork/stdin/stdout are not available.
+
+enum WireFormat {
+  UNSPECIFIED = 0;
+  PROTOBUF = 1;
+  JSON = 2;
+}
+
+// Represents a single test case's input.  The testee should:
+//
+//   1. parse this proto (which should always succeed)
+//   2. parse the protobuf or JSON payload in "payload" (which may fail)
+//   3. if the parse succeeded, serialize the message in the requested format.
+message ConformanceRequest {
+  // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
+  // (see below).
+  oneof payload {
+    bytes protobuf_payload = 1;
+    string json_payload = 2;
+  }
+
+  // Which format should the testee serialize its message to?
+  WireFormat requested_output_format = 3;
+}
+
+// Represents a single test case's output.
+message ConformanceResponse {
+  oneof result {
+    // This string should be set to indicate parsing failed.  The string can
+    // provide more information about the parse error if it is available.
+    //
+    // Setting this string does not necessarily mean the testee failed the
+    // test.  Some of the test cases are intentionally invalid input.
+    string parse_error = 1;
+
+    // If the input was successfully parsed but errors occurred when
+    // serializing it to the requested output format, set the error message in
+    // this field.
+    string serialize_error = 6;
+
+    // This should be set if some other error occurred.  This will always
+    // indicate that the test failed.  The string can provide more information
+    // about the failure.
+    string runtime_error = 2;
+
+    // If the input was successfully parsed and the requested output was
+    // protobuf, serialize it to protobuf and set it in this field.
+    bytes protobuf_payload = 3;
+
+    // If the input was successfully parsed and the requested output was JSON,
+    // serialize to JSON and set it in this field.
+    string json_payload = 4;
+
+    // For when the testee skipped the test, likely because a certain feature
+    // wasn't supported, like JSON input/output.
+    string skipped = 5;
+  }
+}
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    int32 a = 1;
+    TestAllTypes corecursive = 2;
+  }
+
+  enum NestedEnum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  int32 optional_int32    =  1;
+  int64 optional_int64    =  2;
+  uint32 optional_uint32   =  3;
+  uint64 optional_uint64   =  4;
+  sint32 optional_sint32   =  5;
+  sint64 optional_sint64   =  6;
+  fixed32 optional_fixed32  =  7;
+  fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+  float optional_float    = 11;
+  double optional_double   = 12;
+  bool optional_bool     = 13;
+  string optional_string   = 14;
+  bytes optional_bytes    = 15;
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  TestAllTypes recursive_message = 27;
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  // Map
+  map <   int32, int32>    map_int32_int32 = 56;
+  map <   int64, int64>    map_int64_int64 = 57;
+  map <  uint32, uint32>   map_uint32_uint32 = 58;
+  map <  uint64, uint64>   map_uint64_uint64 = 59;
+  map <  sint32, sint32>   map_sint32_sint32 = 60;
+  map <  sint64, sint64>   map_sint64_sint64 = 61;
+  map < fixed32, fixed32>  map_fixed32_fixed32 = 62;
+  map < fixed64, fixed64>  map_fixed64_fixed64 = 63;
+  map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;
+  map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;
+  map <   int32, float>    map_int32_float = 66;
+  map <   int32, double>   map_int32_double = 67;
+  map <    bool, bool>     map_bool_bool = 68;
+  map <  string, string>   map_string_string = 69;
+  map <  string, bytes>    map_string_bytes = 70;
+  map <  string, NestedMessage>  map_string_nested_message = 71;
+  map <  string, ForeignMessage> map_string_foreign_message = 72;
+  map <  string, NestedEnum>     map_string_nested_enum = 73;
+  map <  string, ForeignEnum>    map_string_foreign_enum = 74;
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+
+  // Well-known types
+  google.protobuf.BoolValue optional_bool_wrapper = 201;
+  google.protobuf.Int32Value optional_int32_wrapper = 202;
+  google.protobuf.Int64Value optional_int64_wrapper = 203;
+  google.protobuf.UInt32Value optional_uint32_wrapper = 204;
+  google.protobuf.UInt64Value optional_uint64_wrapper = 205;
+  google.protobuf.FloatValue optional_float_wrapper = 206;
+  google.protobuf.DoubleValue optional_double_wrapper = 207;
+  google.protobuf.StringValue optional_string_wrapper = 208;
+  google.protobuf.BytesValue optional_bytes_wrapper = 209;
+
+  repeated google.protobuf.BoolValue repeated_bool_wrapper = 211;
+  repeated google.protobuf.Int32Value repeated_int32_wrapper = 212;
+  repeated google.protobuf.Int64Value repeated_int64_wrapper = 213;
+  repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214;
+  repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215;
+  repeated google.protobuf.FloatValue repeated_float_wrapper = 216;
+  repeated google.protobuf.DoubleValue repeated_double_wrapper = 217;
+  repeated google.protobuf.StringValue repeated_string_wrapper = 218;
+  repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219;
+
+  google.protobuf.Duration optional_duration = 301;
+  google.protobuf.Timestamp optional_timestamp = 302;
+  google.protobuf.FieldMask optional_field_mask = 303;
+  google.protobuf.Struct optional_struct = 304;
+  google.protobuf.Any optional_any = 305;
+  google.protobuf.Value optional_value = 306;
+
+  repeated google.protobuf.Duration repeated_duration = 311;
+  repeated google.protobuf.Timestamp repeated_timestamp = 312;
+  repeated google.protobuf.FieldMask repeated_fieldmask = 313;
+  repeated google.protobuf.Struct repeated_struct = 324;
+  repeated google.protobuf.Any repeated_any = 315;
+  repeated google.protobuf.Value repeated_value = 316;
+
+  // Test field-name-to-JSON-name convention.
+  int32 fieldname1 = 401;
+  int32 field_name2 = 402;
+  int32 _field_name3 = 403;
+  int32 field__name4_ = 404;
+  int32 field0name5 = 405;
+  int32 field_0_name6 = 406;
+  int32 fieldName7 = 407;
+  int32 FieldName8 = 408;
+  int32 field_Name9 = 409;
+  int32 Field_Name10 = 410;
+  int32 FIELD_NAME11 = 411;
+  int32 FIELD_name12 = 412;
+}
+
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_FOO = 0;
+  FOREIGN_BAR = 1;
+  FOREIGN_BAZ = 2;
+}

+ 140 - 0
Protos/google/protobuf/any.proto

@@ -0,0 +1,140 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/any";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "AnyProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// `Any` contains an arbitrary serialized protocol buffer message along with a
+// URL that describes the type of the serialized message.
+//
+// Protobuf library provides support to pack/unpack Any values in the form
+// of utility functions or additional generated methods of the Any type.
+//
+// Example 1: Pack and unpack a message in C++.
+//
+//     Foo foo = ...;
+//     Any any;
+//     any.PackFrom(foo);
+//     ...
+//     if (any.UnpackTo(&foo)) {
+//       ...
+//     }
+//
+// Example 2: Pack and unpack a message in Java.
+//
+//     Foo foo = ...;
+//     Any any = Any.pack(foo);
+//     ...
+//     if (any.is(Foo.class)) {
+//       foo = any.unpack(Foo.class);
+//     }
+//
+//  Example 3: Pack and unpack a message in Python.
+//
+//     foo = Foo(...)
+//     any = Any()
+//     any.Pack(foo)
+//     ...
+//     if any.Is(Foo.DESCRIPTOR):
+//       any.Unpack(foo)
+//       ...
+//
+// The pack methods provided by protobuf library will by default use
+// 'type.googleapis.com/full.type.name' as the type URL and the unpack
+// methods only use the fully qualified type name after the last '/'
+// in the type URL, for example "foo.bar.com/x/y.z" will yield type
+// name "y.z".
+//
+//
+// JSON
+// ====
+// The JSON representation of an `Any` value uses the regular
+// representation of the deserialized, embedded message, with an
+// additional field `@type` which contains the type URL. Example:
+//
+//     package google.profile;
+//     message Person {
+//       string first_name = 1;
+//       string last_name = 2;
+//     }
+//
+//     {
+//       "@type": "type.googleapis.com/google.profile.Person",
+//       "firstName": <string>,
+//       "lastName": <string>
+//     }
+//
+// If the embedded message type is well-known and has a custom JSON
+// representation, that representation will be embedded adding a field
+// `value` which holds the custom JSON in addition to the `@type`
+// field. Example (for message [google.protobuf.Duration][]):
+//
+//     {
+//       "@type": "type.googleapis.com/google.protobuf.Duration",
+//       "value": "1.212s"
+//     }
+//
+message Any {
+  // A URL/resource name whose content describes the type of the
+  // serialized protocol buffer message.
+  //
+  // For URLs which use the scheme `http`, `https`, or no scheme, the
+  // following restrictions and interpretations apply:
+  //
+  // * If no scheme is provided, `https` is assumed.
+  // * The last segment of the URL's path must represent the fully
+  //   qualified name of the type (as in `path/google.protobuf.Duration`).
+  //   The name should be in a canonical form (e.g., leading "." is
+  //   not accepted).
+  // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
+  //   value in binary format, or produce an error.
+  // * Applications are allowed to cache lookup results based on the
+  //   URL, or have them precompiled into a binary to avoid any
+  //   lookup. Therefore, binary compatibility needs to be preserved
+  //   on changes to types. (Use versioned type names to manage
+  //   breaking changes.)
+  //
+  // Schemes other than `http`, `https` (or the empty scheme) might be
+  // used with implementation specific semantics.
+  //
+  string type_url = 1;
+
+  // Must be a valid serialized protocol buffer of the above specified type.
+  bytes value = 2;
+}

+ 41 - 0
Protos/google/protobuf/any_test.proto

@@ -0,0 +1,41 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package protobuf_unittest;
+
+import "google/protobuf/any.proto";
+
+message TestAny {
+  int32 int32_value = 1;
+  google.protobuf.Any any_value = 2;
+  repeated google.protobuf.Any repeated_any_value = 3;
+}

+ 202 - 0
Protos/google/protobuf/api.proto

@@ -0,0 +1,202 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+import "google/protobuf/source_context.proto";
+import "google/protobuf/type.proto";
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "ApiProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// Api is a light-weight descriptor for a protocol buffer service.
+message Api {
+
+  // The fully qualified name of this api, including package name
+  // followed by the api's simple name.
+  string name = 1;
+
+  // The methods of this api, in unspecified order.
+  repeated Method methods = 2;
+
+  // Any metadata attached to the API.
+  repeated Option options = 3;
+
+  // A version string for this api. If specified, must have the form
+  // `major-version.minor-version`, as in `1.10`. If the minor version
+  // is omitted, it defaults to zero. If the entire version field is
+  // empty, the major version is derived from the package name, as
+  // outlined below. If the field is not empty, the version in the
+  // package name will be verified to be consistent with what is
+  // provided here.
+  //
+  // The versioning schema uses [semantic
+  // versioning](http://semver.org) where the major version number
+  // indicates a breaking change and the minor version an additive,
+  // non-breaking change. Both version numbers are signals to users
+  // what to expect from different versions, and should be carefully
+  // chosen based on the product plan.
+  //
+  // The major version is also reflected in the package name of the
+  // API, which must end in `v<major-version>`, as in
+  // `google.feature.v1`. For major versions 0 and 1, the suffix can
+  // be omitted. Zero major versions must only be used for
+  // experimental, none-GA apis.
+  //
+  //
+  string version = 4;
+
+  // Source context for the protocol buffer service represented by this
+  // message.
+  SourceContext source_context = 5;
+
+  // Included APIs. See [Mixin][].
+  repeated Mixin mixins = 6;
+
+  // The source syntax of the service.
+  Syntax syntax = 7;
+}
+
+// Method represents a method of an api.
+message Method {
+
+  // The simple name of this method.
+  string name = 1;
+
+  // A URL of the input message type.
+  string request_type_url = 2;
+
+  // If true, the request is streamed.
+  bool request_streaming = 3;
+
+  // The URL of the output message type.
+  string response_type_url = 4;
+
+  // If true, the response is streamed.
+  bool response_streaming = 5;
+
+  // Any metadata attached to the method.
+  repeated Option options = 6;
+
+  // The source syntax of this method.
+  Syntax syntax = 7;
+}
+
+// Declares an API to be included in this API. The including API must
+// redeclare all the methods from the included API, but documentation
+// and options are inherited as follows:
+//
+// - If after comment and whitespace stripping, the documentation
+//   string of the redeclared method is empty, it will be inherited
+//   from the original method.
+//
+// - Each annotation belonging to the service config (http,
+//   visibility) which is not set in the redeclared method will be
+//   inherited.
+//
+// - If an http annotation is inherited, the path pattern will be
+//   modified as follows. Any version prefix will be replaced by the
+//   version of the including API plus the [root][] path if specified.
+//
+// Example of a simple mixin:
+//
+//     package google.acl.v1;
+//     service AccessControl {
+//       // Get the underlying ACL object.
+//       rpc GetAcl(GetAclRequest) returns (Acl) {
+//         option (google.api.http).get = "/v1/{resource=**}:getAcl";
+//       }
+//     }
+//
+//     package google.storage.v2;
+//     service Storage {
+//       rpc GetAcl(GetAclRequest) returns (Acl);
+//
+//       // Get a data record.
+//       rpc GetData(GetDataRequest) returns (Data) {
+//         option (google.api.http).get = "/v2/{resource=**}";
+//       }
+//     }
+//
+// Example of a mixin configuration:
+//
+//     apis:
+//     - name: google.storage.v2.Storage
+//       mixins:
+//       - name: google.acl.v1.AccessControl
+//
+// The mixin construct implies that all methods in `AccessControl` are
+// also declared with same name and request/response types in
+// `Storage`. A documentation generator or annotation processor will
+// see the effective `Storage.GetAcl` method after inherting
+// documentation and annotations as follows:
+//
+//     service Storage {
+//       // Get the underlying ACL object.
+//       rpc GetAcl(GetAclRequest) returns (Acl) {
+//         option (google.api.http).get = "/v2/{resource=**}:getAcl";
+//       }
+//       ...
+//     }
+//
+// Note how the version in the path pattern changed from `v1` to `v2`.
+//
+// If the `root` field in the mixin is specified, it should be a
+// relative path under which inherited HTTP paths are placed. Example:
+//
+//     apis:
+//     - name: google.storage.v2.Storage
+//       mixins:
+//       - name: google.acl.v1.AccessControl
+//         root: acls
+//
+// This implies the following inherited HTTP annotation:
+//
+//     service Storage {
+//       // Get the underlying ACL object.
+//       rpc GetAcl(GetAclRequest) returns (Acl) {
+//         option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
+//       }
+//       ...
+//     }
+message Mixin {
+  // The fully qualified name of the API which is included.
+  string name = 1;
+
+  // If non-empty specifies a path under which inherited HTTP paths
+  // are rooted.
+  string root = 2;
+}

+ 820 - 0
Protos/google/protobuf/descriptor.proto

@@ -0,0 +1,820 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// The messages in this file describe the definitions found in .proto files.
+// A valid .proto file can be translated directly to a FileDescriptorProto
+// without any other information (e.g. without reading its imports).
+
+
+syntax = "proto2";
+
+package google.protobuf;
+option go_package = "descriptor";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "DescriptorProtos";
+option csharp_namespace = "Google.Protobuf.Reflection";
+option objc_class_prefix = "GPB";
+
+// descriptor.proto must be optimized for speed because reflection-based
+// algorithms don't work during bootstrapping.
+option optimize_for = SPEED;
+
+// The protocol compiler can output a FileDescriptorSet containing the .proto
+// files it parses.
+message FileDescriptorSet {
+  repeated FileDescriptorProto file = 1;
+}
+
+// Describes a complete .proto file.
+message FileDescriptorProto {
+  optional string name = 1;       // file name, relative to root of source tree
+  optional string package = 2;    // e.g. "foo", "foo.bar", etc.
+
+  // Names of files imported by this file.
+  repeated string dependency = 3;
+  // Indexes of the public imported files in the dependency list above.
+  repeated int32 public_dependency = 10;
+  // Indexes of the weak imported files in the dependency list.
+  // For Google-internal migration only. Do not use.
+  repeated int32 weak_dependency = 11;
+
+  // All top-level definitions in this file.
+  repeated DescriptorProto message_type = 4;
+  repeated EnumDescriptorProto enum_type = 5;
+  repeated ServiceDescriptorProto service = 6;
+  repeated FieldDescriptorProto extension = 7;
+
+  optional FileOptions options = 8;
+
+  // This field contains optional information about the original source code.
+  // You may safely remove this entire field without harming runtime
+  // functionality of the descriptors -- the information is needed only by
+  // development tools.
+  optional SourceCodeInfo source_code_info = 9;
+
+  // The syntax of the proto file.
+  // The supported values are "proto2" and "proto3".
+  optional string syntax = 12;
+}
+
+// Describes a message type.
+message DescriptorProto {
+  optional string name = 1;
+
+  repeated FieldDescriptorProto field = 2;
+  repeated FieldDescriptorProto extension = 6;
+
+  repeated DescriptorProto nested_type = 3;
+  repeated EnumDescriptorProto enum_type = 4;
+
+  message ExtensionRange {
+    optional int32 start = 1;
+    optional int32 end = 2;
+  }
+  repeated ExtensionRange extension_range = 5;
+
+  repeated OneofDescriptorProto oneof_decl = 8;
+
+  optional MessageOptions options = 7;
+
+  // Range of reserved tag numbers. Reserved tag numbers may not be used by
+  // fields or extension ranges in the same message. Reserved ranges may
+  // not overlap.
+  message ReservedRange {
+    optional int32 start = 1; // Inclusive.
+    optional int32 end = 2;   // Exclusive.
+  }
+  repeated ReservedRange reserved_range = 9;
+  // Reserved field names, which may not be used by fields in the same message.
+  // A given name may only be reserved once.
+  repeated string reserved_name = 10;
+}
+
+// Describes a field within a message.
+message FieldDescriptorProto {
+  enum Type {
+    // 0 is reserved for errors.
+    // Order is weird for historical reasons.
+    TYPE_DOUBLE         = 1;
+    TYPE_FLOAT          = 2;
+    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
+    // negative values are likely.
+    TYPE_INT64          = 3;
+    TYPE_UINT64         = 4;
+    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
+    // negative values are likely.
+    TYPE_INT32          = 5;
+    TYPE_FIXED64        = 6;
+    TYPE_FIXED32        = 7;
+    TYPE_BOOL           = 8;
+    TYPE_STRING         = 9;
+    TYPE_GROUP          = 10;  // Tag-delimited aggregate.
+    TYPE_MESSAGE        = 11;  // Length-delimited aggregate.
+
+    // New in version 2.
+    TYPE_BYTES          = 12;
+    TYPE_UINT32         = 13;
+    TYPE_ENUM           = 14;
+    TYPE_SFIXED32       = 15;
+    TYPE_SFIXED64       = 16;
+    TYPE_SINT32         = 17;  // Uses ZigZag encoding.
+    TYPE_SINT64         = 18;  // Uses ZigZag encoding.
+  };
+
+  enum Label {
+    // 0 is reserved for errors
+    LABEL_OPTIONAL      = 1;
+    LABEL_REQUIRED      = 2;
+    LABEL_REPEATED      = 3;
+    // TODO(sanjay): Should we add LABEL_MAP?
+  };
+
+  optional string name = 1;
+  optional int32 number = 3;
+  optional Label label = 4;
+
+  // If type_name is set, this need not be set.  If both this and type_name
+  // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+  optional Type type = 5;
+
+  // For message and enum types, this is the name of the type.  If the name
+  // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
+  // rules are used to find the type (i.e. first the nested types within this
+  // message are searched, then within the parent, on up to the root
+  // namespace).
+  optional string type_name = 6;
+
+  // For extensions, this is the name of the type being extended.  It is
+  // resolved in the same manner as type_name.
+  optional string extendee = 2;
+
+  // For numeric types, contains the original text representation of the value.
+  // For booleans, "true" or "false".
+  // For strings, contains the default text contents (not escaped in any way).
+  // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+  // TODO(kenton):  Base-64 encode?
+  optional string default_value = 7;
+
+  // If set, gives the index of a oneof in the containing type's oneof_decl
+  // list.  This field is a member of that oneof.
+  optional int32 oneof_index = 9;
+
+  // JSON name of this field. The value is set by protocol compiler. If the
+  // user has set a "json_name" option on this field, that option's value
+  // will be used. Otherwise, it's deduced from the field's name by converting
+  // it to camelCase.
+  optional string json_name = 10;
+
+  optional FieldOptions options = 8;
+}
+
+// Describes a oneof.
+message OneofDescriptorProto {
+  optional string name = 1;
+  optional OneofOptions options = 2;
+}
+
+// Describes an enum type.
+message EnumDescriptorProto {
+  optional string name = 1;
+
+  repeated EnumValueDescriptorProto value = 2;
+
+  optional EnumOptions options = 3;
+}
+
+// Describes a value within an enum.
+message EnumValueDescriptorProto {
+  optional string name = 1;
+  optional int32 number = 2;
+
+  optional EnumValueOptions options = 3;
+}
+
+// Describes a service.
+message ServiceDescriptorProto {
+  optional string name = 1;
+  repeated MethodDescriptorProto method = 2;
+
+  optional ServiceOptions options = 3;
+}
+
+// Describes a method of a service.
+message MethodDescriptorProto {
+  optional string name = 1;
+
+  // Input and output type names.  These are resolved in the same way as
+  // FieldDescriptorProto.type_name, but must refer to a message type.
+  optional string input_type = 2;
+  optional string output_type = 3;
+
+  optional MethodOptions options = 4;
+
+  // Identifies if client streams multiple client messages
+  optional bool client_streaming = 5 [default=false];
+  // Identifies if server streams multiple server messages
+  optional bool server_streaming = 6 [default=false];
+}
+
+
+// ===================================================================
+// Options
+
+// Each of the definitions above may have "options" attached.  These are
+// just annotations which may cause code to be generated slightly differently
+// or may contain hints for code that manipulates protocol messages.
+//
+// Clients may define custom options as extensions of the *Options messages.
+// These extensions may not yet be known at parsing time, so the parser cannot
+// store the values in them.  Instead it stores them in a field in the *Options
+// message called uninterpreted_option. This field must have the same name
+// across all *Options messages. We then use this field to populate the
+// extensions when we build a descriptor, at which point all protos have been
+// parsed and so all extensions are known.
+//
+// Extension numbers for custom options may be chosen as follows:
+// * For options which will only be used within a single application or
+//   organization, or for experimental options, use field numbers 50000
+//   through 99999.  It is up to you to ensure that you do not use the
+//   same number for multiple options.
+// * For options which will be published and used publicly by multiple
+//   independent entities, e-mail protobuf-global-extension-registry@google.com
+//   to reserve extension numbers. Simply provide your project name (e.g.
+//   Objective-C plugin) and your project website (if available) -- there's no
+//   need to explain how you intend to use them. Usually you only need one
+//   extension number. You can declare multiple options with only one extension
+//   number by putting them in a sub-message. See the Custom Options section of
+//   the docs for examples:
+//   https://developers.google.com/protocol-buffers/docs/proto#options
+//   If this turns out to be popular, a web service will be set up
+//   to automatically assign option numbers.
+
+
+message FileOptions {
+
+  // Sets the Java package where classes generated from this .proto will be
+  // placed.  By default, the proto package is used, but this is often
+  // inappropriate because proto packages do not normally start with backwards
+  // domain names.
+  optional string java_package = 1;
+
+
+  // If set, all the classes from the .proto file are wrapped in a single
+  // outer class with the given name.  This applies to both Proto1
+  // (equivalent to the old "--one_java_file" option) and Proto2 (where
+  // a .proto always translates to a single class, but you may want to
+  // explicitly choose the class name).
+  optional string java_outer_classname = 8;
+
+  // If set true, then the Java code generator will generate a separate .java
+  // file for each top-level message, enum, and service defined in the .proto
+  // file.  Thus, these types will *not* be nested inside the outer class
+  // named by java_outer_classname.  However, the outer class will still be
+  // generated to contain the file's getDescriptor() method as well as any
+  // top-level extensions defined in the file.
+  optional bool java_multiple_files = 10 [default=false];
+
+  // If set true, then the Java code generator will generate equals() and
+  // hashCode() methods for all messages defined in the .proto file.
+  // This increases generated code size, potentially substantially for large
+  // protos, which may harm a memory-constrained application.
+  // - In the full runtime this is a speed optimization, as the
+  // AbstractMessage base class includes reflection-based implementations of
+  // these methods.
+  // - In the lite runtime, setting this option changes the semantics of
+  // equals() and hashCode() to more closely match those of the full runtime;
+  // the generated methods compute their results based on field values rather
+  // than object identity. (Implementations should not assume that hashcodes
+  // will be consistent across runtimes or versions of the protocol compiler.)
+  optional bool java_generate_equals_and_hash = 20 [default=false];
+
+  // If set true, then the Java2 code generator will generate code that
+  // throws an exception whenever an attempt is made to assign a non-UTF-8
+  // byte sequence to a string field.
+  // Message reflection will do the same.
+  // However, an extension field still accepts non-UTF-8 byte sequences.
+  // This option has no effect on when used with the lite runtime.
+  optional bool java_string_check_utf8 = 27 [default=false];
+
+
+  // Generated classes can be optimized for speed or code size.
+  enum OptimizeMode {
+    SPEED = 1;        // Generate complete code for parsing, serialization,
+                      // etc.
+    CODE_SIZE = 2;    // Use ReflectionOps to implement these methods.
+    LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
+  }
+  optional OptimizeMode optimize_for = 9 [default=SPEED];
+
+  // Sets the Go package where structs generated from this .proto will be
+  // placed. If omitted, the Go package will be derived from the following:
+  //   - The basename of the package import path, if provided.
+  //   - Otherwise, the package statement in the .proto file, if present.
+  //   - Otherwise, the basename of the .proto file, without extension.
+  optional string go_package = 11;
+
+
+
+  // Should generic services be generated in each language?  "Generic" services
+  // are not specific to any particular RPC system.  They are generated by the
+  // main code generators in each language (without additional plugins).
+  // Generic services were the only kind of service generation supported by
+  // early versions of google.protobuf.
+  //
+  // Generic services are now considered deprecated in favor of using plugins
+  // that generate code specific to your particular RPC system.  Therefore,
+  // these default to false.  Old code which depends on generic services should
+  // explicitly set them to true.
+  optional bool cc_generic_services = 16 [default=false];
+  optional bool java_generic_services = 17 [default=false];
+  optional bool py_generic_services = 18 [default=false];
+
+  // Is this file deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for everything in the file, or it will be completely ignored; in the very
+  // least, this is a formalization for deprecating files.
+  optional bool deprecated = 23 [default=false];
+
+  // Enables the use of arenas for the proto messages in this file. This applies
+  // only to generated classes for C++.
+  optional bool cc_enable_arenas = 31 [default=false];
+
+
+  // Sets the objective c class prefix which is prepended to all objective c
+  // generated classes from this .proto. There is no default.
+  optional string objc_class_prefix = 36;
+
+  // Namespace for generated classes; defaults to the package.
+  optional string csharp_namespace = 37;
+
+  // Prefix prepended to all Swift generated top-level types.
+  // Default is CamelCased package name.
+  optional string swift_prefix = 39;
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+
+  reserved 38;
+}
+
+message MessageOptions {
+  // Set true to use the old proto1 MessageSet wire format for extensions.
+  // This is provided for backwards-compatibility with the MessageSet wire
+  // format.  You should not use this for any other reason:  It's less
+  // efficient, has fewer features, and is more complicated.
+  //
+  // The message must be defined exactly as follows:
+  //   message Foo {
+  //     option message_set_wire_format = true;
+  //     extensions 4 to max;
+  //   }
+  // Note that the message cannot have any defined fields; MessageSets only
+  // have extensions.
+  //
+  // All extensions of your type must be singular messages; e.g. they cannot
+  // be int32s, enums, or repeated messages.
+  //
+  // Because this is an option, the above two restrictions are not enforced by
+  // the protocol compiler.
+  optional bool message_set_wire_format = 1 [default=false];
+
+  // Disables the generation of the standard "descriptor()" accessor, which can
+  // conflict with a field of the same name.  This is meant to make migration
+  // from proto1 easier; new code should avoid fields named "descriptor".
+  optional bool no_standard_descriptor_accessor = 2 [default=false];
+
+  // Is this message deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for the message, or it will be completely ignored; in the very least,
+  // this is a formalization for deprecating messages.
+  optional bool deprecated = 3 [default=false];
+
+  // Whether the message is an automatically generated map entry type for the
+  // maps field.
+  //
+  // For maps fields:
+  //     map<KeyType, ValueType> map_field = 1;
+  // The parsed descriptor looks like:
+  //     message MapFieldEntry {
+  //         option map_entry = true;
+  //         optional KeyType key = 1;
+  //         optional ValueType value = 2;
+  //     }
+  //     repeated MapFieldEntry map_field = 1;
+  //
+  // Implementations may choose not to generate the map_entry=true message, but
+  // use a native map in the target language to hold the keys and values.
+  // The reflection APIs in such implementions still need to work as
+  // if the field is a repeated message field.
+  //
+  // NOTE: Do not set the option in .proto files. Always use the maps syntax
+  // instead. The option should only be implicitly set by the proto compiler
+  // parser.
+  optional bool map_entry = 7;
+
+  // Used by the Swift backend.  Append the specified protocols to the
+  // message struct definition.
+  optional string swift_additional_protocols = 8;
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message FieldOptions {
+  // The ctype option instructs the C++ code generator to use a different
+  // representation of the field than it normally would.  See the specific
+  // options below.  This option is not yet implemented in the open source
+  // release -- sorry, we'll try to include it in a future version!
+  optional CType ctype = 1 [default = STRING];
+  enum CType {
+    // Default mode.
+    STRING = 0;
+
+    CORD = 1;
+
+    STRING_PIECE = 2;
+  }
+  // The packed option can be enabled for repeated primitive fields to enable
+  // a more efficient representation on the wire. Rather than repeatedly
+  // writing the tag and type for each element, the entire array is encoded as
+  // a single length-delimited blob. In proto3, only explicit setting it to
+  // false will avoid using packed encoding.
+  optional bool packed = 2;
+
+
+  // The jstype option determines the JavaScript type used for values of the
+  // field.  The option is permitted only for 64 bit integral and fixed types
+  // (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
+  // represented as JavaScript strings.  This avoids loss of precision that can
+  // happen when a large value is converted to a floating point JavaScript
+  // numbers.  Specifying JS_NUMBER for the jstype causes the generated
+  // JavaScript code to use the JavaScript "number" type instead of strings.
+  // This option is an enum to permit additional types to be added,
+  // e.g. goog.math.Integer.
+  optional JSType jstype = 6 [default = JS_NORMAL];
+  enum JSType {
+    // Use the default type.
+    JS_NORMAL = 0;
+
+    // Use JavaScript strings.
+    JS_STRING = 1;
+
+    // Use JavaScript numbers.
+    JS_NUMBER = 2;
+  }
+
+  // Should this field be parsed lazily?  Lazy applies only to message-type
+  // fields.  It means that when the outer message is initially parsed, the
+  // inner message's contents will not be parsed but instead stored in encoded
+  // form.  The inner message will actually be parsed when it is first accessed.
+  //
+  // This is only a hint.  Implementations are free to choose whether to use
+  // eager or lazy parsing regardless of the value of this option.  However,
+  // setting this option true suggests that the protocol author believes that
+  // using lazy parsing on this field is worth the additional bookkeeping
+  // overhead typically needed to implement it.
+  //
+  // This option does not affect the public interface of any generated code;
+  // all method signatures remain the same.  Furthermore, thread-safety of the
+  // interface is not affected by this option; const methods remain safe to
+  // call from multiple threads concurrently, while non-const methods continue
+  // to require exclusive access.
+  //
+  //
+  // Note that implementations may choose not to check required fields within
+  // a lazy sub-message.  That is, calling IsInitialized() on the outher message
+  // may return true even if the inner message has missing required fields.
+  // This is necessary because otherwise the inner message would have to be
+  // parsed in order to perform the check, defeating the purpose of lazy
+  // parsing.  An implementation which chooses not to check required fields
+  // must be consistent about it.  That is, for any particular sub-message, the
+  // implementation must either *always* check its required fields, or *never*
+  // check its required fields, regardless of whether or not the message has
+  // been parsed.
+  optional bool lazy = 5 [default=false];
+
+  // Is this field deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for accessors, or it will be completely ignored; in the very least, this
+  // is a formalization for deprecating fields.
+  optional bool deprecated = 3 [default=false];
+
+  // For Google-internal migration only. Do not use.
+  optional bool weak = 10 [default=false];
+
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message OneofOptions {
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message EnumOptions {
+
+  // Set this option to true to allow mapping different tag names to the same
+  // value.
+  optional bool allow_alias = 2;
+
+  // Is this enum deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for the enum, or it will be completely ignored; in the very least, this
+  // is a formalization for deprecating enums.
+  optional bool deprecated = 3 [default=false];
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message EnumValueOptions {
+  // Is this enum value deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for the enum value, or it will be completely ignored; in the very least,
+  // this is a formalization for deprecating enum values.
+  optional bool deprecated = 1 [default=false];
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message ServiceOptions {
+
+  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
+  //   framework.  We apologize for hoarding these numbers to ourselves, but
+  //   we were already using them long before we decided to release Protocol
+  //   Buffers.
+
+  // Is this service deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for the service, or it will be completely ignored; in the very least,
+  // this is a formalization for deprecating services.
+  optional bool deprecated = 33 [default=false];
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+message MethodOptions {
+
+  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC
+  //   framework.  We apologize for hoarding these numbers to ourselves, but
+  //   we were already using them long before we decided to release Protocol
+  //   Buffers.
+
+  // Is this method deprecated?
+  // Depending on the target platform, this can emit Deprecated annotations
+  // for the method, or it will be completely ignored; in the very least,
+  // this is a formalization for deprecating methods.
+  optional bool deprecated = 33 [default=false];
+
+  // The parser stores options it doesn't recognize here. See above.
+  repeated UninterpretedOption uninterpreted_option = 999;
+
+  // Clients can define custom options in extensions of this message. See above.
+  extensions 1000 to max;
+}
+
+
+// A message representing a option the parser does not recognize. This only
+// appears in options protos created by the compiler::Parser class.
+// DescriptorPool resolves these when building Descriptor objects. Therefore,
+// options protos in descriptor objects (e.g. returned by Descriptor::options(),
+// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
+// in them.
+message UninterpretedOption {
+  // The name of the uninterpreted option.  Each string represents a segment in
+  // a dot-separated name.  is_extension is true iff a segment represents an
+  // extension (denoted with parentheses in options specs in .proto files).
+  // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
+  // "foo.(bar.baz).qux".
+  message NamePart {
+    required string name_part = 1;
+    required bool is_extension = 2;
+  }
+  repeated NamePart name = 2;
+
+  // The value of the uninterpreted option, in whatever type the tokenizer
+  // identified it as during parsing. Exactly one of these should be set.
+  optional string identifier_value = 3;
+  optional uint64 positive_int_value = 4;
+  optional int64 negative_int_value = 5;
+  optional double double_value = 6;
+  optional bytes string_value = 7;
+  optional string aggregate_value = 8;
+}
+
+// ===================================================================
+// Optional source code info
+
+// Encapsulates information about the original source file from which a
+// FileDescriptorProto was generated.
+message SourceCodeInfo {
+  // A Location identifies a piece of source code in a .proto file which
+  // corresponds to a particular definition.  This information is intended
+  // to be useful to IDEs, code indexers, documentation generators, and similar
+  // tools.
+  //
+  // For example, say we have a file like:
+  //   message Foo {
+  //     optional string foo = 1;
+  //   }
+  // Let's look at just the field definition:
+  //   optional string foo = 1;
+  //   ^       ^^     ^^  ^  ^^^
+  //   a       bc     de  f  ghi
+  // We have the following locations:
+  //   span   path               represents
+  //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
+  //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
+  //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
+  //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
+  //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
+  //
+  // Notes:
+  // - A location may refer to a repeated field itself (i.e. not to any
+  //   particular index within it).  This is used whenever a set of elements are
+  //   logically enclosed in a single code segment.  For example, an entire
+  //   extend block (possibly containing multiple extension definitions) will
+  //   have an outer location whose path refers to the "extensions" repeated
+  //   field without an index.
+  // - Multiple locations may have the same path.  This happens when a single
+  //   logical declaration is spread out across multiple places.  The most
+  //   obvious example is the "extend" block again -- there may be multiple
+  //   extend blocks in the same scope, each of which will have the same path.
+  // - A location's span is not always a subset of its parent's span.  For
+  //   example, the "extendee" of an extension declaration appears at the
+  //   beginning of the "extend" block and is shared by all extensions within
+  //   the block.
+  // - Just because a location's span is a subset of some other location's span
+  //   does not mean that it is a descendent.  For example, a "group" defines
+  //   both a type and a field in a single declaration.  Thus, the locations
+  //   corresponding to the type and field and their components will overlap.
+  // - Code which tries to interpret locations should probably be designed to
+  //   ignore those that it doesn't understand, as more types of locations could
+  //   be recorded in the future.
+  repeated Location location = 1;
+  message Location {
+    // Identifies which part of the FileDescriptorProto was defined at this
+    // location.
+    //
+    // Each element is a field number or an index.  They form a path from
+    // the root FileDescriptorProto to the place where the definition.  For
+    // example, this path:
+    //   [ 4, 3, 2, 7, 1 ]
+    // refers to:
+    //   file.message_type(3)  // 4, 3
+    //       .field(7)         // 2, 7
+    //       .name()           // 1
+    // This is because FileDescriptorProto.message_type has field number 4:
+    //   repeated DescriptorProto message_type = 4;
+    // and DescriptorProto.field has field number 2:
+    //   repeated FieldDescriptorProto field = 2;
+    // and FieldDescriptorProto.name has field number 1:
+    //   optional string name = 1;
+    //
+    // Thus, the above path gives the location of a field name.  If we removed
+    // the last element:
+    //   [ 4, 3, 2, 7 ]
+    // this path refers to the whole field declaration (from the beginning
+    // of the label to the terminating semicolon).
+    repeated int32 path = 1 [packed=true];
+
+    // Always has exactly three or four elements: start line, start column,
+    // end line (optional, otherwise assumed same as start line), end column.
+    // These are packed into a single field for efficiency.  Note that line
+    // and column numbers are zero-based -- typically you will want to add
+    // 1 to each before displaying to a user.
+    repeated int32 span = 2 [packed=true];
+
+    // If this SourceCodeInfo represents a complete declaration, these are any
+    // comments appearing before and after the declaration which appear to be
+    // attached to the declaration.
+    //
+    // A series of line comments appearing on consecutive lines, with no other
+    // tokens appearing on those lines, will be treated as a single comment.
+    //
+    // leading_detached_comments will keep paragraphs of comments that appear
+    // before (but not connected to) the current element. Each paragraph,
+    // separated by empty lines, will be one comment element in the repeated
+    // field.
+    //
+    // Only the comment content is provided; comment markers (e.g. //) are
+    // stripped out.  For block comments, leading whitespace and an asterisk
+    // will be stripped from the beginning of each line other than the first.
+    // Newlines are included in the output.
+    //
+    // Examples:
+    //
+    //   optional int32 foo = 1;  // Comment attached to foo.
+    //   // Comment attached to bar.
+    //   optional int32 bar = 2;
+    //
+    //   optional string baz = 3;
+    //   // Comment attached to baz.
+    //   // Another line attached to baz.
+    //
+    //   // Comment attached to qux.
+    //   //
+    //   // Another line attached to qux.
+    //   optional double qux = 4;
+    //
+    //   // Detached comment for corge. This is not leading or trailing comments
+    //   // to qux or corge because there are blank lines separating it from
+    //   // both.
+    //
+    //   // Detached comment for corge paragraph 2.
+    //
+    //   optional string corge = 5;
+    //   /* Block comment attached
+    //    * to corge.  Leading asterisks
+    //    * will be removed. */
+    //   /* Block comment attached to
+    //    * grault. */
+    //   optional int32 grault = 6;
+    //
+    //   // ignored detached comments.
+    optional string leading_comments = 3;
+    optional string trailing_comments = 4;
+    repeated string leading_detached_comments = 6;
+  }
+}
+
+// Describes the relationship between generated code and its original source
+// file. A GeneratedCodeInfo message is associated with only one generated
+// source file, but may contain references to different source .proto files.
+message GeneratedCodeInfo {
+  // An Annotation connects some span of text in generated code to an element
+  // of its generating .proto file.
+  repeated Annotation annotation = 1;
+  message Annotation {
+    // Identifies the element in the original source .proto file. This field
+    // is formatted the same as SourceCodeInfo.Location.path.
+    repeated int32 path = 1 [packed=true];
+
+    // Identifies the filesystem path to the original source .proto.
+    optional string source_file = 2;
+
+    // Identifies the starting offset in bytes in the generated code
+    // that relates to the identified object.
+    optional int32 begin = 3;
+
+    // Identifies the ending offset in bytes in the generated code that
+    // relates to the identified offset. The end offset should be one past
+    // the last relevant byte (so the length of the text = end - begin).
+    optional int32 end = 4;
+  }
+}

+ 97 - 0
Protos/google/protobuf/duration.proto

@@ -0,0 +1,97 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/duration";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "DurationProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// A Duration represents a signed, fixed-length span of time represented
+// as a count of seconds and fractions of seconds at nanosecond
+// resolution. It is independent of any calendar and concepts like "day"
+// or "month". It is related to Timestamp in that the difference between
+// two Timestamp values is a Duration and it can be added or subtracted
+// from a Timestamp. Range is approximately +-10,000 years.
+//
+// Example 1: Compute Duration from two Timestamps in pseudo code.
+//
+//     Timestamp start = ...;
+//     Timestamp end = ...;
+//     Duration duration = ...;
+//
+//     duration.seconds = end.seconds - start.seconds;
+//     duration.nanos = end.nanos - start.nanos;
+//
+//     if (duration.seconds < 0 && duration.nanos > 0) {
+//       duration.seconds += 1;
+//       duration.nanos -= 1000000000;
+//     } else if (durations.seconds > 0 && duration.nanos < 0) {
+//       duration.seconds -= 1;
+//       duration.nanos += 1000000000;
+//     }
+//
+// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
+//
+//     Timestamp start = ...;
+//     Duration duration = ...;
+//     Timestamp end = ...;
+//
+//     end.seconds = start.seconds + duration.seconds;
+//     end.nanos = start.nanos + duration.nanos;
+//
+//     if (end.nanos < 0) {
+//       end.seconds -= 1;
+//       end.nanos += 1000000000;
+//     } else if (end.nanos >= 1000000000) {
+//       end.seconds += 1;
+//       end.nanos -= 1000000000;
+//     }
+//
+//
+message Duration {
+  // Signed seconds of the span of time. Must be from -315,576,000,000
+  // to +315,576,000,000 inclusive.
+  int64 seconds = 1;
+
+  // Signed fractions of a second at nanosecond resolution of the span
+  // of time. Durations less than one second are represented with a 0
+  // `seconds` field and a positive or negative `nanos` field. For durations
+  // of one second or more, a non-zero value for the `nanos` field must be
+  // of the same sign as the `seconds` field. Must be from -999,999,999
+  // to +999,999,999 inclusive.
+  int32 nanos = 2;
+}

+ 53 - 0
Protos/google/protobuf/empty.proto

@@ -0,0 +1,53 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/empty";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "EmptyProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+option cc_enable_arenas = true;
+
+// A generic empty message that you can re-use to avoid defining duplicated
+// empty messages in your APIs. A typical example is to use it as the request
+// or the response type of an API method. For instance:
+//
+//     service Foo {
+//       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
+//     }
+//
+// The JSON representation for `Empty` is empty JSON object `{}`.
+message Empty {}

+ 246 - 0
Protos/google/protobuf/field_mask.proto

@@ -0,0 +1,246 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "FieldMaskProto";
+option java_multiple_files = true;
+option objc_class_prefix = "GPB";
+option java_generate_equals_and_hash = true;
+
+// `FieldMask` represents a set of symbolic field paths, for example:
+//
+//     paths: "f.a"
+//     paths: "f.b.d"
+//
+// Here `f` represents a field in some root message, `a` and `b`
+// fields in the message found in `f`, and `d` a field found in the
+// message in `f.b`.
+//
+// Field masks are used to specify a subset of fields that should be
+// returned by a get operation or modified by an update operation.
+// Field masks also have a custom JSON encoding (see below).
+//
+// # Field Masks in Projections
+//
+// When used in the context of a projection, a response message or
+// sub-message is filtered by the API to only contain those fields as
+// specified in the mask. For example, if the mask in the previous
+// example is applied to a response message as follows:
+//
+//     f {
+//       a : 22
+//       b {
+//         d : 1
+//         x : 2
+//       }
+//       y : 13
+//     }
+//     z: 8
+//
+// The result will not contain specific values for fields x,y and z
+// (their value will be set to the default, and omitted in proto text
+// output):
+//
+//
+//     f {
+//       a : 22
+//       b {
+//         d : 1
+//       }
+//     }
+//
+// A repeated field is not allowed except at the last position of a
+// field mask.
+//
+// If a FieldMask object is not present in a get operation, the
+// operation applies to all fields (as if a FieldMask of all fields
+// had been specified).
+//
+// Note that a field mask does not necessarily apply to the
+// top-level response message. In case of a REST get operation, the
+// field mask applies directly to the response, but in case of a REST
+// list operation, the mask instead applies to each individual message
+// in the returned resource list. In case of a REST custom method,
+// other definitions may be used. Where the mask applies will be
+// clearly documented together with its declaration in the API.  In
+// any case, the effect on the returned resource/resources is required
+// behavior for APIs.
+//
+// # Field Masks in Update Operations
+//
+// A field mask in update operations specifies which fields of the
+// targeted resource are going to be updated. The API is required
+// to only change the values of the fields as specified in the mask
+// and leave the others untouched. If a resource is passed in to
+// describe the updated values, the API ignores the values of all
+// fields not covered by the mask.
+//
+// If a repeated field is specified for an update operation, the existing
+// repeated values in the target resource will be overwritten by the new values.
+// Note that a repeated field is only allowed in the last position of a field
+// mask.
+//
+// If a sub-message is specified in the last position of the field mask for an
+// update operation, then the existing sub-message in the target resource is
+// overwritten. Given the target message:
+//
+//     f {
+//       b {
+//         d : 1
+//         x : 2
+//       }
+//       c : 1
+//     }
+//
+// And an update message:
+//
+//     f {
+//       b {
+//         d : 10
+//       }
+//     }
+//
+// then if the field mask is:
+//
+//  paths: "f.b"
+//
+// then the result will be:
+//
+//     f {
+//       b {
+//         d : 10
+//       }
+//       c : 1
+//     }
+//
+// However, if the update mask was:
+//
+//  paths: "f.b.d"
+//
+// then the result would be:
+//
+//     f {
+//       b {
+//         d : 10
+//         x : 2
+//       }
+//       c : 1
+//     }
+//
+// In order to reset a field's value to the default, the field must
+// be in the mask and set to the default value in the provided resource.
+// Hence, in order to reset all fields of a resource, provide a default
+// instance of the resource and set all fields in the mask, or do
+// not provide a mask as described below.
+//
+// If a field mask is not present on update, the operation applies to
+// all fields (as if a field mask of all fields has been specified).
+// Note that in the presence of schema evolution, this may mean that
+// fields the client does not know and has therefore not filled into
+// the request will be reset to their default. If this is unwanted
+// behavior, a specific service may require a client to always specify
+// a field mask, producing an error if not.
+//
+// As with get operations, the location of the resource which
+// describes the updated values in the request message depends on the
+// operation kind. In any case, the effect of the field mask is
+// required to be honored by the API.
+//
+// ## Considerations for HTTP REST
+//
+// The HTTP kind of an update operation which uses a field mask must
+// be set to PATCH instead of PUT in order to satisfy HTTP semantics
+// (PUT must only be used for full updates).
+//
+// # JSON Encoding of Field Masks
+//
+// In JSON, a field mask is encoded as a single string where paths are
+// separated by a comma. Fields name in each path are converted
+// to/from lower-camel naming conventions.
+//
+// As an example, consider the following message declarations:
+//
+//     message Profile {
+//       User user = 1;
+//       Photo photo = 2;
+//     }
+//     message User {
+//       string display_name = 1;
+//       string address = 2;
+//     }
+//
+// In proto a field mask for `Profile` may look as such:
+//
+//     mask {
+//       paths: "user.display_name"
+//       paths: "photo"
+//     }
+//
+// In JSON, the same mask is represented as below:
+//
+//     {
+//       mask: "user.displayName,photo"
+//     }
+//
+// # Field Masks and Oneof Fields
+//
+// Field masks treat fields in oneofs just as regular fields. Consider the
+// following message:
+//
+//     message SampleMessage {
+//       oneof test_oneof {
+//         string name = 4;
+//         SubMessage sub_message = 9;
+//       }
+//     }
+//
+// The field mask can be:
+//
+//     mask {
+//       paths: "name"
+//     }
+//
+// Or:
+//
+//     mask {
+//       paths: "sub_message"
+//     }
+//
+// Note that oneof type names ("test_oneof" in this case) cannot be used in
+// paths.
+message FieldMask {
+  // The set of field mask paths.
+  repeated string paths = 1;
+}

+ 130 - 0
Protos/google/protobuf/map_lite_unittest.proto

@@ -0,0 +1,130 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+option cc_enable_arenas = true;
+option optimize_for = LITE_RUNTIME;
+
+import "google/protobuf/unittest_lite.proto";
+import "google/protobuf/unittest_no_arena_lite.proto";
+
+package protobuf_unittest;
+
+message TestMapLite {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<string  , string  > map_string_string     = 14;
+  map<int32   , bytes   > map_int32_bytes       = 15;
+  map<int32   , MapEnumLite> map_int32_enum     = 16;
+  map<int32   , ForeignMessageLite> map_int32_foreign_message = 17;
+  map<int32, int32> teboring = 18;
+}
+
+message TestArenaMapLite {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<string  , string  > map_string_string     = 14;
+  map<int32   , bytes   > map_int32_bytes       = 15;
+  map<int32   , MapEnumLite> map_int32_enum     = 16;
+  map<int32   , ForeignMessageArenaLite> map_int32_foreign_message = 17;
+  map<int32, .protobuf_unittest_no_arena.ForeignMessageLite>
+      map_int32_foreign_message_no_arena = 18;
+}
+
+// Test embedded message with required fields
+message TestRequiredMessageMapLite {
+  map<int32, TestRequiredLite> map_field = 1;
+}
+
+message TestEnumMapLite {
+  map<int32, Proto2MapEnumLite> known_map_field = 101;
+  map<int32, Proto2MapEnumLite> unknown_map_field = 102;
+}
+
+message TestEnumMapPlusExtraLite {
+  map<int32, Proto2MapEnumPlusExtraLite> known_map_field = 101;
+  map<int32, Proto2MapEnumPlusExtraLite> unknown_map_field = 102;
+}
+
+message TestMessageMapLite {
+  map<int32, TestAllTypesLite> map_int32_message = 1;
+}
+
+enum Proto2MapEnumLite {
+  PROTO2_MAP_ENUM_FOO_LITE = 0;
+  PROTO2_MAP_ENUM_BAR_LITE = 1;
+  PROTO2_MAP_ENUM_BAZ_LITE = 2;
+}
+
+enum Proto2MapEnumPlusExtraLite {
+  E_PROTO2_MAP_ENUM_FOO_LITE   = 0;
+  E_PROTO2_MAP_ENUM_BAR_LITE   = 1;
+  E_PROTO2_MAP_ENUM_BAZ_LITE   = 2;
+  E_PROTO2_MAP_ENUM_EXTRA_LITE = 3;
+}
+
+enum MapEnumLite {
+  MAP_ENUM_FOO_LITE = 0;
+  MAP_ENUM_BAR_LITE = 1;
+  MAP_ENUM_BAZ_LITE = 2;
+}
+
+message TestRequiredLite {
+  required int32 a = 1;
+  required int32 b = 2;
+  required int32 c = 3;
+}
+
+message ForeignMessageArenaLite {
+  optional int32 c = 1;
+}

+ 66 - 0
Protos/google/protobuf/map_proto2_unittest.proto

@@ -0,0 +1,66 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+
+import "google/protobuf/unittest_import.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest;
+
+enum Proto2MapEnum {
+  PROTO2_MAP_ENUM_FOO   = 0;
+  PROTO2_MAP_ENUM_BAR   = 1;
+  PROTO2_MAP_ENUM_BAZ   = 2;
+}
+
+enum Proto2MapEnumPlusExtra {
+  E_PROTO2_MAP_ENUM_FOO   = 0;
+  E_PROTO2_MAP_ENUM_BAR   = 1;
+  E_PROTO2_MAP_ENUM_BAZ   = 2;
+  E_PROTO2_MAP_ENUM_EXTRA = 3;
+}
+
+message TestEnumMap {
+  map<int32, Proto2MapEnum> known_map_field = 101;
+  map<int32, Proto2MapEnum> unknown_map_field = 102;
+}
+
+message TestEnumMapPlusExtra {
+  map<int32, Proto2MapEnumPlusExtra> known_map_field = 101;
+  map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102;
+}
+
+message TestImportEnumMap {
+  map<int32, protobuf_unittest_import.ImportEnumForMap> import_enum_amp = 1;
+}

+ 129 - 0
Protos/google/protobuf/map_unittest.proto

@@ -0,0 +1,129 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+option cc_enable_arenas = true;
+
+import "google/protobuf/unittest.proto";
+import "google/protobuf/unittest_no_arena.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest;
+
+// Tests maps.
+message TestMap {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<string  , string  > map_string_string     = 14;
+  map<int32   , bytes   > map_int32_bytes       = 15;
+  map<int32   , MapEnum > map_int32_enum        = 16;
+  map<int32   , ForeignMessage> map_int32_foreign_message = 17;
+  map<string  , ForeignMessage> map_string_foreign_message = 18;
+}
+
+message TestMapSubmessage {
+  TestMap test_map = 1;
+}
+
+message TestMessageMap {
+  map<int32, TestAllTypes> map_int32_message = 1;
+}
+
+// Two map fields share the same entry default instance.
+message TestSameTypeMap {
+  map<int32, int32> map1 = 1;
+  map<int32, int32> map2 = 2;
+}
+
+
+enum MapEnum {
+  MAP_ENUM_FOO = 0;
+  MAP_ENUM_BAR = 1;
+  MAP_ENUM_BAZ = 2;
+}
+
+// Test embedded message with required fields
+message TestRequiredMessageMap {
+  map<int32, TestRequired> map_field = 1;
+}
+
+message TestArenaMap {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<string  , string  > map_string_string     = 14;
+  map<int32   , bytes   > map_int32_bytes       = 15;
+  map<int32   , MapEnum > map_int32_enum        = 16;
+  map<int32   , ForeignMessage> map_int32_foreign_message = 17;
+  map<int32, .protobuf_unittest_no_arena.ForeignMessage>
+      map_int32_foreign_message_no_arena = 18;
+}
+
+// Previously, message containing enum called Type cannot be used as value of
+// map field.
+message MessageContainingEnumCalledType {
+  enum Type {
+    TYPE_FOO = 0;
+  }
+  map<string, MessageContainingEnumCalledType> type = 1;
+}
+
+// Previously, message cannot contain map field called "entry".
+message MessageContainingMapCalledEntry {
+  map<int32, int32> entry = 1;
+}
+
+message TestRecursiveMapMessage {
+  map<string, TestRecursiveMapMessage> a = 1;
+}

+ 123 - 0
Protos/google/protobuf/map_unittest_proto3.proto

@@ -0,0 +1,123 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file is mostly equivalent to map_unittest.proto, but imports
+// unittest_proto3.proto instead of unittest.proto, so that it only
+// uses proto3 messages. This makes it suitable for testing
+// implementations which only support proto3.
+// The TestRequiredMessageMap message has been removed as there are no
+// required fields in proto3.
+syntax = "proto3";
+
+option cc_enable_arenas = true;
+option csharp_namespace = "Google.Protobuf.TestProtos";
+
+// Disambiguate from map_unittest.proto messages
+option swift_prefix = "Proto3";
+
+import "google/protobuf/unittest_proto3.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest;
+
+// Tests maps.
+message TestMap {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<string  , string  > map_string_string     = 14;
+  map<int32   , bytes   > map_int32_bytes       = 15;
+  map<int32   , MapEnum > map_int32_enum        = 16;
+  map<int32   , ForeignMessage> map_int32_foreign_message = 17;
+}
+
+message TestMapSubmessage {
+  TestMap test_map = 1;
+}
+
+message TestMessageMap {
+  map<int32, TestAllTypes> map_int32_message = 1;
+}
+
+// Two map fields share the same entry default instance.
+message TestSameTypeMap {
+  map<int32, int32> map1 = 1;
+  map<int32, int32> map2 = 2;
+}
+
+enum MapEnum {
+  MAP_ENUM_FOO = 0;
+  MAP_ENUM_BAR = 1;
+  MAP_ENUM_BAZ = 2;
+}
+
+message TestArenaMap {
+  map<int32   , int32   > map_int32_int32       = 1;
+  map<int64   , int64   > map_int64_int64       = 2;
+  map<uint32  , uint32  > map_uint32_uint32     = 3;
+  map<uint64  , uint64  > map_uint64_uint64     = 4;
+  map<sint32  , sint32  > map_sint32_sint32     = 5;
+  map<sint64  , sint64  > map_sint64_sint64     = 6;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 7;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 8;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
+  map<int32   , float   > map_int32_float       = 11;
+  map<int32   , double  > map_int32_double      = 12;
+  map<bool    , bool    > map_bool_bool         = 13;
+  map<int32   , MapEnum > map_int32_enum        = 14;
+  map<int32   , ForeignMessage> map_int32_foreign_message = 15;
+}
+
+// Previously, message containing enum called Type cannot be used as value of
+// map field.
+message MessageContainingEnumCalledType {
+  enum Type {
+    TYPE_FOO = 0;
+  }
+  map<int32, MessageContainingEnumCalledType> type = 1;
+}
+
+// Previously, message cannot contain map field called "entry".
+message MessageContainingMapCalledEntry {
+  map<int32, int32> entry = 1;
+}

+ 48 - 0
Protos/google/protobuf/source_context.proto

@@ -0,0 +1,48 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "SourceContextProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// `SourceContext` represents information about the source of a
+// protobuf element, like the file in which it is defined.
+message SourceContext {
+  // The path-qualified name of the .proto file that contained the associated
+  // protobuf element.  For example: `"google/protobuf/source_context.proto"`.
+  string file_name = 1;
+}

+ 96 - 0
Protos/google/protobuf/struct.proto

@@ -0,0 +1,96 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "StructProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+
+// `Struct` represents a structured data value, consisting of fields
+// which map to dynamically typed values. In some languages, `Struct`
+// might be supported by a native representation. For example, in
+// scripting languages like JS a struct is represented as an
+// object. The details of that representation are described together
+// with the proto support for the language.
+//
+// The JSON representation for `Struct` is JSON object.
+message Struct {
+  // Unordered map of dynamically typed values.
+  map<string, Value> fields = 1;
+}
+
+// `Value` represents a dynamically typed value which can be either
+// null, a number, a string, a boolean, a recursive struct value, or a
+// list of values. A producer of value is expected to set one of that
+// variants, absence of any variant indicates an error.
+//
+// The JSON representation for `Value` is JSON value.
+message Value {
+  // The kind of value.
+  oneof kind {
+    // Represents a null value.
+    NullValue null_value = 1;
+    // Represents a double value.
+    double number_value = 2;
+    // Represents a string value.
+    string string_value = 3;
+    // Represents a boolean value.
+    bool bool_value = 4;
+    // Represents a structured value.
+    Struct struct_value = 5;
+    // Represents a repeated `Value`.
+    ListValue list_value = 6;
+  }
+}
+
+// `NullValue` is a singleton enumeration to represent the null value for the
+// `Value` type union.
+//
+//  The JSON representation for `NullValue` is JSON `null`.
+enum NullValue {
+  // Null value.
+  NULL_VALUE = 0;
+}
+
+// `ListValue` is a wrapper around a repeated field of values.
+//
+// The JSON representation for `ListValue` is JSON array.
+message ListValue {
+  // Repeated field of dynamically typed values.
+  repeated Value values = 1;
+}

+ 111 - 0
Protos/google/protobuf/timestamp.proto

@@ -0,0 +1,111 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/timestamp";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "TimestampProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// A Timestamp represents a point in time independent of any time zone
+// or calendar, represented as seconds and fractions of seconds at
+// nanosecond resolution in UTC Epoch time. It is encoded using the
+// Proleptic Gregorian Calendar which extends the Gregorian calendar
+// backwards to year one. It is encoded assuming all minutes are 60
+// seconds long, i.e. leap seconds are "smeared" so that no leap second
+// table is needed for interpretation. Range is from
+// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
+// By restricting to that range, we ensure that we can convert to
+// and from  RFC 3339 date strings.
+// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
+//
+// Example 1: Compute Timestamp from POSIX `time()`.
+//
+//     Timestamp timestamp;
+//     timestamp.set_seconds(time(NULL));
+//     timestamp.set_nanos(0);
+//
+// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+//
+//     struct timeval tv;
+//     gettimeofday(&tv, NULL);
+//
+//     Timestamp timestamp;
+//     timestamp.set_seconds(tv.tv_sec);
+//     timestamp.set_nanos(tv.tv_usec * 1000);
+//
+// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+//
+//     FILETIME ft;
+//     GetSystemTimeAsFileTime(&ft);
+//     UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+//
+//     // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+//     // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+//     Timestamp timestamp;
+//     timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+//     timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+//
+// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+//
+//     long millis = System.currentTimeMillis();
+//
+//     Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+//         .setNanos((int) ((millis % 1000) * 1000000)).build();
+//
+//
+// Example 5: Compute Timestamp from current time in Python.
+//
+//     now = time.time()
+//     seconds = int(now)
+//     nanos = int((now - seconds) * 10**9)
+//     timestamp = Timestamp(seconds=seconds, nanos=nanos)
+//
+//
+message Timestamp {
+
+  // Represents seconds of UTC time since Unix epoch
+  // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
+  // 9999-12-31T23:59:59Z inclusive.
+  int64 seconds = 1;
+
+  // Non-negative fractions of a second at nanosecond resolution. Negative
+  // second values with fractions must still have non-negative nanos values
+  // that count forward in time. Must be from 0 to 999,999,999
+  // inclusive.
+  int32 nanos = 2;
+}

+ 180 - 0
Protos/google/protobuf/type.proto

@@ -0,0 +1,180 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+import "google/protobuf/any.proto";
+import "google/protobuf/source_context.proto";
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "TypeProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// A protocol buffer message type.
+message Type {
+  // The fully qualified message name.
+  string name = 1;
+  // The list of fields.
+  repeated Field fields = 2;
+  // The list of types appearing in `oneof` definitions in this type.
+  repeated string oneofs = 3;
+  // The protocol buffer options.
+  repeated Option options = 4;
+  // The source context.
+  SourceContext source_context = 5;
+  // The source syntax.
+  Syntax syntax = 6;
+}
+
+// A single field of a message type.
+message Field {
+  // Basic field types.
+  enum Kind {
+    // Field type unknown.
+    TYPE_UNKNOWN        = 0;
+    // Field type double.
+    TYPE_DOUBLE         = 1;
+    // Field type float.
+    TYPE_FLOAT          = 2;
+    // Field type int64.
+    TYPE_INT64          = 3;
+    // Field type uint64.
+    TYPE_UINT64         = 4;
+    // Field type int32.
+    TYPE_INT32          = 5;
+    // Field type fixed64.
+    TYPE_FIXED64        = 6;
+    // Field type fixed32.
+    TYPE_FIXED32        = 7;
+    // Field type bool.
+    TYPE_BOOL           = 8;
+    // Field type string.
+    TYPE_STRING         = 9;
+    // Field type group. Proto2 syntax only, and deprecated.
+    TYPE_GROUP          = 10;
+    // Field type message.
+    TYPE_MESSAGE        = 11;
+    // Field type bytes.
+    TYPE_BYTES          = 12;
+    // Field type uint32.
+    TYPE_UINT32         = 13;
+    // Field type enum.
+    TYPE_ENUM           = 14;
+    // Field type sfixed32.
+    TYPE_SFIXED32       = 15;
+    // Field type sfixed64.
+    TYPE_SFIXED64       = 16;
+    // Field type sint32.
+    TYPE_SINT32         = 17;
+    // Field type sint64.
+    TYPE_SINT64         = 18;
+  };
+
+  // Whether a field is optional, required, or repeated.
+  enum Cardinality {
+    // For fields with unknown cardinality.
+    CARDINALITY_UNKNOWN = 0;
+    // For optional fields.
+    CARDINALITY_OPTIONAL = 1;
+    // For required fields. Proto2 syntax only.
+    CARDINALITY_REQUIRED = 2;
+    // For repeated fields.
+    CARDINALITY_REPEATED = 3;
+  };
+
+  // The field type.
+  Kind kind = 1;
+  // The field cardinality.
+  Cardinality cardinality = 2;
+  // The field number.
+  int32 number = 3;
+  // The field name.
+  string name = 4;
+  // The field type URL, without the scheme, for message or enumeration
+  // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
+  string type_url = 6;
+  // The index of the field type in `Type.oneofs`, for message or enumeration
+  // types. The first type has index 1; zero means the type is not in the list.
+  int32 oneof_index = 7;
+  // Whether to use alternative packed wire representation.
+  bool packed = 8;
+  // The protocol buffer options.
+  repeated Option options = 9;
+  // The field JSON name.
+  string json_name = 10;
+  // The string value of the default value of this field. Proto2 syntax only.
+  string default_value = 11;
+}
+
+// Enum type definition.
+message Enum {
+  // Enum type name.
+  string name = 1;
+  // Enum value definitions.
+  repeated EnumValue enumvalue = 2;
+  // Protocol buffer options.
+  repeated Option options = 3;
+  // The source context.
+  SourceContext source_context = 4;
+  // The source syntax.
+  Syntax syntax = 5;
+}
+
+// Enum value definition.
+message EnumValue {
+  // Enum value name.
+  string name = 1;
+  // Enum value number.
+  int32 number = 2;
+  // Protocol buffer options.
+  repeated Option options = 3;
+}
+
+// A protocol buffer option, which can be attached to a message, field,
+// enumeration, etc.
+message Option {
+  // The option's name. For example, `"java_package"`.
+  string name = 1;
+  // The option's value. For example, `"com.google.protobuf"`.
+  Any value = 2;
+}
+
+// The syntax in which a protocol buffer element is defined.
+enum Syntax {
+  // Syntax `proto2`.
+  SYNTAX_PROTO2 = 0;
+  // Syntax `proto3`.
+  SYNTAX_PROTO3 = 1;
+}

+ 880 - 0
Protos/google/protobuf/unittest.proto

@@ -0,0 +1,880 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file we will use for unit testing.
+
+syntax = "proto2";
+
+// Some generic_services option(s) added automatically.
+// See:  http://go/proto2-generic-services-default
+option cc_generic_services = true;     // auto-added
+option java_generic_services = true;   // auto-added
+option py_generic_services = true;     // auto-added
+option cc_enable_arenas = true;
+
+import "google/protobuf/unittest_import.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest;
+
+// Protos optimized for SPEED use a strict superset of the generated code
+// of equivalent ones optimized for CODE_SIZE, so we should optimize all our
+// tests for speed unless explicitly testing code size optimization.
+option optimize_for = SPEED;
+
+option java_outer_classname = "UnittestProto";
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    optional int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  optional    int32 optional_int32    =  1;
+  optional    int64 optional_int64    =  2;
+  optional   uint32 optional_uint32   =  3;
+  optional   uint64 optional_uint64   =  4;
+  optional   sint32 optional_sint32   =  5;
+  optional   sint64 optional_sint64   =  6;
+  optional  fixed32 optional_fixed32  =  7;
+  optional  fixed64 optional_fixed64  =  8;
+  optional sfixed32 optional_sfixed32 =  9;
+  optional sfixed64 optional_sfixed64 = 10;
+  optional    float optional_float    = 11;
+  optional   double optional_double   = 12;
+  optional     bool optional_bool     = 13;
+  optional   string optional_string   = 14;
+  optional    bytes optional_bytes    = 15;
+
+  optional group OptionalGroup = 16 {
+    optional int32 a = 17;
+  }
+
+  optional NestedMessage                        optional_nested_message  = 18;
+  optional ForeignMessage                       optional_foreign_message = 19;
+  optional protobuf_unittest_import.ImportMessage optional_import_message  = 20;
+
+  optional NestedEnum                           optional_nested_enum     = 21;
+  optional ForeignEnum                          optional_foreign_enum    = 22;
+  optional protobuf_unittest_import.ImportEnum    optional_import_enum     = 23;
+
+  optional string optional_string_piece = 24 [ctype=STRING_PIECE];
+  optional string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  optional protobuf_unittest_import.PublicImportMessage
+      optional_public_import_message = 26;
+
+  optional NestedMessage optional_lazy_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated group RepeatedGroup = 46 {
+    optional int32 a = 47;
+  }
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  // Singular with defaults
+  optional    int32 default_int32    = 61 [default =  41    ];
+  optional    int64 default_int64    = 62 [default =  42    ];
+  optional   uint32 default_uint32   = 63 [default =  43    ];
+  optional   uint64 default_uint64   = 64 [default =  44    ];
+  optional   sint32 default_sint32   = 65 [default = -45    ];
+  optional   sint64 default_sint64   = 66 [default =  46    ];
+  optional  fixed32 default_fixed32  = 67 [default =  47    ];
+  optional  fixed64 default_fixed64  = 68 [default =  48    ];
+  optional sfixed32 default_sfixed32 = 69 [default =  49    ];
+  optional sfixed64 default_sfixed64 = 70 [default = -50    ];
+  optional    float default_float    = 71 [default =  51.5  ];
+  optional   double default_double   = 72 [default =  52e3  ];
+  optional     bool default_bool     = 73 [default = true   ];
+  optional   string default_string   = 74 [default = "hello"];
+  optional    bytes default_bytes    = 75 [default = "world"];
+
+  optional NestedEnum  default_nested_enum  = 81 [default = BAR        ];
+  optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
+  optional protobuf_unittest_import.ImportEnum
+      default_import_enum = 83 [default = IMPORT_BAR];
+
+  optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
+  optional string default_cord = 85 [ctype=CORD,default="123"];
+
+  // For oneof test
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+// This proto includes a recusively nested message.
+message NestedTestAllTypes {
+  optional NestedTestAllTypes child = 1;
+  optional TestAllTypes payload = 2;
+  repeated NestedTestAllTypes repeated_child = 3;
+}
+
+message TestDeprecatedFields {
+  optional int32 deprecated_int32 = 1 [deprecated=true];
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  optional int32 c = 1;
+  optional int32 d = 2;
+}
+
+enum ForeignEnum {
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+message TestReservedFields {
+  reserved 2, 15, 9 to 11;
+  reserved "bar", "baz";
+}
+
+message TestAllExtensions {
+  extensions 1 to max;
+}
+
+extend TestAllExtensions {
+  // Singular
+  optional    int32 optional_int32_extension    =  1;
+  optional    int64 optional_int64_extension    =  2;
+  optional   uint32 optional_uint32_extension   =  3;
+  optional   uint64 optional_uint64_extension   =  4;
+  optional   sint32 optional_sint32_extension   =  5;
+  optional   sint64 optional_sint64_extension   =  6;
+  optional  fixed32 optional_fixed32_extension  =  7;
+  optional  fixed64 optional_fixed64_extension  =  8;
+  optional sfixed32 optional_sfixed32_extension =  9;
+  optional sfixed64 optional_sfixed64_extension = 10;
+  optional    float optional_float_extension    = 11;
+  optional   double optional_double_extension   = 12;
+  optional     bool optional_bool_extension     = 13;
+  optional   string optional_string_extension   = 14;
+  optional    bytes optional_bytes_extension    = 15;
+
+  optional group OptionalGroup_extension = 16 {
+    optional int32 a = 17;
+  }
+
+  optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
+  optional ForeignMessage optional_foreign_message_extension = 19;
+  optional protobuf_unittest_import.ImportMessage
+    optional_import_message_extension = 20;
+
+  optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
+  optional ForeignEnum optional_foreign_enum_extension = 22;
+  optional protobuf_unittest_import.ImportEnum
+    optional_import_enum_extension = 23;
+
+  optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
+  optional string optional_cord_extension = 25 [ctype=CORD];
+
+  optional protobuf_unittest_import.PublicImportMessage
+    optional_public_import_message_extension = 26;
+
+  optional TestAllTypes.NestedMessage
+    optional_lazy_message_extension = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32_extension    = 31;
+  repeated    int64 repeated_int64_extension    = 32;
+  repeated   uint32 repeated_uint32_extension   = 33;
+  repeated   uint64 repeated_uint64_extension   = 34;
+  repeated   sint32 repeated_sint32_extension   = 35;
+  repeated   sint64 repeated_sint64_extension   = 36;
+  repeated  fixed32 repeated_fixed32_extension  = 37;
+  repeated  fixed64 repeated_fixed64_extension  = 38;
+  repeated sfixed32 repeated_sfixed32_extension = 39;
+  repeated sfixed64 repeated_sfixed64_extension = 40;
+  repeated    float repeated_float_extension    = 41;
+  repeated   double repeated_double_extension   = 42;
+  repeated     bool repeated_bool_extension     = 43;
+  repeated   string repeated_string_extension   = 44;
+  repeated    bytes repeated_bytes_extension    = 45;
+
+  repeated group RepeatedGroup_extension = 46 {
+    optional int32 a = 47;
+  }
+
+  repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
+  repeated ForeignMessage repeated_foreign_message_extension = 49;
+  repeated protobuf_unittest_import.ImportMessage
+    repeated_import_message_extension = 50;
+
+  repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
+  repeated ForeignEnum repeated_foreign_enum_extension = 52;
+  repeated protobuf_unittest_import.ImportEnum
+    repeated_import_enum_extension = 53;
+
+  repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord_extension = 55 [ctype=CORD];
+
+  repeated TestAllTypes.NestedMessage
+    repeated_lazy_message_extension = 57 [lazy=true];
+
+  // Singular with defaults
+  optional    int32 default_int32_extension    = 61 [default =  41    ];
+  optional    int64 default_int64_extension    = 62 [default =  42    ];
+  optional   uint32 default_uint32_extension   = 63 [default =  43    ];
+  optional   uint64 default_uint64_extension   = 64 [default =  44    ];
+  optional   sint32 default_sint32_extension   = 65 [default = -45    ];
+  optional   sint64 default_sint64_extension   = 66 [default =  46    ];
+  optional  fixed32 default_fixed32_extension  = 67 [default =  47    ];
+  optional  fixed64 default_fixed64_extension  = 68 [default =  48    ];
+  optional sfixed32 default_sfixed32_extension = 69 [default =  49    ];
+  optional sfixed64 default_sfixed64_extension = 70 [default = -50    ];
+  optional    float default_float_extension    = 71 [default =  51.5  ];
+  optional   double default_double_extension   = 72 [default =  52e3  ];
+  optional     bool default_bool_extension     = 73 [default = true   ];
+  optional   string default_string_extension   = 74 [default = "hello"];
+  optional    bytes default_bytes_extension    = 75 [default = "world"];
+
+  optional TestAllTypes.NestedEnum
+    default_nested_enum_extension = 81 [default = BAR];
+  optional ForeignEnum
+    default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
+  optional protobuf_unittest_import.ImportEnum
+    default_import_enum_extension = 83 [default = IMPORT_BAR];
+
+  optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
+                                                       default="abc"];
+  optional string default_cord_extension = 85 [ctype=CORD, default="123"];
+
+  // For oneof test
+  optional uint32 oneof_uint32_extension = 111;
+  optional TestAllTypes.NestedMessage oneof_nested_message_extension = 112;
+  optional string oneof_string_extension = 113;
+  optional bytes oneof_bytes_extension = 114;
+}
+
+message TestNestedExtension {
+  extend TestAllExtensions {
+    // Check for bug where string extensions declared in tested scope did not
+    // compile.
+    optional string test = 1002 [default="test"];
+    // Used to test if generated extension name is correct when there are
+    // underscores.
+    optional string nested_string_extension = 1003;
+  }
+}
+
+// We have separate messages for testing required fields because it's
+// annoying to have to fill in required fields in TestProto in order to
+// do anything with it.  Note that we don't need to test every type of
+// required filed because the code output is basically identical to
+// optional fields for all types.
+message TestRequired {
+  required int32 a = 1;
+  optional int32 dummy2 = 2;
+  required int32 b = 3;
+
+  extend TestAllExtensions {
+    optional TestRequired single = 1000;
+    repeated TestRequired multi  = 1001;
+  }
+
+  // Pad the field count to 32 so that we can test that IsInitialized()
+  // properly checks multiple elements of has_bits_.
+  optional int32 dummy4  =  4;
+  optional int32 dummy5  =  5;
+  optional int32 dummy6  =  6;
+  optional int32 dummy7  =  7;
+  optional int32 dummy8  =  8;
+  optional int32 dummy9  =  9;
+  optional int32 dummy10 = 10;
+  optional int32 dummy11 = 11;
+  optional int32 dummy12 = 12;
+  optional int32 dummy13 = 13;
+  optional int32 dummy14 = 14;
+  optional int32 dummy15 = 15;
+  optional int32 dummy16 = 16;
+  optional int32 dummy17 = 17;
+  optional int32 dummy18 = 18;
+  optional int32 dummy19 = 19;
+  optional int32 dummy20 = 20;
+  optional int32 dummy21 = 21;
+  optional int32 dummy22 = 22;
+  optional int32 dummy23 = 23;
+  optional int32 dummy24 = 24;
+  optional int32 dummy25 = 25;
+  optional int32 dummy26 = 26;
+  optional int32 dummy27 = 27;
+  optional int32 dummy28 = 28;
+  optional int32 dummy29 = 29;
+  optional int32 dummy30 = 30;
+  optional int32 dummy31 = 31;
+  optional int32 dummy32 = 32;
+
+  required int32 c = 33;
+}
+
+message TestRequiredForeign {
+  optional TestRequired optional_message = 1;
+  repeated TestRequired repeated_message = 2;
+  optional int32 dummy = 3;
+}
+
+// Test that we can use NestedMessage from outside TestAllTypes.
+message TestForeignNested {
+  optional TestAllTypes.NestedMessage foreign_nested = 1;
+}
+
+// TestEmptyMessage is used to test unknown field support.
+message TestEmptyMessage {
+}
+
+// Like above, but declare all field numbers as potential extensions.  No
+// actual extensions should ever be defined for this type.
+message TestEmptyMessageWithExtensions {
+  extensions 1 to max;
+}
+
+message TestMultipleExtensionRanges {
+  extensions 42;
+  extensions 4143 to 4243;
+  extensions 65536 to max;
+}
+
+// Test that really large tag numbers don't break anything.
+message TestReallyLargeTagNumber {
+  // The largest possible tag number is 2^28 - 1, since the wire format uses
+  // three bits to communicate wire type.
+  optional int32 a = 1;
+  optional int32 bb = 268435455;
+}
+
+message TestRecursiveMessage {
+  optional TestRecursiveMessage a = 1;
+  optional int32 i = 2;
+}
+
+// Test that mutual recursion works.
+message TestMutualRecursionA {
+  optional TestMutualRecursionB bb = 1;
+}
+
+message TestMutualRecursionB {
+  optional TestMutualRecursionA a = 1;
+  optional int32 optional_int32 = 2;
+}
+
+// Test that groups have disjoint field numbers from their siblings and
+// parents.  This is NOT possible in proto1; only google.protobuf.  When attempting
+// to compile with proto1, this will emit an error; so we only include it
+// in protobuf_unittest_proto.
+message TestDupFieldNumber {                        // NO_PROTO1
+  optional int32 a = 1;                             // NO_PROTO1
+  optional group Foo = 2 { optional int32 a = 1; }  // NO_PROTO1
+  optional group Bar = 3 { optional int32 a = 1; }  // NO_PROTO1
+}                                                   // NO_PROTO1
+
+// Additional messages for testing lazy fields.
+message TestEagerMessage {
+  optional TestAllTypes sub_message = 1 [lazy=false];
+}
+message TestLazyMessage {
+  optional TestAllTypes sub_message = 1 [lazy=true];
+}
+
+// Needed for a Python test.
+message TestNestedMessageHasBits {
+  message NestedMessage {
+    repeated int32 nestedmessage_repeated_int32 = 1;
+    repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
+  }
+  optional NestedMessage optional_nested_message = 1;
+}
+
+
+// Test an enum that has multiple values with the same number.
+enum TestEnumWithDupValue {
+  option allow_alias = true;
+
+  FOO1 = 1;
+  BAR1 = 2;
+  BAZ = 3;
+  FOO2 = 1;
+  BAR2 = 2;
+}
+
+// Test an enum with large, unordered values.
+enum TestSparseEnum {
+  SPARSE_A = 123;
+  SPARSE_B = 62374;
+  SPARSE_C = 12589234;
+  SPARSE_D = -15;
+  SPARSE_E = -53452;
+  SPARSE_F = 0;
+  SPARSE_G = 2;
+}
+
+// Test message with CamelCase field names.  This violates Protocol Buffer
+// standard style.
+message TestCamelCaseFieldNames {
+  optional int32 PrimitiveField = 1;
+  optional string StringField = 2;
+  optional ForeignEnum EnumField = 3;
+  optional ForeignMessage MessageField = 4;
+  optional string StringPieceField = 5 [ctype=STRING_PIECE];
+  optional string CordField = 6 [ctype=CORD];
+
+  repeated int32 RepeatedPrimitiveField = 7;
+  repeated string RepeatedStringField = 8;
+  repeated ForeignEnum RepeatedEnumField = 9;
+  repeated ForeignMessage RepeatedMessageField = 10;
+  repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
+  repeated string RepeatedCordField = 12 [ctype=CORD];
+}
+
+
+// We list fields out of order, to ensure that we're using field number and not
+// field index to determine serialization order.
+message TestFieldOrderings {
+  optional string my_string = 11;
+  extensions 2 to 10;
+  optional int64 my_int = 1;
+  extensions 12 to 100;
+  optional float my_float = 101;
+  message NestedMessage {
+    optional int64 oo = 2;
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    optional int32 bb = 1;
+  }
+
+  optional NestedMessage optional_nested_message  = 200;
+}
+
+
+extend TestFieldOrderings {
+  optional string my_extension_string = 50;
+  optional int32 my_extension_int = 5;
+}
+
+
+message TestExtremeDefaultValues {
+  optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
+  optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
+  optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
+  optional  int32 small_int32  = 4 [default = -0x7FFFFFFF];
+  optional  int64 small_int64  = 5 [default = -0x7FFFFFFFFFFFFFFF];
+  optional  int32 really_small_int32 = 21 [default = -0x80000000];
+  optional  int64 really_small_int64 = 22 [default = -0x8000000000000000];
+
+  // The default value here is UTF-8 for "\u1234".  (We could also just type
+  // the UTF-8 text directly into this text file rather than escape it, but
+  // lots of people use editors that would be confused by this.)
+  optional string utf8_string = 6 [default = "\341\210\264"];
+
+  // Tests for single-precision floating-point values.
+  optional float zero_float = 7 [default = 0];
+  optional float one_float = 8 [default = 1];
+  optional float small_float = 9 [default = 1.5];
+  optional float negative_one_float = 10 [default = -1];
+  optional float negative_float = 11 [default = -1.5];
+  // Using exponents
+  optional float large_float = 12 [default = 2E8];
+  optional float small_negative_float = 13 [default = -8e-28];
+
+  // Text for nonfinite floating-point values.
+  optional double inf_double = 14 [default = inf];
+  optional double neg_inf_double = 15 [default = -inf];
+  optional double nan_double = 16 [default = nan];
+  optional float inf_float = 17 [default = inf];
+  optional float neg_inf_float = 18 [default = -inf];
+  optional float nan_float = 19 [default = nan];
+
+  // Tests for C++ trigraphs.
+  // Trigraphs should be escaped in C++ generated files, but they should not be
+  // escaped for other languages.
+  // Note that in .proto file, "\?" is a valid way to escape ? in string
+  // literals.
+  optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
+
+  // String defaults containing the character '\000'
+  optional string string_with_zero       = 23 [default = "hel\000lo"];
+  optional  bytes bytes_with_zero        = 24 [default = "wor\000ld"];
+  optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
+                                               default="ab\000c"];
+  optional string cord_with_zero         = 26 [ctype=CORD,
+                                               default="12\0003"];
+  optional string replacement_string     = 27 [default="${unknown}"];
+}
+
+message SparseEnumMessage {
+  optional TestSparseEnum sparse_enum = 1;
+}
+
+// Test String and Bytes: string is for valid UTF-8 strings
+message OneString {
+  optional string data = 1;
+}
+
+message MoreString {
+  repeated string data = 1;
+}
+
+message OneBytes {
+  optional bytes data = 1;
+}
+
+message MoreBytes {
+  repeated bytes data = 1;
+}
+
+// Test int32, uint32, int64, uint64, and bool are all compatible
+message Int32Message {
+  optional int32 data = 1;
+}
+
+message Uint32Message {
+  optional uint32 data = 1;
+}
+
+message Int64Message {
+  optional int64 data = 1;
+}
+
+message Uint64Message {
+  optional uint64 data = 1;
+}
+
+message BoolMessage {
+  optional bool data = 1;
+}
+
+// Test oneofs.
+message TestOneof {
+  oneof foo {
+    int32 foo_int = 1;
+    string foo_string = 2;
+    TestAllTypes foo_message = 3;
+    group FooGroup = 4 {
+      optional int32 a = 5;
+      optional string b = 6;
+    }
+  }
+}
+
+message TestOneofBackwardsCompatible {
+  optional int32 foo_int = 1;
+  optional string foo_string = 2;
+  optional TestAllTypes foo_message = 3;
+  optional group FooGroup = 4 {
+    optional int32 a = 5;
+    optional string b = 6;
+  }
+}
+
+message TestOneof2 {
+  oneof foo {
+    int32 foo_int = 1;
+    string foo_string = 2;
+    string foo_cord = 3 [ctype=CORD];
+    string foo_string_piece = 4 [ctype=STRING_PIECE];
+    bytes foo_bytes = 5;
+    NestedEnum foo_enum = 6;
+    NestedMessage foo_message = 7;
+    group FooGroup = 8 {
+      optional int32 a = 9;
+      optional string b = 10;
+    }
+    NestedMessage foo_lazy_message = 11 [lazy=true];
+  }
+
+  oneof bar {
+    int32 bar_int = 12 [default = 5];
+    string bar_string = 13 [default = "STRING"];
+    string bar_cord = 14 [ctype=CORD, default = "CORD"];
+    string bar_string_piece = 15 [ctype=STRING_PIECE, default = "SPIECE"];
+    bytes bar_bytes = 16 [default = "BYTES"];
+    NestedEnum bar_enum = 17 [default = BAR];
+  }
+
+  optional int32 baz_int = 18;
+  optional string baz_string = 19 [default = "BAZ"];
+
+  message NestedMessage {
+    optional int64 qux_int = 1;
+    repeated int32 corge_int = 2;
+  }
+
+  enum NestedEnum {
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+  }
+}
+
+message TestRequiredOneof {
+  oneof foo {
+    int32 foo_int = 1;
+    string foo_string = 2;
+    NestedMessage foo_message = 3;
+  }
+  message NestedMessage {
+    required double required_double = 1;
+  }
+}
+
+
+// Test messages for packed fields
+
+message TestPackedTypes {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnum packed_enum  = 103 [packed = true];
+}
+
+// A message with the same fields as TestPackedTypes, but without packing. Used
+// to test packed <-> unpacked wire compatibility.
+message TestUnpackedTypes {
+  repeated    int32 unpacked_int32    =  90 [packed = false];
+  repeated    int64 unpacked_int64    =  91 [packed = false];
+  repeated   uint32 unpacked_uint32   =  92 [packed = false];
+  repeated   uint64 unpacked_uint64   =  93 [packed = false];
+  repeated   sint32 unpacked_sint32   =  94 [packed = false];
+  repeated   sint64 unpacked_sint64   =  95 [packed = false];
+  repeated  fixed32 unpacked_fixed32  =  96 [packed = false];
+  repeated  fixed64 unpacked_fixed64  =  97 [packed = false];
+  repeated sfixed32 unpacked_sfixed32 =  98 [packed = false];
+  repeated sfixed64 unpacked_sfixed64 =  99 [packed = false];
+  repeated    float unpacked_float    = 100 [packed = false];
+  repeated   double unpacked_double   = 101 [packed = false];
+  repeated     bool unpacked_bool     = 102 [packed = false];
+  repeated ForeignEnum unpacked_enum  = 103 [packed = false];
+}
+
+message TestPackedExtensions {
+  extensions 1 to max;
+}
+
+extend TestPackedExtensions {
+  repeated    int32 packed_int32_extension    =  90 [packed = true];
+  repeated    int64 packed_int64_extension    =  91 [packed = true];
+  repeated   uint32 packed_uint32_extension   =  92 [packed = true];
+  repeated   uint64 packed_uint64_extension   =  93 [packed = true];
+  repeated   sint32 packed_sint32_extension   =  94 [packed = true];
+  repeated   sint64 packed_sint64_extension   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32_extension  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64_extension  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32_extension =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64_extension =  99 [packed = true];
+  repeated    float packed_float_extension    = 100 [packed = true];
+  repeated   double packed_double_extension   = 101 [packed = true];
+  repeated     bool packed_bool_extension     = 102 [packed = true];
+  repeated ForeignEnum packed_enum_extension  = 103 [packed = true];
+}
+
+message TestUnpackedExtensions {
+  extensions 1 to max;
+}
+
+extend TestUnpackedExtensions {
+  repeated    int32 unpacked_int32_extension    =  90 [packed = false];
+  repeated    int64 unpacked_int64_extension    =  91 [packed = false];
+  repeated   uint32 unpacked_uint32_extension   =  92 [packed = false];
+  repeated   uint64 unpacked_uint64_extension   =  93 [packed = false];
+  repeated   sint32 unpacked_sint32_extension   =  94 [packed = false];
+  repeated   sint64 unpacked_sint64_extension   =  95 [packed = false];
+  repeated  fixed32 unpacked_fixed32_extension  =  96 [packed = false];
+  repeated  fixed64 unpacked_fixed64_extension  =  97 [packed = false];
+  repeated sfixed32 unpacked_sfixed32_extension =  98 [packed = false];
+  repeated sfixed64 unpacked_sfixed64_extension =  99 [packed = false];
+  repeated    float unpacked_float_extension    = 100 [packed = false];
+  repeated   double unpacked_double_extension   = 101 [packed = false];
+  repeated     bool unpacked_bool_extension     = 102 [packed = false];
+  repeated ForeignEnum unpacked_enum_extension  = 103 [packed = false];
+}
+
+// Used by ExtensionSetTest/DynamicExtensions.  The test actually builds
+// a set of extensions to TestAllExtensions dynamically, based on the fields
+// of this message type.
+message TestDynamicExtensions {
+  enum DynamicEnumType {
+    DYNAMIC_FOO = 2200;
+    DYNAMIC_BAR = 2201;
+    DYNAMIC_BAZ = 2202;
+  }
+  message DynamicMessageType {
+    optional int32 dynamic_field = 2100;
+  }
+
+  optional fixed32 scalar_extension = 2000;
+  optional ForeignEnum enum_extension = 2001;
+  optional DynamicEnumType dynamic_enum_extension = 2002;
+
+  optional ForeignMessage message_extension = 2003;
+  optional DynamicMessageType dynamic_message_extension = 2004;
+
+  repeated string repeated_extension = 2005;
+  repeated sint32 packed_extension = 2006 [packed = true];
+}
+
+message TestRepeatedScalarDifferentTagSizes {
+  // Parsing repeated fixed size values used to fail. This message needs to be
+  // used in order to get a tag of the right size; all of the repeated fields
+  // in TestAllTypes didn't trigger the check.
+  repeated fixed32 repeated_fixed32 = 12;
+  // Check for a varint type, just for good measure.
+  repeated int32   repeated_int32   = 13;
+
+  // These have two-byte tags.
+  repeated fixed64 repeated_fixed64 = 2046;
+  repeated int64   repeated_int64   = 2047;
+
+  // Three byte tags.
+  repeated float   repeated_float   = 262142;
+  repeated uint64  repeated_uint64  = 262143;
+}
+
+// Test that if an optional or required message/group field appears multiple
+// times in the input, they need to be merged.
+message TestParsingMerge {
+  // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
+  // except that all fields are repeated. In the tests, we will serialize the
+  // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
+  // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
+  // the corresponding required/optional fields in TestParsingMerge.
+  message RepeatedFieldsGenerator {
+    repeated TestAllTypes field1 = 1;
+    repeated TestAllTypes field2 = 2;
+    repeated TestAllTypes field3 = 3;
+    repeated group Group1 = 10 {
+      optional TestAllTypes field1 = 11;
+    }
+    repeated group Group2 = 20 {
+      optional TestAllTypes field1 = 21;
+    }
+    repeated TestAllTypes ext1 = 1000;
+    repeated TestAllTypes ext2 = 1001;
+  }
+  required TestAllTypes required_all_types = 1;
+  optional TestAllTypes optional_all_types = 2;
+  repeated TestAllTypes repeated_all_types = 3;
+  optional group OptionalGroup = 10 {
+    optional TestAllTypes optional_group_all_types = 11;
+  }
+  repeated group RepeatedGroup = 20 {
+    optional TestAllTypes repeated_group_all_types = 21;
+  }
+  extensions 1000 to max;
+  extend TestParsingMerge {
+    optional TestAllTypes optional_ext = 1000;
+    repeated TestAllTypes repeated_ext = 1001;
+  }
+}
+
+message TestCommentInjectionMessage {
+  // */ <- This should not close the generated doc comment
+  optional string a = 1 [default="*/ <- Neither should this."];
+}
+
+
+// Test that RPC services work.
+message FooRequest  {}
+message FooResponse {}
+
+message FooClientMessage {}
+message FooServerMessage{}
+
+service TestService {
+  rpc Foo(FooRequest) returns (FooResponse);
+  rpc Bar(BarRequest) returns (BarResponse);
+}
+
+
+message BarRequest  {}
+message BarResponse {}
+

+ 46 - 0
Protos/google/protobuf/unittest_arena.proto

@@ -0,0 +1,46 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+import "google/protobuf/unittest_no_arena_import.proto";
+
+package proto2_arena_unittest;
+
+option cc_enable_arenas = true;
+
+message NestedMessage {
+  optional int32 d = 1;
+}
+
+message ArenaMessage {
+  repeated NestedMessage  repeated_nested_message = 1;
+  repeated ImportNoArenaNestedMessage  repeated_import_no_arena_message = 2;
+};

+ 430 - 0
Protos/google/protobuf/unittest_custom_options.proto

@@ -0,0 +1,430 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: benjy@google.com (Benjy Weinberger)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file used to test the "custom options" feature of google.protobuf.
+
+syntax = "proto2";
+
+// Some generic_services option(s) added automatically.
+// See:  http://go/proto2-generic-services-default
+option cc_generic_services = true;     // auto-added
+option java_generic_services = true;   // auto-added
+option py_generic_services = true;
+
+// A custom file option (defined below).
+option (file_opt1) = 9876543210;
+
+import "google/protobuf/descriptor.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+package protobuf_unittest;
+
+
+// Some simple test custom options of various types.
+
+extend google.protobuf.FileOptions {
+  optional uint64 file_opt1 = 7736974;
+}
+
+extend google.protobuf.MessageOptions {
+  optional int32 message_opt1 = 7739036;
+}
+
+extend google.protobuf.FieldOptions {
+  optional fixed64 field_opt1 = 7740936;
+  // This is useful for testing that we correctly register default values for
+  // extension options.
+  optional int32 field_opt2 = 7753913 [default=42];
+}
+
+extend google.protobuf.OneofOptions {
+  optional int32 oneof_opt1 = 7740111;
+}
+
+extend google.protobuf.EnumOptions {
+  optional sfixed32 enum_opt1 = 7753576;
+}
+
+extend google.protobuf.EnumValueOptions {
+  optional int32 enum_value_opt1 = 1560678;
+}
+
+extend google.protobuf.ServiceOptions {
+  optional sint64 service_opt1 = 7887650;
+}
+
+enum MethodOpt1 {
+  METHODOPT1_VAL1 = 1;
+  METHODOPT1_VAL2 = 2;
+}
+
+extend google.protobuf.MethodOptions {
+  optional MethodOpt1 method_opt1 = 7890860;
+}
+
+// A test message with custom options at all possible locations (and also some
+// regular options, to make sure they interact nicely).
+message TestMessageWithCustomOptions {
+  option message_set_wire_format = false;
+
+  option (message_opt1) = -56;
+
+  optional string field1 = 1 [ctype=CORD,
+                              (field_opt1)=8765432109];
+
+  oneof AnOneof {
+    option (oneof_opt1) = -99;
+    int32 oneof_field = 2;
+  }
+
+  enum AnEnum {
+    option (enum_opt1) = -789;
+
+    ANENUM_VAL1 = 1;
+    ANENUM_VAL2 = 2 [(enum_value_opt1) = 123];
+  }
+}
+
+
+// A test RPC service with custom options at all possible locations (and also
+// some regular options, to make sure they interact nicely).
+message CustomOptionFooRequest {
+}
+
+message CustomOptionFooResponse {
+}
+
+message CustomOptionFooClientMessage {
+}
+
+message CustomOptionFooServerMessage {
+}
+
+service TestServiceWithCustomOptions {
+  option (service_opt1) = -9876543210;
+
+  rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) {
+    option (method_opt1) = METHODOPT1_VAL2;
+  }
+}
+
+
+
+// Options of every possible field type, so we can test them all exhaustively.
+
+message DummyMessageContainingEnum {
+  enum TestEnumType {
+    TEST_OPTION_ENUM_TYPE1 = 22;
+    TEST_OPTION_ENUM_TYPE2 = -23;
+  }
+}
+
+message DummyMessageInvalidAsOptionType {
+}
+
+extend google.protobuf.MessageOptions {
+  optional         bool     bool_opt = 7706090;
+  optional        int32    int32_opt = 7705709;
+  optional        int64    int64_opt = 7705542;
+  optional       uint32   uint32_opt = 7704880;
+  optional       uint64   uint64_opt = 7702367;
+  optional       sint32   sint32_opt = 7701568;
+  optional       sint64   sint64_opt = 7700863;
+  optional      fixed32  fixed32_opt = 7700307;
+  optional      fixed64  fixed64_opt = 7700194;
+  optional     sfixed32 sfixed32_opt = 7698645;
+  optional     sfixed64 sfixed64_opt = 7685475;
+  optional        float    float_opt = 7675390;
+  optional       double   double_opt = 7673293;
+  optional       string   string_opt = 7673285;
+  optional        bytes    bytes_opt = 7673238;
+  optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233;
+  optional DummyMessageInvalidAsOptionType message_type_opt = 7665967;
+}
+
+message CustomOptionMinIntegerValues {
+  option     (bool_opt) = false;
+  option    (int32_opt) = -0x80000000;
+  option    (int64_opt) = -0x8000000000000000;
+  option   (uint32_opt) = 0;
+  option   (uint64_opt) = 0;
+  option   (sint32_opt) = -0x80000000;
+  option   (sint64_opt) = -0x8000000000000000;
+  option  (fixed32_opt) = 0;
+  option  (fixed64_opt) = 0;
+  option (sfixed32_opt) = -0x80000000;
+  option (sfixed64_opt) = -0x8000000000000000;
+}
+
+message CustomOptionMaxIntegerValues {
+  option     (bool_opt) = true;
+  option    (int32_opt) = 0x7FFFFFFF;
+  option    (int64_opt) = 0x7FFFFFFFFFFFFFFF;
+  option   (uint32_opt) = 0xFFFFFFFF;
+  option   (uint64_opt) = 0xFFFFFFFFFFFFFFFF;
+  option   (sint32_opt) = 0x7FFFFFFF;
+  option   (sint64_opt) = 0x7FFFFFFFFFFFFFFF;
+  option  (fixed32_opt) = 0xFFFFFFFF;
+  option  (fixed64_opt) = 0xFFFFFFFFFFFFFFFF;
+  option (sfixed32_opt) = 0x7FFFFFFF;
+  option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF;
+}
+
+message CustomOptionOtherValues {
+  option  (int32_opt) = -100;  // To test sign-extension.
+  option  (float_opt) = 12.3456789;
+  option (double_opt) = 1.234567890123456789;
+  option (string_opt) = "Hello, \"World\"";
+  option  (bytes_opt) = "Hello\0World";
+  option   (enum_opt) = TEST_OPTION_ENUM_TYPE2;
+}
+
+message SettingRealsFromPositiveInts {
+  option  (float_opt) = 12;
+  option (double_opt) = 154;
+}
+
+message SettingRealsFromNegativeInts {
+  option  (float_opt) = -12;
+  option  (double_opt) = -154;
+}
+
+// Options of complex message types, themselves combined and extended in
+// various ways.
+
+message ComplexOptionType1 {
+  optional int32 foo = 1;
+  optional int32 foo2 = 2;
+  optional int32 foo3 = 3;
+  repeated int32 foo4 = 4;
+
+  extensions 100 to max;
+}
+
+message ComplexOptionType2 {
+  optional ComplexOptionType1 bar = 1;
+  optional int32 baz = 2;
+
+  message ComplexOptionType4 {
+    optional int32 waldo = 1;
+
+    extend google.protobuf.MessageOptions {
+      optional ComplexOptionType4 complex_opt4 = 7633546;
+    }
+  }
+
+  optional ComplexOptionType4 fred = 3;
+  repeated ComplexOptionType4 barney = 4;
+
+  extensions 100 to max;
+}
+
+message ComplexOptionType3 {
+  optional int32 qux = 1;
+
+  optional group ComplexOptionType5 = 2 {
+    optional int32 plugh = 3;
+  }
+}
+
+extend ComplexOptionType1 {
+  optional int32 quux = 7663707;
+  optional ComplexOptionType3 corge = 7663442;
+}
+
+extend ComplexOptionType2 {
+  optional int32 grault = 7650927;
+  optional ComplexOptionType1 garply = 7649992;
+}
+
+extend google.protobuf.MessageOptions {
+  optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756;
+  optional ComplexOptionType2 complex_opt2 = 7636949;
+  optional ComplexOptionType3 complex_opt3 = 7636463;
+  optional group ComplexOpt6 = 7595468 {
+    optional int32 xyzzy = 7593951;
+  }
+}
+
+// Note that we try various different ways of naming the same extension.
+message VariousComplexOptions {
+  option (.protobuf_unittest.complex_opt1).foo = 42;
+  option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324;
+  option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
+  option (protobuf_unittest.complex_opt1).foo4 = 99;
+  option (protobuf_unittest.complex_opt1).foo4 = 88;
+  option (complex_opt2).baz = 987;
+  option (complex_opt2).(grault) = 654;
+  option (complex_opt2).bar.foo = 743;
+  option (complex_opt2).bar.(quux) = 1999;
+  option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
+  option (complex_opt2).(garply).foo = 741;
+  option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
+  option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
+  option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
+  option (complex_opt2).fred.waldo = 321;
+  option (complex_opt2).barney = { waldo: 101 };
+  option (complex_opt2).barney = { waldo: 212 };
+  option (protobuf_unittest.complex_opt3).qux = 9;
+  option (complex_opt3).complexoptiontype5.plugh = 22;
+  option (complexopt6).xyzzy = 24;
+}
+
+// ------------------------------------------------------
+// Definitions for testing aggregate option parsing.
+// See descriptor_unittest.cc.
+
+message AggregateMessageSet {
+  option message_set_wire_format = true;
+  extensions 4 to max;
+}
+
+message AggregateMessageSetElement {
+  extend AggregateMessageSet {
+    optional AggregateMessageSetElement message_set_extension = 15447542;
+  }
+  optional string s = 1;
+}
+
+// A helper type used to test aggregate option parsing
+message Aggregate {
+  optional int32 i = 1;
+  optional string s = 2;
+
+  // A nested object
+  optional Aggregate sub = 3;
+
+  // To test the parsing of extensions inside aggregate values
+  optional google.protobuf.FileOptions file = 4;
+  extend google.protobuf.FileOptions {
+    optional Aggregate nested = 15476903;
+  }
+
+  // An embedded message set
+  optional AggregateMessageSet mset = 5;
+}
+
+// Allow Aggregate to be used as an option at all possible locations
+// in the .proto grammer.
+extend google.protobuf.FileOptions      { optional Aggregate fileopt    = 15478479; }
+extend google.protobuf.MessageOptions   { optional Aggregate msgopt     = 15480088; }
+extend google.protobuf.FieldOptions     { optional Aggregate fieldopt   = 15481374; }
+extend google.protobuf.EnumOptions      { optional Aggregate enumopt    = 15483218; }
+extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
+extend google.protobuf.ServiceOptions   { optional Aggregate serviceopt = 15497145; }
+extend google.protobuf.MethodOptions    { optional Aggregate methodopt  = 15512713; }
+
+// Try using AggregateOption at different points in the proto grammar
+option (fileopt) = {
+  s: 'FileAnnotation'
+  // Also test the handling of comments
+  /* of both types */ i: 100
+
+  sub { s: 'NestedFileAnnotation' }
+
+  // Include a google.protobuf.FileOptions and recursively extend it with
+  // another fileopt.
+  file {
+    [protobuf_unittest.fileopt] {
+      s:'FileExtensionAnnotation'
+    }
+  }
+
+  // A message set inside an option value
+  mset {
+    [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
+      s: 'EmbeddedMessageSetElement'
+    }
+  }
+};
+
+message AggregateMessage {
+  option (msgopt) = { i:101 s:'MessageAnnotation' };
+  optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }];
+}
+
+service AggregateService {
+  option (serviceopt) = { s:'ServiceAnnotation' };
+  rpc Method (AggregateMessage) returns (AggregateMessage) {
+    option (methodopt) = { s:'MethodAnnotation' };
+  }
+}
+
+enum AggregateEnum {
+  option (enumopt) = { s:'EnumAnnotation' };
+  VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
+}
+
+// Test custom options for nested type.
+message NestedOptionType {
+  message NestedMessage {
+    option (message_opt1) = 1001;
+    optional int32 nested_field = 1 [(field_opt1) = 1002];
+  }
+  enum NestedEnum {
+    option (enum_opt1) = 1003;
+    NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
+  }
+  extend google.protobuf.FileOptions {
+    optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
+  }
+}
+
+// Custom message option that has a required enum field.
+// WARNING: this is strongly discouraged!
+message OldOptionType {
+  enum TestEnum {
+    OLD_VALUE = 0;
+  }
+  required TestEnum value = 1;
+}
+
+// Updated version of the custom option above.
+message NewOptionType {
+  enum TestEnum {
+    OLD_VALUE = 0;
+    NEW_VALUE = 1;
+  }
+  required TestEnum value = 1;
+}
+
+extend google.protobuf.MessageOptions {
+  optional OldOptionType required_enum_opt = 106161807;
+}
+
+// Test message using the "required_enum_opt" option defined above.
+message TestMessageWithRequiredEnumOption {
+  option (required_enum_opt) = { value: OLD_VALUE };
+}

+ 58 - 0
Protos/google/protobuf/unittest_drop_unknown_fields.proto

@@ -0,0 +1,58 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package unittest_drop_unknown_fields;
+option objc_class_prefix = "DropUnknowns";
+
+option csharp_namespace = "Google.Protobuf.TestProtos";
+
+message Foo {
+  enum NestedEnum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+  }
+  int32 int32_value = 1;
+  NestedEnum enum_value = 2;
+}
+
+message FooWithExtraFields {
+  enum NestedEnum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+    QUX = 3;
+  }
+  int32 int32_value = 1;
+  NestedEnum enum_value = 2;
+  int32 extra_int32_value = 3;
+}

+ 51 - 0
Protos/google/protobuf/unittest_embed_optimize_for.proto

@@ -0,0 +1,51 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file which imports a proto file that uses optimize_for = CODE_SIZE.
+
+syntax = "proto2";
+import "google/protobuf/unittest_optimize_for.proto";
+
+package protobuf_unittest;
+
+// We optimize for speed here, but we are importing a proto that is optimized
+// for code size.
+option optimize_for = SPEED;
+
+message TestEmbedOptimizedForSize {
+  // Test that embedding a message which has optimize_for = CODE_SIZE into
+  // one optimized for speed works.
+  optional TestOptimizedForSize optional_message = 1;
+  repeated TestOptimizedForSize repeated_message = 2;
+}

+ 38 - 0
Protos/google/protobuf/unittest_empty.proto

@@ -0,0 +1,38 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// This file intentionally left blank.  (At one point this wouldn't compile
+// correctly.)
+
+syntax = "proto2";

+ 1048 - 0
Protos/google/protobuf/unittest_enormous_descriptor.proto

@@ -0,0 +1,1048 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file that has an extremely large descriptor.  Used to test that
+// descriptors over 64k don't break language-specific limits in generated code,
+// such as the string literal length limit in Java.
+
+syntax = "proto2";
+
+package google.protobuf;
+option java_package = "com.google.protobuf";
+
+// Avoid generating insanely long methods.
+option optimize_for = CODE_SIZE;
+
+message TestEnormousDescriptor {
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1 = 1 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_2 = 2 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_3 = 3 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_4 = 4 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_5 = 5 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_6 = 6 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_7 = 7 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_8 = 8 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_9 = 9 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_10 = 10 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_11 = 11 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_12 = 12 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_13 = 13 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_14 = 14 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_15 = 15 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_16 = 16 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_17 = 17 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_18 = 18 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_19 = 19 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_20 = 20 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_21 = 21 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_22 = 22 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_23 = 23 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_24 = 24 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_25 = 25 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_26 = 26 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_27 = 27 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_28 = 28 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_29 = 29 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_30 = 30 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_31 = 31 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_32 = 32 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_33 = 33 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_34 = 34 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_35 = 35 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_36 = 36 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_37 = 37 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_38 = 38 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_39 = 39 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_40 = 40 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_41 = 41 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_42 = 42 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_43 = 43 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_44 = 44 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_45 = 45 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_46 = 46 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_47 = 47 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_48 = 48 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_49 = 49 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_50 = 50 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_51 = 51 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_52 = 52 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_53 = 53 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_54 = 54 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_55 = 55 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_56 = 56 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_57 = 57 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_58 = 58 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_59 = 59 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_60 = 60 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_61 = 61 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_62 = 62 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_63 = 63 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_64 = 64 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_65 = 65 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_66 = 66 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_67 = 67 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_68 = 68 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_69 = 69 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_70 = 70 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_71 = 71 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_72 = 72 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_73 = 73 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_74 = 74 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_75 = 75 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_76 = 76 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_77 = 77 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_78 = 78 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_79 = 79 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_80 = 80 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_81 = 81 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_82 = 82 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_83 = 83 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_84 = 84 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_85 = 85 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_86 = 86 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_87 = 87 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_88 = 88 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_89 = 89 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_90 = 90 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_91 = 91 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_92 = 92 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_93 = 93 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_94 = 94 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_95 = 95 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_96 = 96 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_97 = 97 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_98 = 98 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_99 = 99 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_100 = 100 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_101 = 101 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_102 = 102 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_103 = 103 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_104 = 104 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_105 = 105 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_106 = 106 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_107 = 107 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_108 = 108 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_109 = 109 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_110 = 110 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_111 = 111 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_112 = 112 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_113 = 113 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_114 = 114 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_115 = 115 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_116 = 116 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_117 = 117 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_118 = 118 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_119 = 119 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_120 = 120 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_121 = 121 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_122 = 122 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_123 = 123 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_124 = 124 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_125 = 125 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_126 = 126 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_127 = 127 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_128 = 128 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_129 = 129 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_130 = 130 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_131 = 131 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_132 = 132 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_133 = 133 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_134 = 134 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_135 = 135 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_136 = 136 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_137 = 137 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_138 = 138 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_139 = 139 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_140 = 140 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_141 = 141 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_142 = 142 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_143 = 143 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_144 = 144 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_145 = 145 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_146 = 146 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_147 = 147 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_148 = 148 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_149 = 149 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_150 = 150 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_151 = 151 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_152 = 152 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_153 = 153 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_154 = 154 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_155 = 155 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_156 = 156 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_157 = 157 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_158 = 158 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_159 = 159 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_160 = 160 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_161 = 161 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_162 = 162 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_163 = 163 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_164 = 164 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_165 = 165 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_166 = 166 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_167 = 167 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_168 = 168 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_169 = 169 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_170 = 170 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_171 = 171 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_172 = 172 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_173 = 173 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_174 = 174 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_175 = 175 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_176 = 176 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_177 = 177 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_178 = 178 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_179 = 179 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_180 = 180 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_181 = 181 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_182 = 182 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_183 = 183 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_184 = 184 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_185 = 185 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_186 = 186 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_187 = 187 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_188 = 188 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_189 = 189 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_190 = 190 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_191 = 191 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_192 = 192 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_193 = 193 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_194 = 194 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_195 = 195 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_196 = 196 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_197 = 197 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_198 = 198 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_199 = 199 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_200 = 200 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_201 = 201 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_202 = 202 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_203 = 203 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_204 = 204 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_205 = 205 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_206 = 206 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_207 = 207 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_208 = 208 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_209 = 209 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_210 = 210 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_211 = 211 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_212 = 212 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_213 = 213 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_214 = 214 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_215 = 215 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_216 = 216 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_217 = 217 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_218 = 218 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_219 = 219 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_220 = 220 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_221 = 221 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_222 = 222 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_223 = 223 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_224 = 224 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_225 = 225 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_226 = 226 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_227 = 227 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_228 = 228 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_229 = 229 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_230 = 230 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_231 = 231 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_232 = 232 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_233 = 233 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_234 = 234 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_235 = 235 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_236 = 236 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_237 = 237 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_238 = 238 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_239 = 239 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_240 = 240 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_241 = 241 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_242 = 242 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_243 = 243 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_244 = 244 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_245 = 245 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_246 = 246 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_247 = 247 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_248 = 248 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_249 = 249 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_250 = 250 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_251 = 251 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_252 = 252 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_253 = 253 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_254 = 254 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_255 = 255 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_256 = 256 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_257 = 257 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_258 = 258 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_259 = 259 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_260 = 260 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_261 = 261 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_262 = 262 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_263 = 263 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_264 = 264 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_265 = 265 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_266 = 266 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_267 = 267 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_268 = 268 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_269 = 269 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_270 = 270 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_271 = 271 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_272 = 272 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_273 = 273 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_274 = 274 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_275 = 275 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_276 = 276 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_277 = 277 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_278 = 278 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_279 = 279 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_280 = 280 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_281 = 281 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_282 = 282 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_283 = 283 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_284 = 284 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_285 = 285 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_286 = 286 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_287 = 287 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_288 = 288 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_289 = 289 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_290 = 290 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_291 = 291 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_292 = 292 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_293 = 293 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_294 = 294 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_295 = 295 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_296 = 296 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_297 = 297 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_298 = 298 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_299 = 299 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_300 = 300 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_301 = 301 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_302 = 302 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_303 = 303 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_304 = 304 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_305 = 305 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_306 = 306 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_307 = 307 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_308 = 308 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_309 = 309 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_310 = 310 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_311 = 311 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_312 = 312 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_313 = 313 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_314 = 314 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_315 = 315 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_316 = 316 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_317 = 317 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_318 = 318 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_319 = 319 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_320 = 320 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_321 = 321 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_322 = 322 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_323 = 323 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_324 = 324 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_325 = 325 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_326 = 326 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_327 = 327 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_328 = 328 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_329 = 329 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_330 = 330 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_331 = 331 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_332 = 332 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_333 = 333 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_334 = 334 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_335 = 335 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_336 = 336 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_337 = 337 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_338 = 338 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_339 = 339 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_340 = 340 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_341 = 341 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_342 = 342 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_343 = 343 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_344 = 344 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_345 = 345 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_346 = 346 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_347 = 347 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_348 = 348 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_349 = 349 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_350 = 350 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_351 = 351 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_352 = 352 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_353 = 353 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_354 = 354 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_355 = 355 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_356 = 356 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_357 = 357 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_358 = 358 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_359 = 359 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_360 = 360 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_361 = 361 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_362 = 362 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_363 = 363 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_364 = 364 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_365 = 365 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_366 = 366 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_367 = 367 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_368 = 368 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_369 = 369 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_370 = 370 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_371 = 371 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_372 = 372 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_373 = 373 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_374 = 374 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_375 = 375 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_376 = 376 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_377 = 377 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_378 = 378 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_379 = 379 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_380 = 380 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_381 = 381 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_382 = 382 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_383 = 383 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_384 = 384 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_385 = 385 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_386 = 386 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_387 = 387 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_388 = 388 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_389 = 389 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_390 = 390 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_391 = 391 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_392 = 392 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_393 = 393 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_394 = 394 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_395 = 395 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_396 = 396 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_397 = 397 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_398 = 398 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_399 = 399 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_400 = 400 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_401 = 401 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_402 = 402 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_403 = 403 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_404 = 404 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_405 = 405 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_406 = 406 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_407 = 407 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_408 = 408 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_409 = 409 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_410 = 410 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_411 = 411 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_412 = 412 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_413 = 413 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_414 = 414 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_415 = 415 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_416 = 416 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_417 = 417 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_418 = 418 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_419 = 419 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_420 = 420 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_421 = 421 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_422 = 422 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_423 = 423 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_424 = 424 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_425 = 425 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_426 = 426 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_427 = 427 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_428 = 428 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_429 = 429 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_430 = 430 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_431 = 431 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_432 = 432 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_433 = 433 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_434 = 434 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_435 = 435 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_436 = 436 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_437 = 437 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_438 = 438 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_439 = 439 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_440 = 440 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_441 = 441 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_442 = 442 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_443 = 443 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_444 = 444 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_445 = 445 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_446 = 446 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_447 = 447 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_448 = 448 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_449 = 449 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_450 = 450 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_451 = 451 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_452 = 452 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_453 = 453 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_454 = 454 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_455 = 455 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_456 = 456 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_457 = 457 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_458 = 458 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_459 = 459 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_460 = 460 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_461 = 461 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_462 = 462 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_463 = 463 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_464 = 464 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_465 = 465 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_466 = 466 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_467 = 467 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_468 = 468 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_469 = 469 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_470 = 470 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_471 = 471 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_472 = 472 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_473 = 473 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_474 = 474 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_475 = 475 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_476 = 476 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_477 = 477 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_478 = 478 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_479 = 479 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_480 = 480 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_481 = 481 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_482 = 482 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_483 = 483 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_484 = 484 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_485 = 485 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_486 = 486 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_487 = 487 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_488 = 488 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_489 = 489 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_490 = 490 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_491 = 491 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_492 = 492 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_493 = 493 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_494 = 494 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_495 = 495 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_496 = 496 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_497 = 497 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_498 = 498 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_499 = 499 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_500 = 500 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_501 = 501 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_502 = 502 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_503 = 503 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_504 = 504 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_505 = 505 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_506 = 506 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_507 = 507 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_508 = 508 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_509 = 509 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_510 = 510 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_511 = 511 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_512 = 512 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_513 = 513 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_514 = 514 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_515 = 515 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_516 = 516 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_517 = 517 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_518 = 518 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_519 = 519 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_520 = 520 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_521 = 521 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_522 = 522 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_523 = 523 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_524 = 524 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_525 = 525 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_526 = 526 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_527 = 527 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_528 = 528 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_529 = 529 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_530 = 530 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_531 = 531 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_532 = 532 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_533 = 533 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_534 = 534 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_535 = 535 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_536 = 536 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_537 = 537 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_538 = 538 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_539 = 539 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_540 = 540 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_541 = 541 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_542 = 542 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_543 = 543 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_544 = 544 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_545 = 545 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_546 = 546 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_547 = 547 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_548 = 548 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_549 = 549 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_550 = 550 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_551 = 551 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_552 = 552 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_553 = 553 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_554 = 554 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_555 = 555 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_556 = 556 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_557 = 557 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_558 = 558 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_559 = 559 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_560 = 560 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_561 = 561 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_562 = 562 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_563 = 563 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_564 = 564 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_565 = 565 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_566 = 566 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_567 = 567 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_568 = 568 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_569 = 569 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_570 = 570 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_571 = 571 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_572 = 572 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_573 = 573 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_574 = 574 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_575 = 575 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_576 = 576 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_577 = 577 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_578 = 578 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_579 = 579 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_580 = 580 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_581 = 581 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_582 = 582 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_583 = 583 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_584 = 584 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_585 = 585 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_586 = 586 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_587 = 587 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_588 = 588 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_589 = 589 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_590 = 590 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_591 = 591 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_592 = 592 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_593 = 593 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_594 = 594 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_595 = 595 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_596 = 596 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_597 = 597 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_598 = 598 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_599 = 599 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_600 = 600 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_601 = 601 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_602 = 602 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_603 = 603 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_604 = 604 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_605 = 605 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_606 = 606 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_607 = 607 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_608 = 608 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_609 = 609 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_610 = 610 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_611 = 611 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_612 = 612 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_613 = 613 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_614 = 614 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_615 = 615 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_616 = 616 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_617 = 617 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_618 = 618 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_619 = 619 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_620 = 620 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_621 = 621 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_622 = 622 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_623 = 623 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_624 = 624 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_625 = 625 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_626 = 626 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_627 = 627 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_628 = 628 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_629 = 629 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_630 = 630 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_631 = 631 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_632 = 632 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_633 = 633 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_634 = 634 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_635 = 635 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_636 = 636 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_637 = 637 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_638 = 638 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_639 = 639 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_640 = 640 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_641 = 641 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_642 = 642 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_643 = 643 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_644 = 644 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_645 = 645 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_646 = 646 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_647 = 647 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_648 = 648 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_649 = 649 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_650 = 650 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_651 = 651 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_652 = 652 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_653 = 653 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_654 = 654 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_655 = 655 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_656 = 656 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_657 = 657 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_658 = 658 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_659 = 659 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_660 = 660 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_661 = 661 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_662 = 662 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_663 = 663 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_664 = 664 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_665 = 665 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_666 = 666 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_667 = 667 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_668 = 668 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_669 = 669 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_670 = 670 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_671 = 671 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_672 = 672 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_673 = 673 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_674 = 674 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_675 = 675 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_676 = 676 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_677 = 677 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_678 = 678 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_679 = 679 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_680 = 680 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_681 = 681 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_682 = 682 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_683 = 683 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_684 = 684 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_685 = 685 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_686 = 686 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_687 = 687 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_688 = 688 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_689 = 689 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_690 = 690 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_691 = 691 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_692 = 692 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_693 = 693 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_694 = 694 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_695 = 695 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_696 = 696 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_697 = 697 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_698 = 698 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_699 = 699 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_700 = 700 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_701 = 701 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_702 = 702 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_703 = 703 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_704 = 704 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_705 = 705 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_706 = 706 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_707 = 707 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_708 = 708 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_709 = 709 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_710 = 710 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_711 = 711 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_712 = 712 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_713 = 713 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_714 = 714 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_715 = 715 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_716 = 716 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_717 = 717 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_718 = 718 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_719 = 719 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_720 = 720 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_721 = 721 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_722 = 722 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_723 = 723 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_724 = 724 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_725 = 725 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_726 = 726 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_727 = 727 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_728 = 728 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_729 = 729 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_730 = 730 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_731 = 731 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_732 = 732 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_733 = 733 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_734 = 734 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_735 = 735 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_736 = 736 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_737 = 737 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_738 = 738 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_739 = 739 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_740 = 740 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_741 = 741 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_742 = 742 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_743 = 743 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_744 = 744 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_745 = 745 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_746 = 746 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_747 = 747 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_748 = 748 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_749 = 749 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_750 = 750 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_751 = 751 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_752 = 752 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_753 = 753 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_754 = 754 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_755 = 755 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_756 = 756 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_757 = 757 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_758 = 758 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_759 = 759 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_760 = 760 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_761 = 761 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_762 = 762 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_763 = 763 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_764 = 764 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_765 = 765 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_766 = 766 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_767 = 767 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_768 = 768 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_769 = 769 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_770 = 770 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_771 = 771 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_772 = 772 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_773 = 773 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_774 = 774 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_775 = 775 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_776 = 776 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_777 = 777 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_778 = 778 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_779 = 779 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_780 = 780 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_781 = 781 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_782 = 782 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_783 = 783 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_784 = 784 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_785 = 785 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_786 = 786 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_787 = 787 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_788 = 788 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_789 = 789 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_790 = 790 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_791 = 791 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_792 = 792 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_793 = 793 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_794 = 794 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_795 = 795 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_796 = 796 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_797 = 797 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_798 = 798 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_799 = 799 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_800 = 800 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_801 = 801 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_802 = 802 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_803 = 803 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_804 = 804 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_805 = 805 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_806 = 806 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_807 = 807 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_808 = 808 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_809 = 809 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_810 = 810 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_811 = 811 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_812 = 812 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_813 = 813 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_814 = 814 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_815 = 815 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_816 = 816 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_817 = 817 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_818 = 818 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_819 = 819 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_820 = 820 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_821 = 821 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_822 = 822 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_823 = 823 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_824 = 824 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_825 = 825 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_826 = 826 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_827 = 827 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_828 = 828 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_829 = 829 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_830 = 830 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_831 = 831 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_832 = 832 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_833 = 833 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_834 = 834 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_835 = 835 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_836 = 836 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_837 = 837 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_838 = 838 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_839 = 839 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_840 = 840 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_841 = 841 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_842 = 842 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_843 = 843 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_844 = 844 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_845 = 845 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_846 = 846 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_847 = 847 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_848 = 848 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_849 = 849 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_850 = 850 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_851 = 851 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_852 = 852 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_853 = 853 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_854 = 854 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_855 = 855 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_856 = 856 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_857 = 857 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_858 = 858 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_859 = 859 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_860 = 860 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_861 = 861 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_862 = 862 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_863 = 863 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_864 = 864 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_865 = 865 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_866 = 866 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_867 = 867 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_868 = 868 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_869 = 869 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_870 = 870 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_871 = 871 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_872 = 872 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_873 = 873 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_874 = 874 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_875 = 875 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_876 = 876 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_877 = 877 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_878 = 878 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_879 = 879 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_880 = 880 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_881 = 881 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_882 = 882 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_883 = 883 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_884 = 884 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_885 = 885 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_886 = 886 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_887 = 887 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_888 = 888 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_889 = 889 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_890 = 890 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_891 = 891 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_892 = 892 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_893 = 893 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_894 = 894 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_895 = 895 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_896 = 896 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_897 = 897 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_898 = 898 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_899 = 899 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_900 = 900 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_901 = 901 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_902 = 902 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_903 = 903 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_904 = 904 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_905 = 905 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_906 = 906 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_907 = 907 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_908 = 908 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_909 = 909 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_910 = 910 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_911 = 911 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_912 = 912 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_913 = 913 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_914 = 914 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_915 = 915 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_916 = 916 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_917 = 917 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_918 = 918 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_919 = 919 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_920 = 920 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_921 = 921 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_922 = 922 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_923 = 923 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_924 = 924 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_925 = 925 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_926 = 926 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_927 = 927 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_928 = 928 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_929 = 929 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_930 = 930 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_931 = 931 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_932 = 932 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_933 = 933 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_934 = 934 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_935 = 935 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_936 = 936 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_937 = 937 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_938 = 938 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_939 = 939 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_940 = 940 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_941 = 941 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_942 = 942 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_943 = 943 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_944 = 944 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_945 = 945 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_946 = 946 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_947 = 947 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_948 = 948 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_949 = 949 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_950 = 950 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_951 = 951 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_952 = 952 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_953 = 953 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_954 = 954 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_955 = 955 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_956 = 956 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_957 = 957 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_958 = 958 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_959 = 959 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_960 = 960 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_961 = 961 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_962 = 962 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_963 = 963 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_964 = 964 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_965 = 965 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_966 = 966 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_967 = 967 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_968 = 968 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_969 = 969 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_970 = 970 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_971 = 971 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_972 = 972 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_973 = 973 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_974 = 974 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_975 = 975 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_976 = 976 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_977 = 977 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_978 = 978 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_979 = 979 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_980 = 980 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_981 = 981 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_982 = 982 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_983 = 983 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_984 = 984 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_985 = 985 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_986 = 986 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_987 = 987 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_988 = 988 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_989 = 989 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_990 = 990 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_991 = 991 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_992 = 992 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_993 = 993 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_994 = 994 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_995 = 995 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_996 = 996 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_997 = 997 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_998 = 998 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_999 = 999 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+  optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000 = 1000 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
+}

+ 73 - 0
Protos/google/protobuf/unittest_import.proto

@@ -0,0 +1,73 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file which is imported by unittest.proto to test importing.
+
+syntax = "proto2";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do
+// "using namespace unittest_import = protobuf_unittest_import".
+package protobuf_unittest_import;
+
+option optimize_for = SPEED;
+option cc_enable_arenas = true;
+
+// Exercise the java_package option.
+option java_package = "com.google.protobuf.test";
+
+// Do not set a java_outer_classname here to verify that Proto2 works without
+// one.
+
+// Test public import
+import public "google/protobuf/unittest_import_public.proto";
+
+message ImportMessage {
+  optional int32 d = 1;
+}
+
+enum ImportEnum {
+  IMPORT_FOO = 7;
+  IMPORT_BAR = 8;
+  IMPORT_BAZ = 9;
+}
+
+
+// To use an enum in a map, it must has the first value as 0.
+enum ImportEnumForMap {
+  UNKNOWN = 0;
+  FOO = 1;
+  BAR = 2;
+}

+ 52 - 0
Protos/google/protobuf/unittest_import_lite.proto

@@ -0,0 +1,52 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//
+// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME.
+
+syntax = "proto2";
+package protobuf_unittest_import;
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+import public "google/protobuf/unittest_import_public_lite.proto";
+
+message ImportMessageLite {
+  optional int32 d = 1;
+}
+
+enum ImportEnumLite {
+  IMPORT_LITE_FOO = 7;
+  IMPORT_LITE_BAR = 8;
+  IMPORT_LITE_BAZ = 9;
+}

+ 69 - 0
Protos/google/protobuf/unittest_import_proto3.proto

@@ -0,0 +1,69 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file which is imported by unittest_proto3.proto to test importing.
+
+syntax = "proto3";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do
+// "using namespace unittest_import = protobuf_unittest_import".
+package protobuf_unittest_import;
+
+option optimize_for = SPEED;
+option cc_enable_arenas = true;
+
+// Exercise the java_package option.
+option java_package = "com.google.protobuf.test";
+option csharp_namespace = "Google.Protobuf.TestProtos";
+option swift_prefix = "Proto3";
+
+// Do not set a java_outer_classname here to verify that Proto2 works without
+// one.
+
+// Test public import
+import public "google/protobuf/unittest_import_public_proto3.proto";
+
+message ImportMessage {
+  int32 d = 1;
+}
+
+enum ImportEnum {
+  IMPORT_ENUM_UNSPECIFIED = 0;
+  IMPORT_FOO = 7;
+  IMPORT_BAR = 8;
+  IMPORT_BAZ = 9;
+}
+

+ 41 - 0
Protos/google/protobuf/unittest_import_public.proto

@@ -0,0 +1,41 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: liujisi@google.com (Pherl Liu)
+
+syntax = "proto2";
+
+package protobuf_unittest_import;
+
+option java_package = "com.google.protobuf.test";
+
+message PublicImportMessage {
+  optional int32 e = 1;
+}

+ 43 - 0
Protos/google/protobuf/unittest_import_public_lite.proto

@@ -0,0 +1,43 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: liujisi@google.com (Pherl Liu)
+
+syntax = "proto2";
+
+package protobuf_unittest_import;
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+message PublicImportMessageLite {
+  optional int32 e = 1;
+}

+ 43 - 0
Protos/google/protobuf/unittest_import_public_proto3.proto

@@ -0,0 +1,43 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: liujisi@google.com (Pherl Liu)
+
+syntax = "proto3";
+
+package protobuf_unittest_import;
+
+option java_package = "com.google.protobuf.test";
+option csharp_namespace = "Google.Protobuf.TestProtos";
+option swift_prefix = "Proto3";
+
+message PublicImportMessage {
+ int32 e = 1;
+}

+ 407 - 0
Protos/google/protobuf/unittest_lite.proto

@@ -0,0 +1,407 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//
+// This is like unittest.proto but with optimize_for = LITE_RUNTIME.
+
+syntax = "proto2";
+package protobuf_unittest;
+
+import "google/protobuf/unittest_import_lite.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+// Same as TestAllTypes but with the lite runtime.
+message TestAllTypesLite {
+
+  message NestedMessage {
+    optional int32 bb = 1;
+    optional int64 cc = 2;
+  }
+
+  enum NestedEnum {
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+  }
+
+  // Singular
+  optional    int32 optional_int32    =  1;
+  optional    int64 optional_int64    =  2;
+  optional   uint32 optional_uint32   =  3;
+  optional   uint64 optional_uint64   =  4;
+  optional   sint32 optional_sint32   =  5;
+  optional   sint64 optional_sint64   =  6;
+  optional  fixed32 optional_fixed32  =  7;
+  optional  fixed64 optional_fixed64  =  8;
+  optional sfixed32 optional_sfixed32 =  9;
+  optional sfixed64 optional_sfixed64 = 10;
+  optional    float optional_float    = 11;
+  optional   double optional_double   = 12;
+  optional     bool optional_bool     = 13;
+  optional   string optional_string   = 14;
+  optional    bytes optional_bytes    = 15;
+
+  optional group OptionalGroup = 16 {
+    optional int32 a = 17;
+  }
+
+  optional NestedMessage      optional_nested_message  = 18;
+  optional ForeignMessageLite optional_foreign_message = 19;
+  optional protobuf_unittest_import.ImportMessageLite
+    optional_import_message = 20;
+
+  optional NestedEnum      optional_nested_enum     = 21;
+  optional ForeignEnumLite optional_foreign_enum    = 22;
+  optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;
+
+  optional string optional_string_piece = 24 [ctype=STRING_PIECE];
+  optional string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  optional protobuf_unittest_import.PublicImportMessageLite
+      optional_public_import_message = 26;
+
+  optional NestedMessage optional_lazy_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated group RepeatedGroup = 46 {
+    optional int32 a = 47;
+  }
+
+  repeated NestedMessage      repeated_nested_message  = 48;
+  repeated ForeignMessageLite repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessageLite
+    repeated_import_message = 50;
+
+  repeated NestedEnum      repeated_nested_enum  = 51;
+  repeated ForeignEnumLite repeated_foreign_enum = 52;
+  repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  // Singular with defaults
+  optional    int32 default_int32    = 61 [default =  41    ];
+  optional    int64 default_int64    = 62 [default =  42    ];
+  optional   uint32 default_uint32   = 63 [default =  43    ];
+  optional   uint64 default_uint64   = 64 [default =  44    ];
+  optional   sint32 default_sint32   = 65 [default = -45    ];
+  optional   sint64 default_sint64   = 66 [default =  46    ];
+  optional  fixed32 default_fixed32  = 67 [default =  47    ];
+  optional  fixed64 default_fixed64  = 68 [default =  48    ];
+  optional sfixed32 default_sfixed32 = 69 [default =  49    ];
+  optional sfixed64 default_sfixed64 = 70 [default = -50    ];
+  optional    float default_float    = 71 [default =  51.5  ];
+  optional   double default_double   = 72 [default =  52e3  ];
+  optional     bool default_bool     = 73 [default = true   ];
+  optional   string default_string   = 74 [default = "hello"];
+  optional    bytes default_bytes    = 75 [default = "world"];
+
+  optional NestedEnum default_nested_enum = 81 [default = BAR];
+  optional ForeignEnumLite default_foreign_enum = 82
+      [default = FOREIGN_LITE_BAR];
+  optional protobuf_unittest_import.ImportEnumLite
+      default_import_enum = 83 [default = IMPORT_LITE_BAR];
+
+  optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
+  optional string default_cord = 85 [ctype=CORD,default="123"];
+
+  // For oneof test
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+    NestedMessage oneof_lazy_nested_message = 115 [lazy = true];
+  }
+}
+
+message ForeignMessageLite {
+  optional int32 c = 1;
+}
+
+enum ForeignEnumLite {
+  FOREIGN_LITE_FOO = 4;
+  FOREIGN_LITE_BAR = 5;
+  FOREIGN_LITE_BAZ = 6;
+}
+
+message TestPackedTypesLite {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnumLite packed_enum  = 103 [packed = true];
+}
+
+message TestAllExtensionsLite {
+  extensions 1 to max;
+}
+
+extend TestAllExtensionsLite {
+  // Singular
+  optional    int32 optional_int32_extension_lite    =  1;
+  optional    int64 optional_int64_extension_lite    =  2;
+  optional   uint32 optional_uint32_extension_lite   =  3;
+  optional   uint64 optional_uint64_extension_lite   =  4;
+  optional   sint32 optional_sint32_extension_lite   =  5;
+  optional   sint64 optional_sint64_extension_lite   =  6;
+  optional  fixed32 optional_fixed32_extension_lite  =  7;
+  optional  fixed64 optional_fixed64_extension_lite  =  8;
+  optional sfixed32 optional_sfixed32_extension_lite =  9;
+  optional sfixed64 optional_sfixed64_extension_lite = 10;
+  optional    float optional_float_extension_lite    = 11;
+  optional   double optional_double_extension_lite   = 12;
+  optional     bool optional_bool_extension_lite     = 13;
+  optional   string optional_string_extension_lite   = 14;
+  optional    bytes optional_bytes_extension_lite    = 15;
+
+  optional group OptionalGroup_extension_lite = 16 {
+    optional int32 a = 17;
+  }
+
+  optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite
+      = 18;
+  optional ForeignMessageLite optional_foreign_message_extension_lite = 19;
+  optional protobuf_unittest_import.ImportMessageLite
+    optional_import_message_extension_lite = 20;
+
+  optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
+  optional ForeignEnumLite optional_foreign_enum_extension_lite = 22;
+  optional protobuf_unittest_import.ImportEnumLite
+    optional_import_enum_extension_lite = 23;
+
+  optional string optional_string_piece_extension_lite = 24
+      [ctype=STRING_PIECE];
+  optional string optional_cord_extension_lite = 25 [ctype=CORD];
+
+  optional protobuf_unittest_import.PublicImportMessageLite
+    optional_public_import_message_extension_lite = 26;
+
+  optional TestAllTypesLite.NestedMessage
+    optional_lazy_message_extension_lite = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32_extension_lite    = 31;
+  repeated    int64 repeated_int64_extension_lite    = 32;
+  repeated   uint32 repeated_uint32_extension_lite   = 33;
+  repeated   uint64 repeated_uint64_extension_lite   = 34;
+  repeated   sint32 repeated_sint32_extension_lite   = 35;
+  repeated   sint64 repeated_sint64_extension_lite   = 36;
+  repeated  fixed32 repeated_fixed32_extension_lite  = 37;
+  repeated  fixed64 repeated_fixed64_extension_lite  = 38;
+  repeated sfixed32 repeated_sfixed32_extension_lite = 39;
+  repeated sfixed64 repeated_sfixed64_extension_lite = 40;
+  repeated    float repeated_float_extension_lite    = 41;
+  repeated   double repeated_double_extension_lite   = 42;
+  repeated     bool repeated_bool_extension_lite     = 43;
+  repeated   string repeated_string_extension_lite   = 44;
+  repeated    bytes repeated_bytes_extension_lite    = 45;
+
+  repeated group RepeatedGroup_extension_lite = 46 {
+    optional int32 a = 47;
+  }
+
+  repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite
+      = 48;
+  repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49;
+  repeated protobuf_unittest_import.ImportMessageLite
+    repeated_import_message_extension_lite = 50;
+
+  repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51;
+  repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52;
+  repeated protobuf_unittest_import.ImportEnumLite
+    repeated_import_enum_extension_lite = 53;
+
+  repeated string repeated_string_piece_extension_lite = 54
+      [ctype=STRING_PIECE];
+  repeated string repeated_cord_extension_lite = 55 [ctype=CORD];
+
+  repeated TestAllTypesLite.NestedMessage
+    repeated_lazy_message_extension_lite = 57 [lazy=true];
+
+  // Singular with defaults
+  optional    int32 default_int32_extension_lite    = 61 [default =  41    ];
+  optional    int64 default_int64_extension_lite    = 62 [default =  42    ];
+  optional   uint32 default_uint32_extension_lite   = 63 [default =  43    ];
+  optional   uint64 default_uint64_extension_lite   = 64 [default =  44    ];
+  optional   sint32 default_sint32_extension_lite   = 65 [default = -45    ];
+  optional   sint64 default_sint64_extension_lite   = 66 [default =  46    ];
+  optional  fixed32 default_fixed32_extension_lite  = 67 [default =  47    ];
+  optional  fixed64 default_fixed64_extension_lite  = 68 [default =  48    ];
+  optional sfixed32 default_sfixed32_extension_lite = 69 [default =  49    ];
+  optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50    ];
+  optional    float default_float_extension_lite    = 71 [default =  51.5  ];
+  optional   double default_double_extension_lite   = 72 [default =  52e3  ];
+  optional     bool default_bool_extension_lite     = 73 [default = true   ];
+  optional   string default_string_extension_lite   = 74 [default = "hello"];
+  optional    bytes default_bytes_extension_lite    = 75 [default = "world"];
+
+  optional TestAllTypesLite.NestedEnum
+    default_nested_enum_extension_lite = 81 [default = BAR];
+  optional ForeignEnumLite
+    default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR];
+  optional protobuf_unittest_import.ImportEnumLite
+    default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR];
+
+  optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE,
+                                                            default="abc"];
+  optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"];
+
+  // For oneof test
+  optional uint32 oneof_uint32_extension_lite = 111;
+  optional TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite = 112;
+  optional string oneof_string_extension_lite = 113;
+  optional bytes oneof_bytes_extension_lite = 114;
+}
+
+message TestPackedExtensionsLite {
+  extensions 1 to max;
+}
+
+extend TestPackedExtensionsLite {
+  repeated    int32 packed_int32_extension_lite    =  90 [packed = true];
+  repeated    int64 packed_int64_extension_lite    =  91 [packed = true];
+  repeated   uint32 packed_uint32_extension_lite   =  92 [packed = true];
+  repeated   uint64 packed_uint64_extension_lite   =  93 [packed = true];
+  repeated   sint32 packed_sint32_extension_lite   =  94 [packed = true];
+  repeated   sint64 packed_sint64_extension_lite   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32_extension_lite  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64_extension_lite  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32_extension_lite =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64_extension_lite =  99 [packed = true];
+  repeated    float packed_float_extension_lite    = 100 [packed = true];
+  repeated   double packed_double_extension_lite   = 101 [packed = true];
+  repeated     bool packed_bool_extension_lite     = 102 [packed = true];
+  repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
+}
+
+message TestNestedExtensionLite {
+  extend TestAllExtensionsLite {
+    optional int32 nested_extension = 12345;
+  }
+}
+
+// Test that deprecated fields work.  We only verify that they compile (at one
+// point this failed).
+message TestDeprecatedLite {
+  optional int32 deprecated_field = 1 [deprecated = true];
+}
+
+// See the comments of the same type in unittest.proto.
+message TestParsingMergeLite {
+  message RepeatedFieldsGenerator {
+    repeated TestAllTypesLite field1 = 1;
+    repeated TestAllTypesLite field2 = 2;
+    repeated TestAllTypesLite field3 = 3;
+    repeated group Group1 = 10 {
+      optional TestAllTypesLite field1 = 11;
+    }
+    repeated group Group2 = 20 {
+      optional TestAllTypesLite field1 = 21;
+    }
+    repeated TestAllTypesLite ext1 = 1000;
+    repeated TestAllTypesLite ext2 = 1001;
+  }
+  required TestAllTypesLite required_all_types = 1;
+  optional TestAllTypesLite optional_all_types = 2;
+  repeated TestAllTypesLite repeated_all_types = 3;
+  optional group OptionalGroup = 10 {
+    optional TestAllTypesLite optional_group_all_types = 11;
+  }
+  repeated group RepeatedGroup = 20 {
+    optional TestAllTypesLite repeated_group_all_types = 21;
+  }
+  extensions 1000 to max;
+  extend TestParsingMergeLite {
+    optional TestAllTypesLite optional_ext = 1000;
+    repeated TestAllTypesLite repeated_ext = 1001;
+  }
+}
+
+// TestEmptyMessageLite is used to test unknown fields support in lite mode.
+message TestEmptyMessageLite{
+}
+
+// Like above, but declare all field numbers as potential extensions.  No
+// actual extensions should ever be defined for this type.
+message TestEmptyMessageWithExtensionsLite {
+  extensions 1 to max;
+}
+
+enum V1EnumLite {
+    V1_FIRST = 1;
+}
+
+enum V2EnumLite {
+    V2_FIRST = 1;
+    V2_SECOND = 2;
+}
+
+message V1MessageLite {
+    required int32 int_field = 1;
+    optional V1EnumLite enum_field = 2 [ default = V1_FIRST ];
+}
+
+message V2MessageLite {
+    required int32 int_field = 1;
+    optional V2EnumLite enum_field = 2 [ default = V2_FIRST ];
+}

+ 44 - 0
Protos/google/protobuf/unittest_lite_imports_nonlite.proto

@@ -0,0 +1,44 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//
+// Tests that a "lite" message can import a regular message.
+
+syntax = "proto2";
+package protobuf_unittest;
+
+import "google/protobuf/unittest.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+message TestLiteImportsNonlite {
+  optional TestAllTypes message = 1;
+}

+ 82 - 0
Protos/google/protobuf/unittest_mset.proto

@@ -0,0 +1,82 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// This file is similar to unittest_mset_wire_format.proto, but does not
+// have a TestMessageSet, so it can be downgraded to proto1.
+
+syntax = "proto2";
+
+import "google/protobuf/unittest_mset_wire_format.proto";
+
+package protobuf_unittest;
+
+option cc_enable_arenas = true;
+option optimize_for = SPEED;
+
+message TestMessageSetContainer {
+  optional proto2_wireformat_unittest.TestMessageSet message_set = 1;
+}
+
+message TestMessageSetExtension1 {
+  extend proto2_wireformat_unittest.TestMessageSet {
+    optional TestMessageSetExtension1 message_set_extension = 1545008;
+  }
+  optional int32 i = 15;
+}
+
+message TestMessageSetExtension2 {
+  extend proto2_wireformat_unittest.TestMessageSet {
+    optional TestMessageSetExtension2 message_set_extension = 1547769;
+  }
+  optional string str = 25;
+}
+
+// This message was used to generate
+// //net/proto2/python/internal/testdata/message_set_message, but is commented
+// out since it must not actually exist in code, to simulate an "unknown"
+// extension.
+// message TestMessageSetUnknownExtension {
+//   extend TestMessageSet {
+//     optional TestMessageSetUnknownExtension message_set_extension = 56141421;
+//   }
+//   optional int64 a = 1;
+// }
+
+// MessageSet wire format is equivalent to this.
+message RawMessageSet {
+  repeated group Item = 1 {
+    required int32 type_id = 2;
+    required bytes message = 3;
+  }
+}

+ 52 - 0
Protos/google/protobuf/unittest_mset_wire_format.proto

@@ -0,0 +1,52 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// This file contains messages for testing message_set_wire_format.
+
+syntax = "proto2";
+package proto2_wireformat_unittest;
+
+option cc_enable_arenas = true;
+option optimize_for = SPEED;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
+// A message with message_set_wire_format.
+message TestMessageSet {
+  option message_set_wire_format = true;
+  extensions 4 to max;
+}
+
+message TestMessageSetWireFormatContainer {
+  optional TestMessageSet message_set = 1;
+}

+ 202 - 0
Protos/google/protobuf/unittest_no_arena.proto

@@ -0,0 +1,202 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// This proto file contains copies of TestAllTypes and friends, but with arena
+// support disabled in code generation. It allows us to test the performance
+// impact against baseline (non-arena) google.protobuf.
+
+syntax = "proto2";
+
+// Some generic_services option(s) added automatically.
+// See:  http://go/proto2-generic-services-default
+option cc_generic_services = true;     // auto-added
+option java_generic_services = true;   // auto-added
+option py_generic_services = true;     // auto-added
+option cc_enable_arenas = false;
+option objc_class_prefix = "NOARN";
+
+import "google/protobuf/unittest_import.proto";
+import "google/protobuf/unittest_arena.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest_no_arena;
+
+// Protos optimized for SPEED use a strict superset of the generated code
+// of equivalent ones optimized for CODE_SIZE, so we should optimize all our
+// tests for speed unless explicitly testing code size optimization.
+option optimize_for = SPEED;
+
+option java_outer_classname = "UnittestProto";
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    optional int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  optional    int32 optional_int32    =  1;
+  optional    int64 optional_int64    =  2;
+  optional   uint32 optional_uint32   =  3;
+  optional   uint64 optional_uint64   =  4;
+  optional   sint32 optional_sint32   =  5;
+  optional   sint64 optional_sint64   =  6;
+  optional  fixed32 optional_fixed32  =  7;
+  optional  fixed64 optional_fixed64  =  8;
+  optional sfixed32 optional_sfixed32 =  9;
+  optional sfixed64 optional_sfixed64 = 10;
+  optional    float optional_float    = 11;
+  optional   double optional_double   = 12;
+  optional     bool optional_bool     = 13;
+  optional   string optional_string   = 14;
+  optional    bytes optional_bytes    = 15;
+
+  optional group OptionalGroup = 16 {
+    optional int32 a = 17;
+  }
+
+  optional NestedMessage                        optional_nested_message  = 18;
+  optional ForeignMessage                       optional_foreign_message = 19;
+  optional protobuf_unittest_import.ImportMessage optional_import_message  = 20;
+
+  optional NestedEnum                           optional_nested_enum     = 21;
+  optional ForeignEnum                          optional_foreign_enum    = 22;
+  optional protobuf_unittest_import.ImportEnum    optional_import_enum     = 23;
+
+  optional string optional_string_piece = 24 [ctype=STRING_PIECE];
+  optional string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  optional protobuf_unittest_import.PublicImportMessage
+      optional_public_import_message = 26;
+
+  optional NestedMessage optional_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated group RepeatedGroup = 46 {
+    optional int32 a = 47;
+  }
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  // Singular with defaults
+  optional    int32 default_int32    = 61 [default =  41    ];
+  optional    int64 default_int64    = 62 [default =  42    ];
+  optional   uint32 default_uint32   = 63 [default =  43    ];
+  optional   uint64 default_uint64   = 64 [default =  44    ];
+  optional   sint32 default_sint32   = 65 [default = -45    ];
+  optional   sint64 default_sint64   = 66 [default =  46    ];
+  optional  fixed32 default_fixed32  = 67 [default =  47    ];
+  optional  fixed64 default_fixed64  = 68 [default =  48    ];
+  optional sfixed32 default_sfixed32 = 69 [default =  49    ];
+  optional sfixed64 default_sfixed64 = 70 [default = -50    ];
+  optional    float default_float    = 71 [default =  51.5  ];
+  optional   double default_double   = 72 [default =  52e3  ];
+  optional     bool default_bool     = 73 [default = true   ];
+  optional   string default_string   = 74 [default = "hello"];
+  optional    bytes default_bytes    = 75 [default = "world"];
+
+  optional NestedEnum  default_nested_enum  = 81 [default = BAR        ];
+  optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
+  optional protobuf_unittest_import.ImportEnum
+      default_import_enum = 83 [default = IMPORT_BAR];
+
+  optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
+  optional string default_cord = 85 [ctype=CORD,default="123"];
+
+  // For oneof test
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+    NestedMessage lazy_oneof_nested_message = 115 [lazy=true];
+  }
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  optional int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+message TestNoArenaMessage {
+  optional proto2_arena_unittest.ArenaMessage arena_message = 1;
+};

+ 37 - 0
Protos/google/protobuf/unittest_no_arena_import.proto

@@ -0,0 +1,37 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package proto2_arena_unittest;
+
+message ImportNoArenaNestedMessage {
+  optional int32 d = 1;
+};

+ 42 - 0
Protos/google/protobuf/unittest_no_arena_lite.proto

@@ -0,0 +1,42 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest_no_arena;
+
+message ForeignMessageLite {
+  optional int32 c = 1;
+}

+ 138 - 0
Protos/google/protobuf/unittest_no_field_presence.proto

@@ -0,0 +1,138 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// A proto file used to test a message type with no explicit field presence.
+
+syntax = "proto3";
+
+// We want to test embedded proto2 messages, so include some proto2 types.
+import "google/protobuf/unittest.proto";
+
+package proto2_nofieldpresence_unittest;
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+  }
+
+  // Singular
+  // TODO: remove 'optional' labels as soon as CL 69188077 is LGTM'd to make
+  // 'optional' optional.
+     int32 optional_int32    =  1;
+     int64 optional_int64    =  2;
+    uint32 optional_uint32   =  3;
+    uint64 optional_uint64   =  4;
+    sint32 optional_sint32   =  5;
+    sint64 optional_sint64   =  6;
+   fixed32 optional_fixed32  =  7;
+   fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+     float optional_float    = 11;
+    double optional_double   = 12;
+      bool optional_bool     = 13;
+    string optional_string   = 14;
+     bytes optional_bytes    = 15;
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+  protobuf_unittest.TestAllTypes         optional_proto2_message = 20;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+  // N.B.: proto2-enum-type fields not allowed, because their default values
+  // might not be zero.
+  //optional protobuf_unittest.ForeignEnum          optional_proto2_enum     = 23;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  NestedMessage optional_lazy_message = 30 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest.TestAllTypes         repeated_proto2_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    NestedEnum oneof_enum = 114;
+  }
+}
+
+message TestProto2Required {
+  protobuf_unittest.TestRequired proto2 = 1;
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_FOO = 0;
+  FOREIGN_BAR = 1;
+  FOREIGN_BAZ = 2;
+}

+ 54 - 0
Protos/google/protobuf/unittest_no_generic_services.proto

@@ -0,0 +1,54 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+
+syntax = "proto2";
+package google.protobuf.no_generic_services_test;
+
+
+// *_generic_services are false by default.
+
+message TestMessage {
+  optional int32 a = 1;
+  extensions 1000 to max;
+}
+
+enum TestEnum {
+  FOO = 1;
+}
+
+extend TestMessage {
+  optional int32 test_extension = 1000;
+}
+
+service TestService {
+  rpc Foo(TestMessage) returns(TestMessage);
+}

+ 67 - 0
Protos/google/protobuf/unittest_optimize_for.proto

@@ -0,0 +1,67 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file which uses optimize_for = CODE_SIZE.
+
+syntax = "proto2";
+import "google/protobuf/unittest.proto";
+
+package protobuf_unittest;
+
+option optimize_for = CODE_SIZE;
+
+message TestOptimizedForSize {
+  optional int32 i = 1;
+  optional ForeignMessage msg = 19;
+
+  extensions 1000 to max;
+
+  extend TestOptimizedForSize {
+    optional int32 test_extension = 1234;
+    optional TestRequiredOptimizedForSize test_extension2 = 1235;
+  }
+
+  oneof foo {
+    int32 integer_field = 2;
+    string string_field = 3;
+  }
+}
+
+message TestRequiredOptimizedForSize {
+  required int32 x = 1;
+}
+
+message TestOptionalOptimizedForSize {
+  optional TestRequiredOptimizedForSize o = 1;
+}

+ 71 - 0
Protos/google/protobuf/unittest_preserve_unknown_enum.proto

@@ -0,0 +1,71 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package proto3_preserve_unknown_enum_unittest;
+option objc_class_prefix = "UnknownEnums";
+
+option csharp_namespace = "Google.Protobuf.TestProtos";
+
+enum MyEnum {
+  FOO = 0;
+  BAR = 1;
+  BAZ = 2;
+}
+
+enum MyEnumPlusExtra {
+  E_FOO = 0;
+  E_BAR = 1;
+  E_BAZ = 2;
+  E_EXTRA = 3;
+}
+
+message MyMessage {
+  MyEnum e = 1;
+  repeated MyEnum repeated_e = 2;
+  repeated MyEnum repeated_packed_e = 3 [packed=true];
+  repeated MyEnumPlusExtra repeated_packed_unexpected_e = 4;  // not packed
+  oneof o {
+    MyEnum oneof_e_1 = 5;
+    MyEnum oneof_e_2 = 6;
+  }
+}
+
+message MyMessagePlusExtra {
+  MyEnumPlusExtra e = 1;
+  repeated MyEnumPlusExtra repeated_e = 2;
+  repeated MyEnumPlusExtra repeated_packed_e = 3 [packed=true];
+  repeated MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed=true];
+  oneof o {
+    MyEnumPlusExtra oneof_e_1 = 5;
+    MyEnumPlusExtra oneof_e_2 = 6;
+  }
+}

+ 50 - 0
Protos/google/protobuf/unittest_preserve_unknown_enum2.proto

@@ -0,0 +1,50 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package proto2_preserve_unknown_enum_unittest;
+
+enum MyEnum {
+  FOO = 0;
+  BAR = 1;
+  BAZ = 2;
+}
+
+message MyMessage {
+  optional MyEnum e = 1;
+  repeated MyEnum repeated_e = 2;
+  repeated MyEnum repeated_packed_e = 3 [packed=true];
+  repeated MyEnum repeated_packed_unexpected_e = 4;  // not packed
+  oneof o {
+    MyEnum oneof_e_1 = 5;
+    MyEnum oneof_e_2 = 6;
+  }
+}

+ 391 - 0
Protos/google/protobuf/unittest_proto3.proto

@@ -0,0 +1,391 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// A proto file we will use for unit testing.
+
+syntax = "proto3";
+
+// Some generic_services option(s) added automatically.
+// See:  http://go/proto2-generic-services-default
+option cc_generic_services = true;     // auto-added
+option java_generic_services = true;   // auto-added
+option py_generic_services = true;     // auto-added
+option cc_enable_arenas = true;
+option csharp_namespace = "Google.Protobuf.TestProtos";
+
+import "google/protobuf/unittest_import_proto3.proto";
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+// In test_util.h we do "using namespace unittest = protobuf_unittest".
+package protobuf_unittest;
+
+// Protos optimized for SPEED use a strict superset of the generated code
+// of equivalent ones optimized for CODE_SIZE, so we should optimize all our
+// tests for speed unless explicitly testing code size optimization.
+option optimize_for = SPEED;
+
+option java_outer_classname = "UnittestProto";
+
+// Disambiguate generated code from unittest.proto
+option swift_prefix = "Proto3";
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    NESTED_ENUM_UNSPECIFIED = 0;
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  int32 single_int32 = 1;
+  int64 single_int64 = 2;
+  uint32 single_uint32 = 3;
+  uint64 single_uint64 = 4;
+  sint32 single_sint32 = 5;
+  sint64 single_sint64 = 6;
+  fixed32 single_fixed32 = 7;
+  fixed64 single_fixed64 = 8;
+  sfixed32 single_sfixed32 = 9;
+  sfixed64 single_sfixed64 = 10;
+  float single_float = 11;
+  double single_double = 12;
+  bool single_bool = 13;
+  string single_string = 14;
+  bytes single_bytes = 15;
+
+  NestedMessage single_nested_message = 18;
+  ForeignMessage single_foreign_message = 19;
+  protobuf_unittest_import.ImportMessage single_import_message = 20;
+
+  NestedEnum single_nested_enum = 21;
+  ForeignEnum single_foreign_enum = 22;
+  protobuf_unittest_import.ImportEnum single_import_enum = 23;
+
+  // Defined in unittest_import_public.proto
+  protobuf_unittest_import.PublicImportMessage
+      single_public_import_message = 26;
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
+  // Defined in unittest_import_public.proto
+  repeated protobuf_unittest_import.PublicImportMessage
+      repeated_public_import_message = 54;
+
+  // For oneof test
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+// This proto includes a recusively nested message.
+message NestedTestAllTypes {
+  NestedTestAllTypes child = 1;
+  TestAllTypes payload = 2;
+  repeated NestedTestAllTypes repeated_child = 3;
+}
+
+message TestDeprecatedFields {
+  int32 deprecated_int32 = 1 [deprecated=true];
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_UNSPECIFIED = 0;
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+message TestReservedFields {
+  reserved 2, 15, 9 to 11;
+  reserved "bar", "baz";
+}
+
+
+// Test that we can use NestedMessage from outside TestAllTypes.
+message TestForeignNested {
+  TestAllTypes.NestedMessage foreign_nested = 1;
+}
+
+// Test that really large tag numbers don't break anything.
+message TestReallyLargeTagNumber {
+  // The largest possible tag number is 2^28 - 1, since the wire format uses
+  // three bits to communicate wire type.
+  int32 a = 1;
+  int32 bb = 268435455;
+}
+
+message TestRecursiveMessage {
+  TestRecursiveMessage a = 1;
+  int32 i = 2;
+}
+
+// Test that mutual recursion works.
+message TestMutualRecursionA {
+  TestMutualRecursionB bb = 1;
+}
+
+message TestMutualRecursionB {
+  TestMutualRecursionA a = 1;
+  int32 optional_int32 = 2;
+}
+
+
+// Test an enum that has multiple values with the same number.
+enum TestEnumWithDupValue {
+  TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0;
+  option allow_alias = true;
+
+  FOO1 = 1;
+  BAR1 = 2;
+  BAZ = 3;
+  FOO2 = 1;
+  BAR2 = 2;
+}
+
+// Test an enum with large, unordered values.
+enum TestSparseEnum {
+  TEST_SPARSE_ENUM_UNSPECIFIED = 0;
+  SPARSE_A = 123;
+  SPARSE_B = 62374;
+  SPARSE_C = 12589234;
+  SPARSE_D = -15;
+  SPARSE_E = -53452;
+  // In proto3, value 0 must be the first one specified
+  // SPARSE_F = 0;
+  SPARSE_G = 2;
+}
+
+// Test message with CamelCase field names.  This violates Protocol Buffer
+// standard style.
+message TestCamelCaseFieldNames {
+  int32 PrimitiveField = 1;
+  string StringField = 2;
+  ForeignEnum EnumField = 3;
+  ForeignMessage MessageField = 4;
+
+  repeated int32 RepeatedPrimitiveField = 7;
+  repeated string RepeatedStringField = 8;
+  repeated ForeignEnum RepeatedEnumField = 9;
+  repeated ForeignMessage RepeatedMessageField = 10;
+}
+
+
+// We list fields out of order, to ensure that we're using field number and not
+// field index to determine serialization order.
+message TestFieldOrderings {
+  string my_string = 11;
+  int64 my_int = 1;
+  float my_float = 101;
+  message NestedMessage {
+    int64 oo = 2;
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    int32 bb = 1;
+  }
+
+  NestedMessage single_nested_message  = 200;
+}
+
+message SparseEnumMessage {
+  TestSparseEnum sparse_enum = 1;
+}
+
+// Test String and Bytes: string is for valid UTF-8 strings
+message OneString {
+  string data = 1;
+}
+
+message MoreString {
+  repeated string data = 1;
+}
+
+message OneBytes {
+  bytes data = 1;
+}
+
+message MoreBytes {
+  bytes data = 1;
+}
+
+// Test int32, uint32, int64, uint64, and bool are all compatible
+message Int32Message {
+  int32 data = 1;
+}
+
+message Uint32Message {
+  uint32 data = 1;
+}
+
+message Int64Message {
+  int64 data = 1;
+}
+
+message Uint64Message {
+  uint64 data = 1;
+}
+
+message BoolMessage {
+  bool data = 1;
+}
+
+// Test oneofs.
+message TestOneof {
+  oneof foo {
+    int32 foo_int = 1;
+    string foo_string = 2;
+    TestAllTypes foo_message = 3;
+  }
+}
+
+// Test messages for packed fields
+
+message TestPackedTypes {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnum packed_enum  = 103 [packed = true];
+}
+
+// A message with the same fields as TestPackedTypes, but without packing. Used
+// to test packed <-> unpacked wire compatibility.
+message TestUnpackedTypes {
+  repeated    int32 unpacked_int32    =  90 [packed = false];
+  repeated    int64 unpacked_int64    =  91 [packed = false];
+  repeated   uint32 unpacked_uint32   =  92 [packed = false];
+  repeated   uint64 unpacked_uint64   =  93 [packed = false];
+  repeated   sint32 unpacked_sint32   =  94 [packed = false];
+  repeated   sint64 unpacked_sint64   =  95 [packed = false];
+  repeated  fixed32 unpacked_fixed32  =  96 [packed = false];
+  repeated  fixed64 unpacked_fixed64  =  97 [packed = false];
+  repeated sfixed32 unpacked_sfixed32 =  98 [packed = false];
+  repeated sfixed64 unpacked_sfixed64 =  99 [packed = false];
+  repeated    float unpacked_float    = 100 [packed = false];
+  repeated   double unpacked_double   = 101 [packed = false];
+  repeated     bool unpacked_bool     = 102 [packed = false];
+  repeated ForeignEnum unpacked_enum  = 103 [packed = false];
+}
+
+message TestRepeatedScalarDifferentTagSizes {
+  // Parsing repeated fixed size values used to fail. This message needs to be
+  // used in order to get a tag of the right size; all of the repeated fields
+  // in TestAllTypes didn't trigger the check.
+  repeated fixed32 repeated_fixed32 = 12;
+  // Check for a varint type, just for good measure.
+  repeated int32   repeated_int32   = 13;
+
+  // These have two-byte tags.
+  repeated fixed64 repeated_fixed64 = 2046;
+  repeated int64   repeated_int64   = 2047;
+
+  // Three byte tags.
+  repeated float   repeated_float   = 262142;
+  repeated uint64  repeated_uint64  = 262143;
+}
+
+message TestCommentInjectionMessage {
+  // */ <- This should not close the generated doc comment
+  string a = 1;
+}
+
+
+// Test that RPC services work.
+message FooRequest  {}
+message FooResponse {}
+
+message FooClientMessage {}
+message FooServerMessage{}
+
+service TestService {
+  rpc Foo(FooRequest) returns (FooResponse);
+  rpc Bar(BarRequest) returns (BarResponse);
+}
+
+
+message BarRequest  {}
+message BarResponse {}
+

+ 206 - 0
Protos/google/protobuf/unittest_proto3_arena.proto

@@ -0,0 +1,206 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+option cc_enable_arenas = true;
+
+import "google/protobuf/unittest_import.proto";
+
+package proto3_arena_unittest;
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    ZERO = 0;
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+     int32 optional_int32    =  1;
+     int64 optional_int64    =  2;
+    uint32 optional_uint32   =  3;
+    uint64 optional_uint64   =  4;
+    sint32 optional_sint32   =  5;
+    sint64 optional_sint64   =  6;
+   fixed32 optional_fixed32  =  7;
+   fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+     float optional_float    = 11;
+    double optional_double   = 12;
+      bool optional_bool     = 13;
+    string optional_string   = 14;
+     bytes optional_bytes    = 15;
+
+  // Groups are not allowed in proto3.
+  // optional group OptionalGroup = 16 {
+  //   optional int32 a = 17;
+  // }
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+  protobuf_unittest_import.ImportMessage optional_import_message  = 20;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // optional protobuf_unittest_import.ImportEnum    optional_import_enum  = 23;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  protobuf_unittest_import.PublicImportMessage
+      optional_public_import_message = 26;
+
+  NestedMessage optional_lazy_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  // Groups are not allowed in proto3.
+  // repeated group RepeatedGroup = 46 {
+  //   optional int32 a = 47;
+  // }
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // repeated protobuf_unittest_import.ImportEnum    repeated_import_enum  = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+// Test messages for packed fields
+
+message TestPackedTypes {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnum packed_enum  = 103 [packed = true];
+}
+
+// Explicitly set packed to false
+message TestUnpackedTypes {
+  repeated    int32 repeated_int32    =  1 [packed = false];
+  repeated    int64 repeated_int64    =  2 [packed = false];
+  repeated   uint32 repeated_uint32   =  3 [packed = false];
+  repeated   uint64 repeated_uint64   =  4 [packed = false];
+  repeated   sint32 repeated_sint32   =  5 [packed = false];
+  repeated   sint64 repeated_sint64   =  6 [packed = false];
+  repeated  fixed32 repeated_fixed32  =  7 [packed = false];
+  repeated  fixed64 repeated_fixed64  =  8 [packed = false];
+  repeated sfixed32 repeated_sfixed32 =  9 [packed = false];
+  repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
+  repeated    float repeated_float    = 11 [packed = false];
+  repeated   double repeated_double   = 12 [packed = false];
+  repeated     bool repeated_bool     = 13 [packed = false];
+  repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
+}
+
+// This proto includes a recusively nested message.
+message NestedTestAllTypes {
+  NestedTestAllTypes child = 1;
+  TestAllTypes payload = 2;
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_ZERO = 0;
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+// TestEmptyMessage is used to test behavior of unknown fields.
+message TestEmptyMessage {
+}
+

+ 207 - 0
Protos/google/protobuf/unittest_proto3_arena_lite.proto

@@ -0,0 +1,207 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+option cc_enable_arenas = true;
+option optimize_for = LITE_RUNTIME;
+
+import "google/protobuf/unittest_import.proto";
+
+package proto3_arena_lite_unittest;
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    ZERO = 0;
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+     int32 optional_int32    =  1;
+     int64 optional_int64    =  2;
+    uint32 optional_uint32   =  3;
+    uint64 optional_uint64   =  4;
+    sint32 optional_sint32   =  5;
+    sint64 optional_sint64   =  6;
+   fixed32 optional_fixed32  =  7;
+   fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+     float optional_float    = 11;
+    double optional_double   = 12;
+      bool optional_bool     = 13;
+    string optional_string   = 14;
+     bytes optional_bytes    = 15;
+
+  // Groups are not allowed in proto3.
+  // optional group OptionalGroup = 16 {
+  //   optional int32 a = 17;
+  // }
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+  protobuf_unittest_import.ImportMessage optional_import_message  = 20;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // optional protobuf_unittest_import.ImportEnum    optional_import_enum  = 23;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  protobuf_unittest_import.PublicImportMessage
+      optional_public_import_message = 26;
+
+  NestedMessage optional_lazy_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  // Groups are not allowed in proto3.
+  // repeated group RepeatedGroup = 46 {
+  //   optional int32 a = 47;
+  // }
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // repeated protobuf_unittest_import.ImportEnum    repeated_import_enum  = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+// Test messages for packed fields
+
+message TestPackedTypes {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnum packed_enum  = 103 [packed = true];
+}
+
+// Explicitly set packed to false
+message TestUnpackedTypes {
+  repeated    int32 repeated_int32    =  1 [packed = false];
+  repeated    int64 repeated_int64    =  2 [packed = false];
+  repeated   uint32 repeated_uint32   =  3 [packed = false];
+  repeated   uint64 repeated_uint64   =  4 [packed = false];
+  repeated   sint32 repeated_sint32   =  5 [packed = false];
+  repeated   sint64 repeated_sint64   =  6 [packed = false];
+  repeated  fixed32 repeated_fixed32  =  7 [packed = false];
+  repeated  fixed64 repeated_fixed64  =  8 [packed = false];
+  repeated sfixed32 repeated_sfixed32 =  9 [packed = false];
+  repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
+  repeated    float repeated_float    = 11 [packed = false];
+  repeated   double repeated_double   = 12 [packed = false];
+  repeated     bool repeated_bool     = 13 [packed = false];
+  repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
+}
+
+// This proto includes a recusively nested message.
+message NestedTestAllTypes {
+  NestedTestAllTypes child = 1;
+  TestAllTypes payload = 2;
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_ZERO = 0;
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+// TestEmptyMessage is used to test behavior of unknown fields.
+message TestEmptyMessage {
+}
+

+ 206 - 0
Protos/google/protobuf/unittest_proto3_lite.proto

@@ -0,0 +1,206 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+option optimize_for = LITE_RUNTIME;
+
+import "google/protobuf/unittest_import.proto";
+
+package proto3_lite_unittest;
+
+// This proto includes every type of field in both singular and repeated
+// forms.
+message TestAllTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    ZERO = 0;
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+     int32 optional_int32    =  1;
+     int64 optional_int64    =  2;
+    uint32 optional_uint32   =  3;
+    uint64 optional_uint64   =  4;
+    sint32 optional_sint32   =  5;
+    sint64 optional_sint64   =  6;
+   fixed32 optional_fixed32  =  7;
+   fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+     float optional_float    = 11;
+    double optional_double   = 12;
+      bool optional_bool     = 13;
+    string optional_string   = 14;
+     bytes optional_bytes    = 15;
+
+  // Groups are not allowed in proto3.
+  // optional group OptionalGroup = 16 {
+  //   optional int32 a = 17;
+  // }
+
+  NestedMessage                        optional_nested_message  = 18;
+  ForeignMessage                       optional_foreign_message = 19;
+  protobuf_unittest_import.ImportMessage optional_import_message  = 20;
+
+  NestedEnum                           optional_nested_enum     = 21;
+  ForeignEnum                          optional_foreign_enum    = 22;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // optional protobuf_unittest_import.ImportEnum    optional_import_enum  = 23;
+
+  string optional_string_piece = 24 [ctype=STRING_PIECE];
+  string optional_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  protobuf_unittest_import.PublicImportMessage
+      optional_public_import_message = 26;
+
+  NestedMessage optional_lazy_message = 27 [lazy=true];
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  // Groups are not allowed in proto3.
+  // repeated group RepeatedGroup = 46 {
+  //   optional int32 a = 47;
+  // }
+
+  repeated NestedMessage                        repeated_nested_message  = 48;
+  repeated ForeignMessage                       repeated_foreign_message = 49;
+  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
+
+  repeated NestedEnum                           repeated_nested_enum     = 51;
+  repeated ForeignEnum                          repeated_foreign_enum    = 52;
+
+  // Omitted (compared to unittest.proto) because proto2 enums are not allowed
+  // inside proto2 messages.
+  //
+  // repeated protobuf_unittest_import.ImportEnum    repeated_import_enum  = 53;
+
+  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
+  repeated string repeated_cord = 55 [ctype=CORD];
+
+  repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
+
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+// Test messages for packed fields
+
+message TestPackedTypes {
+  repeated    int32 packed_int32    =  90 [packed = true];
+  repeated    int64 packed_int64    =  91 [packed = true];
+  repeated   uint32 packed_uint32   =  92 [packed = true];
+  repeated   uint64 packed_uint64   =  93 [packed = true];
+  repeated   sint32 packed_sint32   =  94 [packed = true];
+  repeated   sint64 packed_sint64   =  95 [packed = true];
+  repeated  fixed32 packed_fixed32  =  96 [packed = true];
+  repeated  fixed64 packed_fixed64  =  97 [packed = true];
+  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
+  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
+  repeated    float packed_float    = 100 [packed = true];
+  repeated   double packed_double   = 101 [packed = true];
+  repeated     bool packed_bool     = 102 [packed = true];
+  repeated ForeignEnum packed_enum  = 103 [packed = true];
+}
+
+// Explicitly set packed to false
+message TestUnpackedTypes {
+  repeated    int32 repeated_int32    =  1 [packed = false];
+  repeated    int64 repeated_int64    =  2 [packed = false];
+  repeated   uint32 repeated_uint32   =  3 [packed = false];
+  repeated   uint64 repeated_uint64   =  4 [packed = false];
+  repeated   sint32 repeated_sint32   =  5 [packed = false];
+  repeated   sint64 repeated_sint64   =  6 [packed = false];
+  repeated  fixed32 repeated_fixed32  =  7 [packed = false];
+  repeated  fixed64 repeated_fixed64  =  8 [packed = false];
+  repeated sfixed32 repeated_sfixed32 =  9 [packed = false];
+  repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
+  repeated    float repeated_float    = 11 [packed = false];
+  repeated   double repeated_double   = 12 [packed = false];
+  repeated     bool repeated_bool     = 13 [packed = false];
+  repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
+}
+
+// This proto includes a recusively nested message.
+message NestedTestAllTypes {
+  NestedTestAllTypes child = 1;
+  TestAllTypes payload = 2;
+}
+
+// Define these after TestAllTypes to make sure the compiler can handle
+// that.
+message ForeignMessage {
+  int32 c = 1;
+}
+
+enum ForeignEnum {
+  FOREIGN_ZERO = 0;
+  FOREIGN_FOO = 4;
+  FOREIGN_BAR = 5;
+  FOREIGN_BAZ = 6;
+}
+
+// TestEmptyMessage is used to test behavior of unknown fields.
+message TestEmptyMessage {
+}
+

+ 114 - 0
Protos/google/protobuf/unittest_well_known_types.proto

@@ -0,0 +1,114 @@
+syntax = "proto3";
+
+package protobuf_unittest;
+
+option csharp_namespace = "Google.Protobuf.TestProtos";
+option java_multiple_files = true;
+option java_package = "com.google.protobuf.test";
+
+import "google/protobuf/any.proto";
+import "google/protobuf/api.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/empty.proto";
+import "google/protobuf/field_mask.proto";
+import "google/protobuf/source_context.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+import "google/protobuf/type.proto";
+import "google/protobuf/wrappers.proto";
+
+// Test that we can include all well-known types.
+// Each wrapper type is included separately, as languages
+// map handle different wrappers in different ways.
+message TestWellKnownTypes {
+  google.protobuf.Any any_field = 1;
+  google.protobuf.Api api_field = 2;
+  google.protobuf.Duration duration_field = 3;
+  google.protobuf.Empty empty_field = 4;
+  google.protobuf.FieldMask field_mask_field = 5;
+  google.protobuf.SourceContext source_context_field = 6;
+  google.protobuf.Struct struct_field = 7;
+  google.protobuf.Timestamp timestamp_field = 8;
+  google.protobuf.Type type_field = 9;
+  google.protobuf.DoubleValue double_field = 10;
+  google.protobuf.FloatValue float_field = 11;
+  google.protobuf.Int64Value int64_field = 12;
+  google.protobuf.UInt64Value uint64_field = 13;
+  google.protobuf.Int32Value int32_field = 14;
+  google.protobuf.UInt32Value uint32_field = 15;
+  google.protobuf.BoolValue bool_field = 16;
+  google.protobuf.StringValue string_field = 17;
+  google.protobuf.BytesValue bytes_field = 18;
+  // Part of struct, but useful to be able to test separately
+  google.protobuf.Value value_field = 19;
+}
+
+// A repeated field for each well-known type.
+message RepeatedWellKnownTypes {
+  repeated google.protobuf.Any any_field = 1;
+  repeated google.protobuf.Api api_field = 2;
+  repeated google.protobuf.Duration duration_field = 3;
+  repeated google.protobuf.Empty empty_field = 4;
+  repeated google.protobuf.FieldMask field_mask_field = 5;
+  repeated google.protobuf.SourceContext source_context_field = 6;
+  repeated google.protobuf.Struct struct_field = 7;
+  repeated google.protobuf.Timestamp timestamp_field = 8;
+  repeated google.protobuf.Type type_field = 9;
+  // These don't actually make a lot of sense, but they're not prohibited...
+  repeated google.protobuf.DoubleValue double_field = 10;
+  repeated google.protobuf.FloatValue float_field = 11;
+  repeated google.protobuf.Int64Value int64_field = 12;
+  repeated google.protobuf.UInt64Value uint64_field = 13;
+  repeated google.protobuf.Int32Value int32_field = 14;
+  repeated google.protobuf.UInt32Value uint32_field = 15;
+  repeated google.protobuf.BoolValue bool_field = 16;
+  repeated google.protobuf.StringValue string_field = 17;
+  repeated google.protobuf.BytesValue bytes_field = 18;
+}
+
+message OneofWellKnownTypes {
+  oneof oneof_field {
+    google.protobuf.Any any_field = 1;
+    google.protobuf.Api api_field = 2;
+    google.protobuf.Duration duration_field = 3;
+    google.protobuf.Empty empty_field = 4;
+    google.protobuf.FieldMask field_mask_field = 5;
+    google.protobuf.SourceContext source_context_field = 6;
+    google.protobuf.Struct struct_field = 7;
+    google.protobuf.Timestamp timestamp_field = 8;
+    google.protobuf.Type type_field = 9;
+    google.protobuf.DoubleValue double_field = 10;
+    google.protobuf.FloatValue float_field = 11;
+    google.protobuf.Int64Value int64_field = 12;
+    google.protobuf.UInt64Value uint64_field = 13;
+    google.protobuf.Int32Value int32_field = 14;
+    google.protobuf.UInt32Value uint32_field = 15;
+    google.protobuf.BoolValue bool_field = 16;
+    google.protobuf.StringValue string_field = 17;
+    google.protobuf.BytesValue bytes_field = 18;
+  }
+}
+
+// A map field for each well-known type. We only
+// need to worry about the value part of the map being the
+// well-known types, as messages can't be map keys.
+message MapWellKnownTypes {
+  map<int32,google.protobuf.Any> any_field = 1;
+  map<int32,google.protobuf.Api> api_field = 2;
+  map<int32,google.protobuf.Duration> duration_field = 3;
+  map<int32,google.protobuf.Empty> empty_field = 4;
+  map<int32,google.protobuf.FieldMask> field_mask_field = 5;
+  map<int32,google.protobuf.SourceContext> source_context_field = 6;
+  map<int32,google.protobuf.Struct> struct_field = 7;
+  map<int32,google.protobuf.Timestamp> timestamp_field = 8;
+  map<int32,google.protobuf.Type> type_field = 9;
+  map<int32,google.protobuf.DoubleValue> double_field = 10;
+  map<int32,google.protobuf.FloatValue> float_field = 11;
+  map<int32,google.protobuf.Int64Value> int64_field = 12;
+  map<int32,google.protobuf.UInt64Value> uint64_field = 13;
+  map<int32,google.protobuf.Int32Value> int32_field = 14;
+  map<int32,google.protobuf.UInt32Value> uint32_field = 15;
+  map<int32,google.protobuf.BoolValue> bool_field = 16;
+  map<int32,google.protobuf.StringValue> string_field = 17;
+  map<int32,google.protobuf.BytesValue> bytes_field = 18;
+}

+ 119 - 0
Protos/google/protobuf/wrappers.proto

@@ -0,0 +1,119 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Wrappers for primitive (non-message) types. These types are useful
+// for embedding primitives in the `google.protobuf.Any` type and for places
+// where we need to distinguish between the absence of a primitive
+// typed field and its default value.
+
+syntax = "proto3";
+
+package google.protobuf;
+
+option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
+option go_package = "github.com/golang/protobuf/ptypes/wrappers";
+option java_package = "com.google.protobuf";
+option java_outer_classname = "WrappersProto";
+option java_multiple_files = true;
+option java_generate_equals_and_hash = true;
+option objc_class_prefix = "GPB";
+
+// Wrapper message for `double`.
+//
+// The JSON representation for `DoubleValue` is JSON number.
+message DoubleValue {
+  // The double value.
+  double value = 1;
+}
+
+// Wrapper message for `float`.
+//
+// The JSON representation for `FloatValue` is JSON number.
+message FloatValue {
+  // The float value.
+  float value = 1;
+}
+
+// Wrapper message for `int64`.
+//
+// The JSON representation for `Int64Value` is JSON string.
+message Int64Value {
+  // The int64 value.
+  int64 value = 1;
+}
+
+// Wrapper message for `uint64`.
+//
+// The JSON representation for `UInt64Value` is JSON string.
+message UInt64Value {
+  // The uint64 value.
+  uint64 value = 1;
+}
+
+// Wrapper message for `int32`.
+//
+// The JSON representation for `Int32Value` is JSON number.
+message Int32Value {
+  // The int32 value.
+  int32 value = 1;
+}
+
+// Wrapper message for `uint32`.
+//
+// The JSON representation for `UInt32Value` is JSON number.
+message UInt32Value {
+  // The uint32 value.
+  uint32 value = 1;
+}
+
+// Wrapper message for `bool`.
+//
+// The JSON representation for `BoolValue` is JSON `true` and `false`.
+message BoolValue {
+  // The bool value.
+  bool value = 1;
+}
+
+// Wrapper message for `string`.
+//
+// The JSON representation for `StringValue` is JSON string.
+message StringValue {
+  // The string value.
+  string value = 1;
+}
+
+// Wrapper message for `bytes`.
+//
+// The JSON representation for `BytesValue` is JSON string.
+message BytesValue {
+  // The bytes value.
+  bytes value = 1;
+}

+ 140 - 0
Protos/unittest_swift_all_required_types.proto

@@ -0,0 +1,140 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// An addition to unittest.proto
+syntax = "proto2";
+
+import "google/protobuf/unittest_import.proto";
+import "google/protobuf/unittest.proto";
+
+package protobuf_unittest;
+
+message TestAllRequiredTypes {
+  message NestedMessage {
+    // The field name "b" fails to compile in proto1 because it conflicts with
+    // a local variable named "b" in one of the generated methods.  Doh.
+    // This file needs to compile in proto1 to test backwards-compatibility.
+    required int32 bb = 1;
+  }
+
+  enum NestedEnum {
+    FOO = 1;
+    BAR = 2;
+    BAZ = 3;
+    NEG = -1;  // Intentionally negative.
+  }
+
+  // Singular
+  required    int32 required_int32    =  1;
+  required    int64 required_int64    =  2;
+  required   uint32 required_uint32   =  3;
+  required   uint64 required_uint64   =  4;
+  required   sint32 required_sint32   =  5;
+  required   sint64 required_sint64   =  6;
+  required  fixed32 required_fixed32  =  7;
+  required  fixed64 required_fixed64  =  8;
+  required sfixed32 required_sfixed32 =  9;
+  required sfixed64 required_sfixed64 = 10;
+  required    float required_float    = 11;
+  required   double required_double   = 12;
+  required     bool required_bool     = 13;
+  required   string required_string   = 14;
+  required    bytes required_bytes    = 15;
+
+  required group RequiredGroup = 16 {
+    required int32 a = 17;
+  }
+
+  required NestedMessage                        required_nested_message  = 18;
+  required ForeignMessage                       required_foreign_message = 19;
+  required protobuf_unittest_import.ImportMessage required_import_message  = 20;
+
+  required NestedEnum                           required_nested_enum     = 21;
+  required ForeignEnum                          required_foreign_enum    = 22;
+  required protobuf_unittest_import.ImportEnum    required_import_enum     = 23;
+
+  required string required_string_piece = 24 [ctype=STRING_PIECE];
+  required string required_cord = 25 [ctype=CORD];
+
+  // Defined in unittest_import_public.proto
+  required protobuf_unittest_import.PublicImportMessage
+      required_public_import_message = 26;
+
+  required NestedMessage required_lazy_message = 27 [lazy=true];
+
+  // Singular with defaults
+  required    int32 default_int32    = 61 [default =  41    ];
+  required    int64 default_int64    = 62 [default =  42    ];
+  required   uint32 default_uint32   = 63 [default =  43    ];
+  required   uint64 default_uint64   = 64 [default =  44    ];
+  required   sint32 default_sint32   = 65 [default = -45    ];
+  required   sint64 default_sint64   = 66 [default =  46    ];
+  required  fixed32 default_fixed32  = 67 [default =  47    ];
+  required  fixed64 default_fixed64  = 68 [default =  48    ];
+  required sfixed32 default_sfixed32 = 69 [default =  49    ];
+  required sfixed64 default_sfixed64 = 70 [default = -50    ];
+  required    float default_float    = 71 [default =  51.5  ];
+  required   double default_double   = 72 [default =  52e3  ];
+  required     bool default_bool     = 73 [default = true   ];
+  required   string default_string   = 74 [default = "hello"];
+  required    bytes default_bytes    = 75 [default = "world"];
+
+  required NestedEnum  default_nested_enum  = 81 [default = BAR        ];
+  required ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
+  required protobuf_unittest_import.ImportEnum
+      default_import_enum = 83 [default = IMPORT_BAR];
+
+  required string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
+  required string default_cord = 85 [ctype=CORD,default="123"];
+
+  // For oneof test
+  oneof oneof_field {
+    uint32 oneof_uint32 = 111;
+    NestedMessage oneof_nested_message = 112;
+    string oneof_string = 113;
+    bytes oneof_bytes = 114;
+  }
+}
+
+
+message TestSomeRequiredTypes {
+  enum NestedEnum {
+    FOO = 1;
+  }
+
+  // Singular
+  required    int32 required_int32    =  1;
+  required    float required_float    =  2;
+  required     bool required_bool     =  3;
+  required   string required_string   =  4;
+  required    bytes required_bytes    =  5;
+
+  required NestedEnum required_nested_enum     = 6;
+}

+ 58 - 0
Protos/unittest_swift_cycle.proto

@@ -0,0 +1,58 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc.  All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package protobuf_unittest;
+
+// Cycles in the Message graph can cause problems for the mutable classes
+// since the properties on the mutable class change types. This file just
+// needs to generate source, and that source must compile, to ensure the
+// generated source works for this sort of case.
+
+// You can't make a object graph that spans files, so this can only be done
+// within a single proto file.
+
+message CycleFoo {
+  optional CycleFoo a_foo = 1;
+  optional CycleBar a_bar = 2;
+  optional CycleBaz a_baz = 3;
+}
+
+message CycleBar {
+  optional CycleBar a_bar = 1;
+  optional CycleBaz a_baz = 2;
+  optional CycleFoo a_foo = 3;
+}
+
+message CycleBaz {
+  optional CycleBaz a_baz = 1;
+  optional CycleFoo a_foo = 2;
+  optional CycleBar a_bar = 3;
+}

+ 44 - 0
Protos/unittest_swift_enum.proto

@@ -0,0 +1,44 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Apple, Inc.  All Rights Reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package protobuf_unittest;
+
+message SwiftEnumTest {
+    enum EnumTest1 {
+        ENUM_TEST_1_FIRST_VALUE = 1;
+        ENUM_TEST_1_SECOND_VALUE = 2;
+    }
+    enum EnumTest2 {
+        ENUM_TEST_2_FIRST_VALUE = 1;
+        SECOND_VALUE = 2;
+    }
+}

+ 40 - 0
Protos/unittest_swift_enum_optional_default.proto

@@ -0,0 +1,40 @@
+// Protos/unittest_swift_enum_optional_default.proto - test proto
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Test handling of enum fields with specified defaults
+///
+// -----------------------------------------------------------------------------
+
+syntax = "proto2";
+
+package protobuf_unittest.extend;
+
+message EnumOptionalDefault {
+ message NestedMessage {
+   enum Enum {
+     FOO = 0;
+   }
+
+   // The circular reference here forces the generator to
+   // implement heap-backed storage.
+   optional NestedMessage message = 1;
+
+   optional Enum optional_enum = 17 [default = FOO];
+ }
+
+ message NestedMessage2 {
+   enum Enum {
+     FOO = 0;
+   }
+   optional Enum optional_enum = 17 [default = FOO];
+ }
+}

+ 42 - 0
Protos/unittest_swift_extension.proto

@@ -0,0 +1,42 @@
+// Protos/unittest_swift_extension.proto - test proto
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Test handling of extensions to deeply nested messages.
+///
+// -----------------------------------------------------------------------------
+
+syntax = "proto2";
+
+package protobuf_unittest.extend;
+
+message Foo {
+    message Bar {
+        message Baz {
+            optional int32 a = 1;
+            extensions 100 to 1000;
+        }
+    }
+}
+
+extend Foo.Bar.Baz {
+   optional string b = 100;
+   optional group C = 101 {
+      optional int64 c = 999;
+//      extensions 10 to 20;
+   }
+}
+
+/*
+extend Foo.Bar.Baz.C {
+   optional bool d = 12;
+}
+*/

+ 46 - 0
Protos/unittest_swift_fieldorder.proto

@@ -0,0 +1,46 @@
+// Protos/unittest_swift_fieldorder.proto - test proto
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Check that fields get properly ordered when serializing
+///
+// -----------------------------------------------------------------------------
+
+syntax = "proto2";
+
+package swift.protobuf;
+
+message TestFieldOrderings {
+  optional string my_string = 11;
+  extensions 2 to 8;
+  optional int64 my_int = 1;
+  extensions 12 to 55;
+  optional float my_float = 101;
+  message NestedMessage {
+          optional int64 oo = 2;
+          optional int32 bb = 1;
+  }
+
+  oneof options {
+        int64 oneof_int64 = 60;
+        bool oneof_bool = 9;
+        string oneof_string = 150;
+        int32 oneof_int32 = 10;
+  }
+
+  optional NestedMessage optional_nested_message  = 200;
+}
+
+
+extend TestFieldOrderings {
+  optional string my_extension_string = 50;
+  optional int32 my_extension_int = 5;
+}

+ 50 - 0
Protos/unittest_swift_groups.proto

@@ -0,0 +1,50 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+// Same field number appears inside and outside of the group.
+message SwiftTestGroupExtensions {
+  optional int32 a = 1;
+  extensions 2 to 10;
+}
+
+extend SwiftTestGroupExtensions {
+  optional group ExtensionGroup = 2 {
+    optional int32 a = 1;
+  }
+  repeated group RepeatedExtensionGroup = 3 {
+    optional int32 a = 1;
+  }
+}
+
+message SwiftTestGroupUnextended {
+  optional int32 a = 1;
+}

+ 867 - 0
Protos/unittest_swift_naming.proto

@@ -0,0 +1,867 @@
+// Protos/unittest_swift_reserved.proto - test proto
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Test Swift reserved words used as enum or message names
+///
+// -----------------------------------------------------------------------------
+
+syntax = "proto3";
+package swift_unittest.names;
+
+// TODO: Build a MessageNames message with a submessage of every name below
+// TODO: Create tests that access every field, enum, message to verify the name is generated correctly
+
+message FieldNames {
+    int32 String = 1;
+    int32 Int = 2;
+    int32 Double = 3;
+    int32 Float = 4;
+    int32 UInt = 5;
+    int32 hashValue = 6;
+    int32 description = 7;
+    int32 debugDescription = 8;
+    int32 Swift = 9;
+    int32 UNRECOGNIZED = 10;
+    int32 class = 11;
+    int32 deinit = 12;
+    int32 enum = 13;
+    int32 extension = 14;
+    int32 func = 15;
+    int32 import = 16;
+    int32 init = 17;
+    int32 inout = 18;
+    int32 internal = 19;
+    int32 let = 20;
+    int32 operator = 21;
+    int32 private = 22;
+    int32 protocol = 23;
+    int32 public = 24;
+    int32 static = 25;
+    int32 struct = 26;
+    int32 subscript = 27;
+    int32 typealias = 28;
+    int32 var = 29;
+    int32 break = 30;
+    int32 case = 31;
+    int32 continue = 32;
+    int32 default = 33;
+    int32 defer = 34;
+    int32 do = 35;
+    int32 else = 36;
+    int32 fallthrough = 37;
+    int32 for = 38;
+    int32 guard = 39;
+    int32 if = 40;
+    int32 in = 41;
+    int32 repeat = 42;
+    int32 return = 43;
+    int32 switch = 44;
+    int32 where = 45;
+    int32 while = 46;
+    int32 as = 47;
+    int32 catch = 48;
+    int32 dynamicType = 49;
+    int32 false = 50;
+    int32 is = 51;
+    int32 nil = 52;
+    int32 rethrows = 53;
+    int32 super = 54;
+    int32 self = 55;
+    int32 throw = 57;
+    int32 throws = 58;
+    int32 true = 59;
+    int32 try = 60;
+    int32 __COLUMN__ = 61;
+    int32 __FILE__ = 62;
+    int32 __FUNCTION__ = 63;
+    int32 __LINE__ = 64;
+    int32 _ = 65;
+    int32 associativity = 66;
+    int32 convenience = 67;
+    int32 dynamic = 68;
+    int32 didSet = 69;
+    int32 final = 70;
+    int32 get = 71;
+    int32 infix = 72;
+    int32 indirect = 73;
+    int32 lazy = 74;
+    int32 left = 75;
+    int32 mutating = 76;
+    int32 none = 77;
+    int32 nonmutating = 78;
+    int32 optional = 79;
+    int32 override = 80;
+    int32 postfix = 81;
+    int32 precedence = 82;
+    int32 prefix = 83;
+    int32 required = 85;
+    int32 right = 86;
+    int32 set = 87;
+    int32 Type = 88;
+    int32 unowned = 89;
+    int32 weak = 90;
+    int32 willSet = 91;
+    int32 id = 92;
+    int32 _cmd = 93;
+    int32 out = 96;
+    int32 bycopy = 98;
+    int32 byref = 99;
+    int32 oneway = 100;
+    int32 and = 102;
+    int32 and_eq = 103;
+    int32 alignas = 104;
+    int32 alignof = 105;
+    int32 asm = 106;
+    int32 auto = 107;
+    int32 bitand = 108;
+    int32 bitor = 109;
+    int32 bool = 110;
+    int32 char = 114;
+    int32 char16_t = 115;
+    int32 char32_t = 116;
+    int32 compl = 118;
+    int32 const = 119;
+    int32 constexpr = 120;
+    int32 const_cast = 121;
+    int32 decltype = 123;
+    int32 delete = 125;
+    int32 dynamic_cast = 127;
+    int32 explicit = 130;
+    int32 export = 131;
+    int32 extern  = 132;
+    int32 friend = 136;
+    int32 goto = 137;
+    int32 inline = 139;
+    int32 long = 141;
+    int32 mutable = 142;
+    int32 namespace = 143;
+    int32 new = 144;
+    int32 noexcept = 145;
+    int32 not = 146;
+    int32 not_eq = 147;
+    int32 nullptr = 148;
+    int32 or = 150;
+    int32 or_eq = 151;
+    int32 protected = 153;
+    int32 register = 155;
+    int32 reinterpret_cast = 156;
+    int32 short = 158;
+    int32 signed = 159;
+    int32 sizeof = 160;
+    int32 static_assert = 162;
+    int32 static_cast = 163;
+    int32 template = 166;
+    int32 this = 167;
+    int32 thread_local = 168;
+    int32 typedef = 172;
+    int32 typeid = 173;
+    int32 typename = 174;
+    int32 union = 175;
+    int32 unsigned = 176;
+    int32 using = 177;
+    int32 virtual = 178;
+    int32 void = 179;
+    int32 volatile = 180;
+    int32 wchar_t = 181;
+    int32 xor = 183;
+    int32 xor_eq = 184;
+    int32 restrict = 185;
+    int32 Category = 186;
+    int32 Ivar = 187;
+    int32 Method = 188;
+    int32 finalize = 192;
+    int32 hash = 193;
+    int32 dealloc = 194;
+    int32 superclass = 197;
+    int32 retain = 198;
+    int32 release = 199;
+    int32 autorelease = 200;
+    int32 retainCount = 201;
+    int32 zone = 202;
+    int32 isProxy = 203;
+    int32 copy = 204;
+    int32 mutableCopy = 205;
+    int32 classForCoder = 206;
+    int32 clear = 207;
+    int32 data = 208;
+    int32 delimitedData = 209;
+    int32 descriptor = 210;
+    int32 extensionRegistry = 211;
+    int32 extensionsCurrentlySet = 212;
+    int32 isInitialized = 213;
+    int32 serializedSize = 214;
+    int32 sortedExtensionsInUse = 215;
+    int32 unknownFields = 216;
+    int32 Fixed = 217;
+    int32 Fract = 218;
+    int32 Size = 219;
+    int32 LogicalAddress = 220;
+    int32 PhysicalAddress = 221;
+    int32 ByteCount = 222;
+    int32 ByteOffset = 223;
+    int32 Duration = 224;
+    int32 AbsoluteTime = 225;
+    int32 OptionBits = 226;
+    int32 ItemCount = 227;
+    int32 PBVersion = 228;
+    int32 ScriptCode = 229;
+    int32 LangCode = 230;
+    int32 RegionCode = 231;
+    int32 OSType = 232;
+    int32 ProcessSerialNumber = 233;
+    int32 Point = 234;
+    int32 Rect = 235;
+    int32 FixedPoint = 236;
+    int32 FixedRect = 237;
+    int32 Style = 238;
+    int32 StyleParameter = 239;
+    int32 StyleField = 240;
+    int32 TimeScale = 241;
+    int32 TimeBase = 242;
+    int32 TimeRecord = 243;
+}
+
+message MessageNames {
+    message String { int32 a = 1; }
+    message Protocol { int32 a = 1; }
+    message Int { int32 a = 1; }
+    message Double { int32 a = 1; }
+    message Float { int32 a = 1; }
+    message UInt { int32 a = 1; }
+    message hashValue { int32 a = 1; }
+    message description { int32 a = 1; }
+    message debugDescription { int32 a = 1; }
+    message Swift { int32 a = 1; }
+    message UNRECOGNIZED { int32 a = 1; }
+    message class { int32 a = 1; }
+    message deinit { int32 a = 1; }
+    message enum { int32 a = 1; }
+    message extension { int32 a = 1; }
+    message func { int32 a = 1; }
+    message import { int32 a = 1; }
+    message init { int32 a = 1; }
+    message inout { int32 a = 1; }
+    message internal { int32 a = 1; }
+    message let { int32 a = 1; }
+    message operator { int32 a = 1; }
+    message private { int32 a = 1; }
+    message protocol { int32 a = 1; }
+    message public { int32 a = 1; }
+    message static { int32 a = 1; }
+    message struct { int32 a = 1; }
+    message subscript { int32 a = 1; }
+    message typealias { int32 a = 1; }
+    message var { int32 a = 1; }
+    message break { int32 a = 1; }
+    message case { int32 a = 1; }
+    message continue { int32 a = 1; }
+    message default { int32 a = 1; }
+    message defer { int32 a = 1; }
+    message do { int32 a = 1; }
+    message else { int32 a = 1; }
+    message fallthrough { int32 a = 1; }
+    message for { int32 a = 1; }
+    message guard { int32 a = 1; }
+    message if { int32 a = 1; }
+    message in { int32 a = 1; }
+    message repeat { int32 a = 1; }
+    message return { int32 a = 1; }
+    message switch { int32 a = 1; }
+    message where { int32 a = 1; }
+    message while { int32 a = 1; }
+    message as { int32 a = 1; }
+    message catch { int32 a = 1; }
+    message dynamicType { int32 a = 1; }
+    message false { int32 a = 1; }
+    message is { int32 a = 1; }
+    message nil { int32 a = 1; }
+    message rethrows { int32 a = 1; }
+    message super { int32 a = 1; }
+    message self { int32 a = 1; }
+    message throw { int32 a = 1; }
+    message throws { int32 a = 1; }
+    message true { int32 a = 1; }
+    message try { int32 a = 1; }
+    message __COLUMN__ { int32 a = 1; }
+    message __FILE__ { int32 a = 1; }
+    message __FUNCTION__ { int32 a = 1; }
+    message __LINE__ { int32 a = 1; }
+    message _ { int32 a = 1; }
+    message __ { int32 a = 1; }
+    message associativity { int32 a = 1; }
+    message convenience { int32 a = 1; }
+    message dynamic { int32 a = 1; }
+    message didSet { int32 a = 1; }
+    message final { int32 a = 1; }
+    message get { int32 a = 1; }
+    message infix { int32 a = 1; }
+    message indirect { int32 a = 1; }
+    message lazy { int32 a = 1; }
+    message left { int32 a = 1; }
+    message mutating { int32 a = 1; }
+    message none { int32 a = 1; }
+    message nonmutating { int32 a = 1; }
+    message optional { int32 a = 1; }
+    message override { int32 a = 1; }
+    message postfix { int32 a = 1; }
+    message precedence { int32 a = 1; }
+    message prefix { int32 a = 1; }
+    message required { int32 a = 1; }
+    message right { int32 a = 1; }
+    message set { int32 a = 1; }
+    message Type { int32 a = 1; }
+    message unowned { int32 a = 1; }
+    message weak { int32 a = 1; }
+    message willSet { int32 a = 1; }
+    message id { int32 a = 1; }
+    message _cmd { int32 a = 1; }
+    message out { int32 a = 1; }
+    message bycopy { int32 a = 1; }
+    message byref { int32 a = 1; }
+    message oneway { int32 a = 1; }
+    message and { int32 a = 1; }
+    message and_eq { int32 a = 1; }
+    message alignas { int32 a = 1; }
+    message alignof { int32 a = 1; }
+    message asm { int32 a = 1; }
+    message auto { int32 a = 1; }
+    message bitand { int32 a = 1; }
+    message bitor { int32 a = 1; }
+    message bool { int32 a = 1; }
+    message char { int32 a = 1; }
+    message char16_t { int32 a = 1; }
+    message char32_t { int32 a = 1; }
+    message compl { int32 a = 1; }
+    message const { int32 a = 1; }
+    message constexpr { int32 a = 1; }
+    message const_cast { int32 a = 1; }
+    message decltype { int32 a = 1; }
+    message delete { int32 a = 1; }
+    message dynamic_cast { int32 a = 1; }
+    message explicit { int32 a = 1; }
+    message export { int32 a = 1; }
+    message extern  { int32 a = 1; }
+    message friend { int32 a = 1; }
+    message goto { int32 a = 1; }
+    message inline { int32 a = 1; }
+    message long { int32 a = 1; }
+    message mutable { int32 a = 1; }
+    message namespace { int32 a = 1; }
+    message new { int32 a = 1; }
+    message noexcept { int32 a = 1; }
+    message not { int32 a = 1; }
+    message not_eq { int32 a = 1; }
+    message nullptr { int32 a = 1; }
+    message or { int32 a = 1; }
+    message or_eq { int32 a = 1; }
+    message protected { int32 a = 1; }
+    message register { int32 a = 1; }
+    message reinterpret_cast { int32 a = 1; }
+    message short { int32 a = 1; }
+    message signed { int32 a = 1; }
+    message sizeof { int32 a = 1; }
+    message static_assert { int32 a = 1; }
+    message static_cast { int32 a = 1; }
+    message template { int32 a = 1; }
+    message this { int32 a = 1; }
+    message thread_local { int32 a = 1; }
+    message typedef { int32 a = 1; }
+    message typeid { int32 a = 1; }
+    message typename { int32 a = 1; }
+    message union { int32 a = 1; }
+    message unsigned { int32 a = 1; }
+    message using { int32 a = 1; }
+    message virtual { int32 a = 1; }
+    message void { int32 a = 1; }
+    message volatile { int32 a = 1; }
+    message wchar_t { int32 a = 1; }
+    message xor { int32 a = 1; }
+    message xor_eq { int32 a = 1; }
+    message restrict { int32 a = 1; }
+    message Category { int32 a = 1; }
+    message Ivar { int32 a = 1; }
+    message Method { int32 a = 1; }
+    message finalize { int32 a = 1; }
+    message hash { int32 a = 1; }
+    message dealloc { int32 a = 1; }
+    message superclass { int32 a = 1; }
+    message retain { int32 a = 1; }
+    message release { int32 a = 1; }
+    message autorelease { int32 a = 1; }
+    message retainCount { int32 a = 1; }
+    message zone { int32 a = 1; }
+    message isProxy { int32 a = 1; }
+    message copy { int32 a = 1; }
+    message mutableCopy { int32 a = 1; }
+    message classForCoder { int32 a = 1; }
+    message clear { int32 a = 1; }
+    message data { int32 a = 1; }
+    message delimitedData { int32 a = 1; }
+    message descriptor { int32 a = 1; }
+    message extensionRegistry { int32 a = 1; }
+    message extensionsCurrentlySet { int32 a = 1; }
+    message isInitialized { int32 a = 1; }
+    message serializedSize { int32 a = 1; }
+    message sortedExtensionsInUse { int32 a = 1; }
+    message unknownFields { int32 a = 1; }
+    message Fixed { int32 a = 1; }
+    message Fract { int32 a = 1; }
+    message Size { int32 a = 1; }
+    message LogicalAddress { int32 a = 1; }
+    message PhysicalAddress { int32 a = 1; }
+    message ByteCount { int32 a = 1; }
+    message ByteOffset { int32 a = 1; }
+    message Duration { int32 a = 1; }
+    message AbsoluteTime { int32 a = 1; }
+    message OptionBits { int32 a = 1; }
+    message ItemCount { int32 a = 1; }
+    message PBVersion { int32 a = 1; }
+    message ScriptCode { int32 a = 1; }
+    message LangCode { int32 a = 1; }
+    message RegionCode { int32 a = 1; }
+    message OSType { int32 a = 1; }
+    message ProcessSerialNumber { int32 a = 1; }
+    message Point { int32 a = 1; }
+    message Rect { int32 a = 1; }
+    message FixedPoint { int32 a = 1; }
+    message FixedRect { int32 a = 1; }
+    message Style { int32 a = 1; }
+    message StyleParameter { int32 a = 1; }
+    message StyleField { int32 a = 1; }
+    message TimeScale { int32 a = 1; }
+    message TimeBase { int32 a = 1; }
+    message TimeRecord { int32 a = 1; }
+}
+
+message EnumNames {
+    enum String { aString = 0; }
+    enum Protocol { aProtocol = 0; }
+    enum Int { aInt = 0; }
+    enum Double { aDouble = 0; }
+    enum Float { aFloat = 0; }
+    enum UInt { aUInt = 0; }
+    enum hashValue { ahashValue = 0; }
+    enum description { adescription = 0; }
+    enum debugDescription { adebugDescription = 0; }
+    enum Swift { aSwift = 0; }
+    enum UNRECOGNIZED { aUNRECOGNIZED = 0; }
+    enum class { aclass = 0; }
+    enum deinit { adeinit = 0; }
+    enum enum { aenum = 0; }
+    enum extension { aextension = 0; }
+    enum func { afunc = 0; }
+    enum import { aimport = 0; }
+    enum init { ainit = 0; }
+    enum inout { ainout = 0; }
+    enum internal { ainternal = 0; }
+    enum let { alet = 0; }
+    enum operator { aoperator = 0; }
+    enum private { aprivate = 0; }
+    enum protocol { aprotocol = 0; }
+    enum public { apublic = 0; }
+    enum static { astatic = 0; }
+    enum struct { astruct = 0; }
+    enum subscript { asubscript = 0; }
+    enum typealias { atypealias = 0; }
+    enum var { avar = 0; }
+    enum break { abreak = 0; }
+    enum case { acase = 0; }
+    enum continue { acontinue = 0; }
+    enum default { adefault = 0; }
+    enum defer { adefer = 0; }
+    enum do { ado = 0; }
+    enum else { aelse = 0; }
+    enum fallthrough { afallthrough = 0; }
+    enum for { afor = 0; }
+    enum guard { aguard = 0; }
+    enum if { aif = 0; }
+    enum in { ain = 0; }
+    enum repeat { arepeat = 0; }
+    enum return { areturn = 0; }
+    enum switch { aswitch = 0; }
+    enum where { awhere = 0; }
+    enum while { awhile = 0; }
+    enum as { aas = 0; }
+    enum catch { acatch = 0; }
+    enum dynamicType { adynamicType = 0; }
+    enum false { afalse = 0; }
+    enum is { ais = 0; }
+    enum nil { anil = 0; }
+    enum rethrows { arethrows = 0; }
+    enum super { asuper = 0; }
+    enum self { aself = 0; }
+    enum throw { athrow = 0; }
+    enum throws { athrows = 0; }
+    enum true { atrue = 0; }
+    enum try { atry = 0; }
+    enum __COLUMN__ { a__COLUMN__ = 0; }
+    enum __FILE__ { a__FILE__ = 0; }
+    enum __FUNCTION__ { a__FUNCTION__ = 0; }
+    enum __LINE__ { a__LINE__ = 0; }
+    enum _ { a_ = 0; }
+    enum __ { a__ = 0; }
+    enum associativity { aassociativity = 0; }
+    enum convenience { aconvenience = 0; }
+    enum dynamic { adynamic = 0; }
+    enum didSet { adidSet = 0; }
+    enum final { afinal = 0; }
+    enum get { aget = 0; }
+    enum infix { ainfix = 0; }
+    enum indirect { aindirect = 0; }
+    enum lazy { alazy = 0; }
+    enum left { aleft = 0; }
+    enum mutating { amutating = 0; }
+    enum none { anone = 0; }
+    enum nonmutating { anonmutating = 0; }
+    enum optional { aoptional = 0; }
+    enum override { aoverride = 0; }
+    enum postfix { apostfix = 0; }
+    enum precedence { aprecedence = 0; }
+    enum prefix { aprefix = 0; }
+    enum required { arequired = 0; }
+    enum right { aright = 0; }
+    enum set { aset = 0; }
+    enum Type { aType = 0; }
+    enum unowned { aunowned = 0; }
+    enum weak { aweak = 0; }
+    enum willSet { awillSet = 0; }
+    enum id { aid = 0; }
+    enum _cmd { a_cmd = 0; }
+    enum out { aout = 0; }
+    enum bycopy { abycopy = 0; }
+    enum byref { abyref = 0; }
+    enum oneway { aoneway = 0; }
+    enum and { aand = 0; }
+    enum and_eq { aand_eq = 0; }
+    enum alignas { aalignas = 0; }
+    enum alignof { aalignof = 0; }
+    enum asm { aasm = 0; }
+    enum auto { aauto = 0; }
+    enum bitand { abitand = 0; }
+    enum bitor { abitor = 0; }
+    enum bool { abool = 0; }
+    enum char { achar = 0; }
+    enum char16_t { achar16_t = 0; }
+    enum char32_t { achar32_t = 0; }
+    enum compl { acompl = 0; }
+    enum const { aconst = 0; }
+    enum constexpr { aconstexpr = 0; }
+    enum const_cast { aconst_cast = 0; }
+    enum decltype { adecltype = 0; }
+    enum delete { adelete = 0; }
+    enum dynamic_cast { adynamic_cast = 0; }
+    enum explicit { aexplicit = 0; }
+    enum export { aexport = 0; }
+    enum extern  { aextern  = 0; }
+    enum friend { afriend = 0; }
+    enum goto { agoto = 0; }
+    enum inline { ainline = 0; }
+    enum long { along = 0; }
+    enum mutable { amutable = 0; }
+    enum namespace { anamespace = 0; }
+    enum new { anew = 0; }
+    enum noexcept { anoexcept = 0; }
+    enum not { anot = 0; }
+    enum not_eq { anot_eq = 0; }
+    enum nullptr { anullptr = 0; }
+    enum or { aor = 0; }
+    enum or_eq { aor_eq = 0; }
+    enum protected { aprotected = 0; }
+    enum register { aregister = 0; }
+    enum reinterpret_cast { areinterpret_cast = 0; }
+    enum short { ashort = 0; }
+    enum signed { asigned = 0; }
+    enum sizeof { asizeof = 0; }
+    enum static_assert { astatic_assert = 0; }
+    enum static_cast { astatic_cast = 0; }
+    enum template { atemplate = 0; }
+    enum this { athis = 0; }
+    enum thread_local { athread_local = 0; }
+    enum typedef { atypedef = 0; }
+    enum typeid { atypeid = 0; }
+    enum typename { atypename = 0; }
+    enum union { aunion = 0; }
+    enum unsigned { aunsigned = 0; }
+    enum using { ausing = 0; }
+    enum virtual { avirtual = 0; }
+    enum void { avoid = 0; }
+    enum volatile { avolatile = 0; }
+    enum wchar_t { awchar_t = 0; }
+    enum xor { axor = 0; }
+    enum xor_eq { axor_eq = 0; }
+    enum restrict { arestrict = 0; }
+    enum Category { aCategory = 0; }
+    enum Ivar { aIvar = 0; }
+    enum Method { aMethod = 0; }
+    enum finalize { afinalize = 0; }
+    enum hash { ahash = 0; }
+    enum dealloc { adealloc = 0; }
+    enum superclass { asuperclass = 0; }
+    enum retain { aretain = 0; }
+    enum release { arelease = 0; }
+    enum autorelease { aautorelease = 0; }
+    enum retainCount { aretainCount = 0; }
+    enum zone { azone = 0; }
+    enum isProxy { aisProxy = 0; }
+    enum copy { acopy = 0; }
+    enum mutableCopy { amutableCopy = 0; }
+    enum classForCoder { aclassForCoder = 0; }
+    enum clear { aclear = 0; }
+    enum data { adata = 0; }
+    enum delimitedData { adelimitedData = 0; }
+    enum descriptor { adescriptor = 0; }
+    enum extensionRegistry { aextensionRegistry = 0; }
+    enum extensionsCurrentlySet { aextensionsCurrentlySet = 0; }
+    enum isInitialized { aisInitialized = 0; }
+    enum serializedSize { aserializedSize = 0; }
+    enum sortedExtensionsInUse { asortedExtensionsInUse = 0; }
+    enum unknownFields { aunknownFields = 0; }
+    enum Fixed { aFixed = 0; }
+    enum Fract { aFract = 0; }
+    enum Size { aSize = 0; }
+    enum LogicalAddress { aLogicalAddress = 0; }
+    enum PhysicalAddress { aPhysicalAddress = 0; }
+    enum ByteCount { aByteCount = 0; }
+    enum ByteOffset { aByteOffset = 0; }
+    enum Duration { aDuration = 0; }
+    enum AbsoluteTime { aAbsoluteTime = 0; }
+    enum OptionBits { aOptionBits = 0; }
+    enum ItemCount { aItemCount = 0; }
+    enum PBVersion { aPBVersion = 0; }
+    enum ScriptCode { aScriptCode = 0; }
+    enum LangCode { aLangCode = 0; }
+    enum RegionCode { aRegionCode = 0; }
+    enum OSType { aOSType = 0; }
+    enum ProcessSerialNumber { aProcessSerialNumber = 0; }
+    enum Point { aPoint = 0; }
+    enum Rect { aRect = 0; }
+    enum FixedPoint { aFixedPoint = 0; }
+    enum FixedRect { aFixedRect = 0; }
+    enum Style { aStyle = 0; }
+    enum StyleParameter { aStyleParameter = 0; }
+    enum StyleField { aStyleField = 0; }
+    enum TimeScale { aTimeScale = 0; }
+    enum TimeBase { aTimeBase = 0; }
+    enum TimeRecord { aTimeRecord = 0; }
+}
+
+enum EnumFieldNames {
+    A = 0;
+    String = 1;
+    Int = 2;
+    Double = 3;
+    Float = 4;
+    UInt = 5;
+    hashValue = 6;
+    description = 7;
+    debugDescription = 8;
+    Swift = 9;
+    UNRECOGNIZED = 10;
+    class = 11;
+    deinit = 12;
+    enum = 13;
+    extension = 14;
+    func = 15;
+    import = 16;
+    init = 17;
+    inout = 18;
+    internal = 19;
+    let = 20;
+    operator = 21;
+    private = 22;
+    protocol = 23;
+    public = 24;
+    static = 25;
+    struct = 26;
+    subscript = 27;
+    typealias = 28;
+    var = 29;
+    break = 30;
+    case = 31;
+    continue = 32;
+    default = 33;
+    defer = 34;
+    do = 35;
+    else = 36;
+    fallthrough = 37;
+    for = 38;
+    guard = 39;
+    if = 40;
+    in = 41;
+    repeat = 42;
+    return = 43;
+    switch = 44;
+    where = 45;
+    while = 46;
+    as = 47;
+    catch = 48;
+    dynamicType = 49;
+    false = 50;
+    is = 51;
+    nil = 52;
+    rethrows = 53;
+    super = 54;
+    self = 55;
+    throw = 57;
+    throws = 58;
+    true = 59;
+    try = 60;
+    __COLUMN__ = 61;
+    __FILE__ = 62;
+    __FUNCTION__ = 63;
+    __LINE__ = 64;
+    _ = 65;
+    __ = 1065;
+    associativity = 66;
+    convenience = 67;
+    dynamic = 68;
+    didSet = 69;
+    final = 70;
+    get = 71;
+    infix = 72;
+    indirect = 73;
+    lazy = 74;
+    left = 75;
+    mutating = 76;
+    none = 77;
+    nonmutating = 78;
+    optional = 79;
+    override = 80;
+    postfix = 81;
+    precedence = 82;
+    prefix = 83;
+    required = 85;
+    right = 86;
+    set = 87;
+    Type = 88;
+    unowned = 89;
+    weak = 90;
+    willSet = 91;
+    id = 92;
+    _cmd = 93;
+    out = 96;
+    bycopy = 98;
+    byref = 99;
+    oneway = 100;
+    and = 102;
+    and_eq = 103;
+    alignas = 104;
+    alignof = 105;
+    asm = 106;
+    auto = 107;
+    bitand = 108;
+    bitor = 109;
+    bool = 110;
+    char = 114;
+    char16_t = 115;
+    char32_t = 116;
+    compl = 118;
+    const = 119;
+    constexpr = 120;
+    const_cast = 121;
+    decltype = 123;
+    delete = 125;
+    dynamic_cast = 127;
+    explicit = 130;
+    export = 131;
+    extern  = 132;
+    friend = 136;
+    goto = 137;
+    inline = 139;
+    long = 141;
+    mutable = 142;
+    namespace = 143;
+    new = 144;
+    noexcept = 145;
+    not = 146;
+    not_eq = 147;
+    nullptr = 148;
+    or = 150;
+    or_eq = 151;
+    protected = 153;
+    register = 155;
+    reinterpret_cast = 156;
+    short = 158;
+    signed = 159;
+    sizeof = 160;
+    static_assert = 162;
+    static_cast = 163;
+    template = 166;
+    this = 167;
+    thread_local = 168;
+    typedef = 172;
+    typeid = 173;
+    typename = 174;
+    union = 175;
+    unsigned = 176;
+    using = 177;
+    virtual = 178;
+    void = 179;
+    volatile = 180;
+    wchar_t = 181;
+    xor = 183;
+    xor_eq = 184;
+    restrict = 185;
+    Category = 186;
+    Ivar = 187;
+    Method = 188;
+    finalize = 192;
+    hash = 193;
+    dealloc = 194;
+    superclass = 197;
+    retain = 198;
+    release = 199;
+    autorelease = 200;
+    retainCount = 201;
+    zone = 202;
+    isProxy = 203;
+    copy = 204;
+    mutableCopy = 205;
+    classForCoder = 206;
+    clear = 207;
+    data = 208;
+    delimitedData = 209;
+    descriptor = 210;
+    extensionRegistry = 211;
+    extensionsCurrentlySet = 212;
+    isInitialized = 213;
+    serializedSize = 214;
+    sortedExtensionsInUse = 215;
+    unknownFields = 216;
+    Fixed = 217;
+    Fract = 218;
+    Size = 219;
+    LogicalAddress = 220;
+    PhysicalAddress = 221;
+    ByteCount = 222;
+    ByteOffset = 223;
+    Duration = 224;
+    AbsoluteTime = 225;
+    OptionBits = 226;
+    ItemCount = 227;
+    PBVersion = 228;
+    ScriptCode = 229;
+    LangCode = 230;
+    RegionCode = 231;
+    OSType = 232;
+    ProcessSerialNumber = 233;
+    Point = 234;
+    Rect = 235;
+    FixedPoint = 236;
+    FixedRect = 237;
+    Style = 238;
+    StyleParameter = 239;
+    StyleField = 240;
+    TimeScale = 241;
+    TimeBase = 242;
+    TimeRecord = 243;
+}

+ 73 - 0
Protos/unittest_swift_performance.proto

@@ -0,0 +1,73 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+package swift.performance;
+
+message TestAllTypes {
+  // One of every singular field type
+  int32 optional_int32    =  1;
+  int64 optional_int64    =  2;
+  uint32 optional_uint32   =  3;
+  uint64 optional_uint64   =  4;
+  sint32 optional_sint32   =  5;
+  sint64 optional_sint64   =  6;
+  fixed32 optional_fixed32  =  7;
+  fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+  float optional_float    = 11;
+  double optional_double   = 12;
+  bool optional_bool     = 13;
+  string optional_string   = 14;
+  bytes optional_bytes    = 15;
+
+  repeated TestAllTypes repeated_recursive_message = 27;
+
+  // Repeated
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+
+  // Map
+  map <  string, TestAllTypes>  map_string_message = 71;
+}

+ 36 - 0
Protos/unittest_swift_reserved.proto

@@ -0,0 +1,36 @@
+// Protos/unittest_swift_reserved.proto - test proto
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Test Swift reserved words used as enum or message names
+///
+// -----------------------------------------------------------------------------
+
+syntax = "proto2";
+
+package protobuf_unittest;
+
+message SwiftReservedTest {
+    enum Enum {
+        DOUBLE = 1;
+        JSON = 2;
+        CLASS = 3;
+        _ = 4;
+        SELF = 5;
+        TYPE = 6;
+    }
+
+    enum Protocol { a = 1; }
+
+    message class {}
+    message Type {}
+    message isEqual {}
+}

+ 128 - 0
Protos/unittest_swift_runtime_proto2.proto

@@ -0,0 +1,128 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc.  All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package protobuf_unittest;
+
+message Message2 {
+  enum Enum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+    EXTRA_2 = 20;
+  }
+
+  optional    int32 optional_int32    =  1;
+  optional    int64 optional_int64    =  2;
+  optional   uint32 optional_uint32   =  3;
+  optional   uint64 optional_uint64   =  4;
+  optional   sint32 optional_sint32   =  5;
+  optional   sint64 optional_sint64   =  6;
+  optional  fixed32 optional_fixed32  =  7;
+  optional  fixed64 optional_fixed64  =  8;
+  optional sfixed32 optional_sfixed32 =  9;
+  optional sfixed64 optional_sfixed64 = 10;
+  optional    float optional_float    = 11;
+  optional   double optional_double   = 12;
+  optional     bool optional_bool     = 13;
+  optional   string optional_string   = 14;
+  optional    bytes optional_bytes    = 15;
+  optional group OptionalGroup = 16 {
+    optional int32 a = 17;
+  }
+  optional Message2  optional_message = 18;
+  optional Enum         optional_enum = 19;
+
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+  repeated group RepeatedGroup = 46 {
+    optional int32 a = 47;
+  }
+  repeated Message2 repeated_message  = 48;
+  repeated Enum     repeated_enum     = 49;
+
+  oneof o {
+       int32 oneof_int32    = 51 [default = 100];
+       int64 oneof_int64    = 52 [default = 101];
+      uint32 oneof_uint32   = 53 [default = 102];
+      uint64 oneof_uint64   = 54 [default = 103];
+      sint32 oneof_sint32   = 55 [default = 104];
+      sint64 oneof_sint64   = 56 [default = 105];
+     fixed32 oneof_fixed32  = 57 [default = 106];
+     fixed64 oneof_fixed64  = 58 [default = 107];
+    sfixed32 oneof_sfixed32 = 59 [default = 108];
+    sfixed64 oneof_sfixed64 = 60 [default = 109];
+       float oneof_float    = 61 [default = 110];
+      double oneof_double   = 62 [default = 111];
+        bool oneof_bool     = 63 [default = true];
+      string oneof_string   = 64 [default = "string"];
+       bytes oneof_bytes    = 65 [default = "data"];
+       group OneofGroup     = 66 {
+         optional int32 a = 67;
+         optional int32 b = 167;
+       }
+     Message2 oneof_message = 68;
+     Enum        oneof_enum = 69 [default = BAZ];
+  }
+
+  // Some token map cases, too many combinations to list them all.
+  map<int32   , int32   > map_int32_int32       = 70;
+  map<int64   , int64   > map_int64_int64       = 71;
+  map<uint32  , uint32  > map_uint32_uint32     = 72;
+  map<uint64  , uint64  > map_uint64_uint64     = 73;
+  map<sint32  , sint32  > map_sint32_sint32     = 74;
+  map<sint64  , sint64  > map_sint64_sint64     = 75;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 76;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 77;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 78;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 79;
+  map<int32   , float   > map_int32_float       = 80;
+  map<int32   , double  > map_int32_double      = 81;
+  map<bool    , bool    > map_bool_bool         = 82;
+  map<string  , string  > map_string_string     = 83;
+  map<string  , bytes   > map_string_bytes      = 84;
+  map<string  , Message2> map_string_message    = 85;
+  map<int32   , bytes   > map_int32_bytes       = 86;
+  map<int32   , Enum    > map_int32_enum        = 87;
+  map<int32   , Message2> map_int32_message     = 88;
+}

+ 121 - 0
Protos/unittest_swift_runtime_proto3.proto

@@ -0,0 +1,121 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc.  All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto3";
+
+package protobuf_unittest;
+
+message Message3 {
+  enum Enum {
+    FOO = 0;
+    BAR = 1;
+    BAZ = 2;
+    EXTRA_3 = 30;
+  }
+
+     int32 optional_int32    =  1;
+     int64 optional_int64    =  2;
+    uint32 optional_uint32   =  3;
+    uint64 optional_uint64   =  4;
+    sint32 optional_sint32   =  5;
+    sint64 optional_sint64   =  6;
+   fixed32 optional_fixed32  =  7;
+   fixed64 optional_fixed64  =  8;
+  sfixed32 optional_sfixed32 =  9;
+  sfixed64 optional_sfixed64 = 10;
+     float optional_float    = 11;
+    double optional_double   = 12;
+      bool optional_bool     = 13;
+    string optional_string   = 14;
+     bytes optional_bytes    = 15;
+  // No 'group' in proto3.
+  Message3 optional_message  = 18;
+      Enum optional_enum     = 19;
+
+  repeated    int32 repeated_int32    = 31;
+  repeated    int64 repeated_int64    = 32;
+  repeated   uint32 repeated_uint32   = 33;
+  repeated   uint64 repeated_uint64   = 34;
+  repeated   sint32 repeated_sint32   = 35;
+  repeated   sint64 repeated_sint64   = 36;
+  repeated  fixed32 repeated_fixed32  = 37;
+  repeated  fixed64 repeated_fixed64  = 38;
+  repeated sfixed32 repeated_sfixed32 = 39;
+  repeated sfixed64 repeated_sfixed64 = 40;
+  repeated    float repeated_float    = 41;
+  repeated   double repeated_double   = 42;
+  repeated     bool repeated_bool     = 43;
+  repeated   string repeated_string   = 44;
+  repeated    bytes repeated_bytes    = 45;
+  // No 'group' in proto3.
+  repeated Message3 repeated_message  = 48;
+  repeated     Enum repeated_enum     = 49;
+
+  oneof o {
+       int32 oneof_int32    = 51;
+       int64 oneof_int64    = 52;
+      uint32 oneof_uint32   = 53;
+      uint64 oneof_uint64   = 54;
+      sint32 oneof_sint32   = 55;
+      sint64 oneof_sint64   = 56;
+     fixed32 oneof_fixed32  = 57;
+     fixed64 oneof_fixed64  = 58;
+    sfixed32 oneof_sfixed32 = 59;
+    sfixed64 oneof_sfixed64 = 60;
+       float oneof_float    = 61;
+      double oneof_double   = 62;
+        bool oneof_bool     = 63;
+      string oneof_string   = 64;
+       bytes oneof_bytes    = 65;
+    // No 'group' in proto3.
+    Message3 oneof_message  = 68;
+        Enum oneof_enum     = 69;
+  }
+
+  // Some token map cases, too many combinations to list them all.
+  map<int32   , int32   > map_int32_int32       = 70;
+  map<int64   , int64   > map_int64_int64       = 71;
+  map<uint32  , uint32  > map_uint32_uint32     = 72;
+  map<uint64  , uint64  > map_uint64_uint64     = 73;
+  map<sint32  , sint32  > map_sint32_sint32     = 74;
+  map<sint64  , sint64  > map_sint64_sint64     = 75;
+  map<fixed32 , fixed32 > map_fixed32_fixed32   = 76;
+  map<fixed64 , fixed64 > map_fixed64_fixed64   = 77;
+  map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 78;
+  map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 79;
+  map<int32   , float   > map_int32_float       = 80;
+  map<int32   , double  > map_int32_double      = 81;
+  map<bool    , bool    > map_bool_bool         = 82;
+  map<string  , string  > map_string_string     = 83;
+  map<string  , bytes   > map_string_bytes      = 84;
+  map<string  , Message3> map_string_message    = 85;
+  map<int32   , bytes   > map_int32_bytes       = 86;
+  map<int32   , Enum    > map_int32_enum        = 87;
+  map<int32   , Message3> map_int32_message     = 88;
+}

+ 49 - 0
Protos/unittest_swift_startup.proto

@@ -0,0 +1,49 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+syntax = "proto2";
+
+package protobuf_objc_unittest;
+
+message TestObjCStartupMessage {
+  extensions 1 to max;
+}
+
+extend TestObjCStartupMessage {
+  // Singular
+  optional    int32 optional_int32_extension    = 1;
+  repeated    int32 repeated_int32_extension    = 2;
+}
+
+message TestObjCStartupNested {
+  extend TestObjCStartupMessage {
+    optional string nested_string_extension = 3;
+  }
+}

+ 54 - 0
README.md

@@ -0,0 +1,54 @@
+<img src="https://swift.org/assets/images/swift.svg" alt="Swift logo" height="70" >
+# Swift Protobuf Runtime Library
+
+**Welcome to Swift Protobuf!**
+
+Apple's Swift programming language is a perfect complement to Google's Protocol
+Buffer serialization technology.  They both emphasize high performance
+and programmer safety.
+
+This project provides the runtime library that is necessary for using
+code generated by the protoc Swift plugin.  After using the protoc
+plugin to generate Swift code from your .proto files, you will need to
+add this library to your project.
+
+For more information about Swift Protobuf, please look at:
+* [Swift Protobuf code generator plugin](https://github.com/apple/swift-protobuf-plugin)
+* [Swift Protobuf Conformance Checker](https://github.com/apple/swift-protobuf-test-conformance)
+
+## Using the library with `swift build`
+
+If you are using the Swift Package Manager, this only requires adding one dependency to your Package.swift file:
+
+```
+dependencies: [
+  .Package(url: "https://github.com/apple/swift-protobuf-runtime.git",
+           Version(0,9,12))
+]
+```
+
+To make sure you are using the correct library version here, run
+protoc-gen-swift with the --version option:
+
+```
+$ protoc-gen-swift --version
+protoc-gen-swift 0.9.12
+```
+
+You should use the version of the swift-protobuf-runtime library that
+matches your protoc-gen-swift plugin.
+
+## Using the library with Xcode
+
+If you are using Xcode, then you should:
+* Add the Swift source files generated from your protos directly to your project
+* Add the Protobuf target from the Xcode project in this package to your project.
+
+## Report any issues
+
+If you run into problems, please send us a detailed report.  At a minimum, please include:
+* The specific operating system and version (for example, "macOS 10.12.1" or "Ubuntu 15.10")
+* The version of Swift you have installed (from `swift --version`)
+* The version of the protoc compiler you are working with from `protoc --version`
+* The specific version of this source code (you can use `git log -1` to get the latest commit ID)
+* Any local changes you may have

+ 479 - 0
Sources/Protobuf/Google_Protobuf_Any.swift

@@ -0,0 +1,479 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_Any.swift - Well-known Any type
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// This is pretty much completely hand-built.
+///
+/// Generating it from any.proto -- even just partially -- is
+/// probably not feasible.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+fileprivate func typeName(fromURL s: String) -> String {
+    var typeStart = s.startIndex
+    var i = typeStart
+    while i < s.endIndex {
+        let c = s[i]
+        i = s.index(after: i)
+        if c == "/" {
+            typeStart = i
+        }
+    }
+
+    return s[typeStart..<s.endIndex]
+}
+
+fileprivate func typeName(fromMessage message: ProtobufMessage) -> String {
+    if message.protoPackageName == "" {
+        return message.protoMessageName
+    } else {
+        return "\(message.protoPackageName).\(message.protoMessageName)"
+    }
+}
+
+
+///   `Any` contains an arbitrary serialized message along with a URL
+///   that describes the type of the serialized message.
+///
+///   JSON
+///   ====
+///   The JSON representation of an `Any` value uses the regular
+///   representation of the deserialized, embedded message, with an
+///   additional field `@type` which contains the type URL. Example:
+///
+///       package google.profile;
+///       message Person {
+///         string first_name = 1;
+///         string last_name = 2;
+///       }
+///
+///       {
+///         "@type": "type.googleapis.com/google.profile.Person",
+///         "firstName": <string>,
+///         "lastName": <string>
+///       }
+///
+///   If the embedded message type is well-known and has a custom JSON
+///   representation, that representation will be embedded adding a field
+///   `value` which holds the custom JSON in addition to the the `@type`
+///   field. Example (for message [google.protobuf.Duration][google.protobuf.Duration]):
+///
+///       {
+///         "@type": "type.googleapis.com/google.protobuf.Duration",
+///         "value": "1.212s"
+///       }
+///
+/// Swift implementation details
+/// ============================
+///
+/// Internally, the Google_Protobuf_Any holds either a
+/// message struct, a protobuf-serialized bytes value, or a collection
+/// of JSON fields.
+///
+/// If you create a Google_Protobuf_Any(message:) then the object will
+/// keep a copy of the provided message.  When the Any itself is later
+/// serialized, the message will be inspected to correctly serialize
+/// the Any to protobuf or JSON as appropriate.
+///
+/// If you deserialize a Google_Protobuf_Any() from protobuf, then it will
+/// contain a protobuf-serialized form of the contained object.  This will
+/// in turn be deserialized only when you use the unpackTo() method.
+///
+/// If you deserialize a Google_Protobuf_Any() from JSON, then it will
+/// contain a set of partially-decoded JSON fields.  These will
+/// be fully deserialized when you use the unpackTo() method.
+///
+/// Note that deserializing from protobuf and reserializing back to
+/// protobuf (or JSON-to-JSON) is efficient and well-supported.
+/// However, deserializing from protobuf and reserializing to JSON
+/// (or vice versa) is much more complicated:
+///   * Well-known types are automatically detected and handled as
+///     if the Any field were deserialized to the in-memory form
+///     and then serialized back out again.
+///   * You can register your message types via Google_Protobuf_Any.register().
+///     Such types will be automatically handled as above.
+///   * Someday, there will be a mechanism for you to provide
+///     Type descriptors (which might be fetched from a remote server
+///     on-demand).
+///
+/// In particular, note that it is not possible to decode a google.protobuf.Any
+/// field in a protobuf message and then recode to JSON (or vice versa)
+/// without having the type information available.  This is a basic
+/// limitation of Google's spec for google.protobuf.Any.
+///
+public struct Google_Protobuf_Any: ProtobufAbstractMessage, Hashable, Equatable, CustomReflectable {
+    public var swiftClassName: String {return "Google_Protobuf_Any"}
+    public var protoPackageName: String {return "google.protobuf"}
+    public var protoMessageName: String {return "Any"}
+    public var jsonFieldNames: [String:Int] {return ["@type":1,"value":2]}
+    public var protoFieldNames: [String:Int] {return ["type_url":1,"value":2]}
+    
+    ///   A URL/resource name whose content describes the type of the
+    ///   serialized message.
+    ///
+    ///   For URLs which use the schema `http`, `https`, or no schema, the
+    ///   following restrictions and interpretations apply:
+    ///
+    ///   * If no schema is provided, `https` is assumed.
+    ///   * The last segment of the URL's path must represent the fully
+    ///     qualified name of the type (as in `path/google.protobuf.Duration`).
+    ///   * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type]
+    ///     value in binary format, or produce an error.
+    ///   * Applications are allowed to cache lookup results based on the
+    ///     URL, or have them precompiled into a binary to avoid any
+    ///     lookup. Therefore, binary compatibility needs to be preserved
+    ///     on changes to types. (Use versioned type names to manage
+    ///     breaking changes.)
+    ///
+    ///   Schemas other than `http`, `https` (or the empty schema) might be
+    ///   used with implementation specific semantics.
+    public var typeURL: String?
+
+    ///   Must be valid serialized data of the above specified type.
+    public var value: [UInt8]? {
+        get {
+            if let value = _value {
+                return value
+            } else if let message = _message {
+                do {
+                    return try message.serializeProtobuf()
+                } catch {
+                    return nil
+                }
+            } else if let _ = _jsonFields, let typeURL = typeURL {
+                // Transcode JSON-to-protobuf by decoding/recoding:
+                // Well-known types are always available:
+                let encodedTypeName = typeName(fromURL: typeURL)
+                if let messageType = Google_Protobuf_Any.wellKnownTypes[encodedTypeName] {
+                    do {
+                        let m = try messageType.init(any: self)
+                        return try m.serializeProtobuf()
+                    } catch {
+                        return nil
+                    }
+                }
+                // See if the user has registered the type:
+                if let messageType = Google_Protobuf_Any.knownTypes[encodedTypeName] {
+                    do {
+                        let m = try messageType.init(any: self)
+                        return try m.serializeProtobuf()
+                    } catch {
+                        return nil
+                    }
+                }
+                // TODO: Google spec requires a lot more work in the general case:
+                // let encodedType = ... fetch google.protobuf.Type based on typeURL ...
+                // let type = Google_Protobuf_Type(protobuf: encodedType)
+                // return ProtobufDynamic(type: type, any: self)?.serializeProtobuf()
+
+                // See the comments in serializeJSON() above for more discussion of what would be needed to fully implement this.
+                return nil
+            } else {
+                return nil
+            }
+        }
+        set {
+            _value = newValue
+            _message = nil
+            _jsonFields = nil
+        }
+    }
+    private var _value: [UInt8]?
+
+    private var _message: ProtobufMessage?
+    private var _jsonFields: [String:[ProtobufJSONToken]]?
+
+    static private var wellKnownTypes: [String:ProtobufMessage.Type] = [
+        "google.protobuf.Any": Google_Protobuf_Any.self,
+        "google.protobuf.BoolValue": Google_Protobuf_BoolValue.self,
+        "google.protobuf.BytesValue": Google_Protobuf_BytesValue.self,
+        "google.protobuf.DoubleValue": Google_Protobuf_DoubleValue.self,
+        "google.protobuf.Duration": Google_Protobuf_Duration.self,
+        "google.protobuf.FieldMask": Google_Protobuf_FieldMask.self,
+        "google.protobuf.FloatValue": Google_Protobuf_FloatValue.self,
+        "google.protobuf.Int32Value": Google_Protobuf_Int32Value.self,
+        "google.protobuf.Int64Value": Google_Protobuf_Int64Value.self,
+        "google.protobuf.ListValue": Google_Protobuf_ListValue.self,
+        "google.protobuf.StringValue": Google_Protobuf_StringValue.self,
+        "google.protobuf.Struct": Google_Protobuf_Struct.self,
+        "google.protobuf.Timestamp": Google_Protobuf_Timestamp.self,
+        "google.protobuf.UInt32Value": Google_Protobuf_UInt32Value.self,
+        "google.protobuf.UInt64Value": Google_Protobuf_UInt64Value.self,
+        "google.protobuf.Value": Google_Protobuf_Value.self,
+    ]
+
+    static private var knownTypes = [String:ProtobufMessage.Type]()
+    static public func register(messageType: ProtobufMessage.Type) {
+        let m = messageType.init()
+        let messageTypeName = typeName(fromMessage: m)
+        knownTypes[messageTypeName] = messageType
+    }
+    
+    public init() {}
+
+    public init(message: ProtobufMessage) {
+        _message = message
+        typeURL = message.anyTypeURL
+    }
+
+    mutating public func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        switch protoFieldNumber {
+        case 1: return try setter.decodeOptionalField(fieldType: ProtobufString.self, value: &typeURL)
+        case 2: return try setter.decodeOptionalField(fieldType: ProtobufBytes.self, value: &_value)
+        default: return false
+        }
+    }
+    
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var key = ""
+        var state = ProtobufJSONDecoder.ObjectParseState.expectFirstKey
+        _jsonFields = nil
+        var jsonFields = [String:[ProtobufJSONToken]]()
+        while let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .string(let s): // This is a key
+                if state != .expectKey && state != .expectFirstKey {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                key = s
+                state = .expectColon
+            case .colon:
+                if state != .expectColon {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                if key == "@type" {
+                    try jsonDecoder.decodeValue(key: key, message: &self)
+                } else {
+                    jsonFields[key] = try jsonDecoder.skip()
+                }
+                state = .expectComma
+            case .comma:
+                if state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectKey
+            case .endObject:
+                if state != .expectFirstKey && state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                _jsonFields = jsonFields
+                return
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.malformedJSON
+    }
+
+    /// Update the provided object from the data in the Any container.
+    /// This is essentially just a deferred deserialization; the Any
+    /// may hold protobuf bytes or JSON fields depending on how the Any
+    /// was itself deserialized.
+    ///
+    public func unpackTo<M: ProtobufMessage>(target: inout M) throws {
+        if typeURL == nil {
+            throw ProtobufDecodingError.malformedAnyField
+        }
+        let encodedType = typeName(fromURL: typeURL!)
+        if encodedType == "" {
+            throw ProtobufDecodingError.malformedAnyField
+        }
+        let messageType = typeName(fromMessage: target)
+        if encodedType != messageType {
+            throw ProtobufDecodingError.malformedAnyField
+        }
+        var protobuf: [UInt8]?
+        if let message = _message {
+            protobuf = try message.serializeProtobuf()
+        } else if let value = _value {
+            protobuf = value
+        }
+        if let protobuf = protobuf {
+            // Decode protobuf from the stored bytes
+            try protobuf.withUnsafeBufferPointer { (bp) in
+                var protobufDecoder = ProtobufBinaryDecoder(protobufPointer: bp)
+                try protobufDecoder.decodeFullObject(message: &target)
+            }
+            return
+        } else if let jsonFields = _jsonFields {
+            let targetType = typeName(fromMessage: target)
+            if Google_Protobuf_Any.wellKnownTypes[targetType] != nil {
+                // If it's a well-known type, the JSON coding must have a single 'value' field
+                if jsonFields.count != 1 || jsonFields["value"] == nil {
+                    throw ProtobufDecodingError.schemaMismatch
+                }
+                var v = jsonFields["value"]!
+                guard v.count > 0 else {
+                    throw ProtobufDecodingError.schemaMismatch
+                }
+                switch v[0] {
+                case .beginObject:
+                    var decoder = ProtobufJSONDecoder(tokens: v)
+                    let _ = try decoder.nextToken() // Discard {
+                    try target.decodeFromJSONObject(jsonDecoder: &decoder)
+                    if !decoder.complete {
+                        throw ProtobufDecodingError.trailingGarbage
+                    }
+                case .beginArray:
+                    var decoder = ProtobufJSONDecoder(tokens: v)
+                    let _ = try decoder.nextToken() // Discard [
+                    try target.decodeFromJSONArray(jsonDecoder: &decoder)
+                case .number(_), .string(_), .boolean(_):
+                    try target.decodeFromJSONToken(token: v[0])
+                case .null:
+                    if let n = try M.decodeFromJSONNull() {
+                        target = n
+                    } else {
+                        throw ProtobufDecodingError.malformedJSON
+                    }
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            } else {
+                // Decode JSON from the stored tokens for generated messages
+                for (k,v) in jsonFields {
+                    var decoder = ProtobufJSONDecoder(tokens: v)
+                    try decoder.decodeValue(key: k, message: &target)
+                    if !decoder.complete {
+                        throw ProtobufDecodingError.trailingGarbage
+                    }
+                }
+            }
+            return
+        }
+        throw ProtobufDecodingError.malformedAnyField
+    }
+
+    public var isEmpty: Bool {
+        return (typeURL == nil
+            && _value == nil
+            && _message == nil
+            && (_jsonFields == nil || _jsonFields!.count == 0))
+    }
+
+    public var hashValue: Int {
+        get {
+            var hash: Int = 0
+            if let t = typeURL {
+                hash = (hash &* 16777619) ^ t.hashValue
+            }
+            if let v = _value {
+                hash = (hash &* 16777619) ^ ProtobufHash(bytes: v)
+            }
+            if let m = _message {
+                hash = (hash &* 16777619) ^ m.hashValue
+            }
+            return hash
+        }
+    }
+
+    public var debugDescription: String {
+        get {
+            if let message = _message {
+                return "Google_Protobuf_Any{" + String(reflecting: message) + "}"
+            } else if let typeURL = typeURL {
+                if let value = _value {
+                    return "Google_Protobuf_Any{\(typeURL), \(value)}"
+                } else {
+                    return "Google_Protobuf_Any{\(typeURL), <JSON>}"
+                }
+            } else {
+                return "Google_Protobuf_Any{}"
+            }
+        }
+    }
+
+    public init(any: Google_Protobuf_Any) throws {
+        try any.unpackTo(target: &self)
+    }
+
+    // Override the traversal-based JSON encoding
+    // This builds an Any JSON representation from one of:
+    //  * The message we were initialized with,
+    //  * The JSON fields we last deserialized, or
+    //  * The protobuf field we were deserialized from.
+    // The last case requires locating the type, deserializing
+    // into an object, then reserializing back to JSON.
+    public func serializeJSON() throws -> String {
+        if let message = _message {
+            return try message.serializeAnyJSON()
+        } else if let typeURL = typeURL {
+            if _value != nil {
+                // Transcode protobuf-to-JSON by decoding and recoding.
+                // Well-known types are always available:
+                let messageTypeName = typeName(fromURL: typeURL)
+                if let messageType = Google_Protobuf_Any.wellKnownTypes[messageTypeName] {
+                    let m = try messageType.init(any: self)
+                    return try m.serializeAnyJSON()
+                }
+                // The user may have registered this type:
+                if let messageType = Google_Protobuf_Any.knownTypes[messageTypeName] {
+                    let m = try messageType.init(any: self)
+                    return try m.serializeAnyJSON()
+                }
+                // TODO: Google spec requires more work in the general case:
+                // let encodedType = ... fetch google.protobuf.Type based on typeURL ...
+                // let type = Google_Protobuf_Type(protobuf: encodedType)
+                // return ProtobufDynamicMessage(type: type, any: self)?.serializeAnyJSON()
+
+                // The big problem here is fetching the type:  Types not in the executable must be fetched from somewhere; Google says we should do an HTTPS fetch against the typeURL, which assumes that everyone will publish all their types and that everyone running this code will have reliable network access.  That seems ... optimistic.
+
+                // ProtobufDynamicMessage() is non-trivial to write but desirable for other reasons.  It's a class that can be instantiated with any protobuf type or descriptor and provides access to protos of the corresponding type.  (Not to be confused with ProtobufRaw which can decode any message but does not use a type descriptor and therefore cannot provide fully-typed access to fields.)
+                throw ProtobufEncodingError.anyTranscodeFailure
+            } else {
+                var jsonEncoder = ProtobufJSONEncoder()
+                jsonEncoder.startObject()
+                jsonEncoder.startField(name: "@type")
+                jsonEncoder.putStringValue(value: typeURL)
+                if let jsonFields = _jsonFields {
+                    // JSON-to-JSON case, just recode the stored tokens
+                    for (k,v) in jsonFields {
+                        jsonEncoder.startField(name: k)
+                        jsonEncoder.appendTokens(tokens: v)
+                    }
+                }
+                jsonEncoder.endObject()
+                return jsonEncoder.result
+            }
+        } else {
+            return "{}"
+        }
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+    
+    public func isEqualTo(other: Google_Protobuf_Any) -> Bool {
+        // TODO: Fix this for case where Any holds a message or jsonFields or the two Any hold different stuff... <ugh>  This seems unsolvable in the general case.  <ugh>
+        if ((typeURL != nil && typeURL != "") || (other.typeURL != nil && other.typeURL != "")) && (typeURL == nil || other.typeURL == nil || typeURL! != other.typeURL!) {
+            return false
+        }
+        if ((_value != nil && !_value!.isEmpty) || (other._value != nil && !other._value!.isEmpty)) && (_value == nil || other._value == nil || _value! != other._value!) {
+            return false
+        }
+        return true
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if let typeURL = typeURL {
+            try visitor.visitSingularField(fieldType: ProtobufString.self, value: typeURL, protoFieldNumber: 1, protoFieldName: "type_url", jsonFieldName: "@type", swiftFieldName: "typeURL")
+            if let value = value {
+                try visitor.visitSingularField(fieldType: ProtobufBytes.self, value: value, protoFieldNumber: 2, protoFieldName: "value", jsonFieldName: "value", swiftFieldName: "value")
+            } else {
+                throw ProtobufEncodingError.anyTranscodeFailure
+            }
+        }
+    }
+}

+ 199 - 0
Sources/Protobuf/Google_Protobuf_Duration_Extensions.swift

@@ -0,0 +1,199 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_Duration_Extensions.swift - Extensions for Duration type
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Extends the generated Duration struct with various custom behaviors:
+/// * JSON coding and decoding
+/// * Arithmetic operations
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+private let DurationMax: Int64 = 315576000000
+private let DurationMin: Int64 = -DurationMax
+
+private func parseDuration(text: String) -> (Int64, Int32)? {
+    var digits = [Character]()
+    var digitCount = 0
+    var total = 0
+    var chars = text.characters.makeIterator()
+    var seconds: Int64?
+    var nanos: Int32 = 0
+    while let c = chars.next() {
+        switch c {
+        case "-":
+            // Only accept '-' as very first character
+            if total > 0 {
+                return nil
+            }
+            digits.append(c)
+        case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9":
+            digits.append(c)
+            digitCount += 1
+        case ".":
+            if let _ = seconds {
+                return nil
+            }
+            let digitString = String(digits)
+            if let s = Int64(digitString), s >= DurationMin && s <= DurationMax {
+                seconds = s
+            } else {
+                return nil
+            }
+            digits.removeAll()
+            digitCount = 0
+        case "s":
+            if let seconds = seconds {
+                // Seconds already set, digits holds nanos
+                while (digitCount < 9) {
+                    digits.append(Character("0"))
+                    digitCount += 1
+                }
+                while digitCount > 9 {
+                    digits.removeLast()
+                    digitCount -= 1
+                }
+                let digitString = String(digits)
+                if let rawNanos = Int32(digitString) {
+                    if seconds < 0 {
+                        nanos = -rawNanos
+                    } else {
+                        nanos = rawNanos
+                    }
+                } else {
+                    return nil
+                }
+            } else {
+                // No fraction, we just have an integral number of seconds
+                let digitString = String(digits)
+                if let s = Int64(digitString), s >= DurationMin && s <= DurationMax {
+                    seconds = s
+                } else {
+                    return nil
+                }
+            }
+            // Fail if there are characters after 's'
+            if chars.next() != nil {
+                return nil
+            }
+            return (seconds!, nanos)
+        default:
+            return nil
+        }
+        total += 1
+    }
+    return nil
+}
+
+private func formatDuration(seconds: Int64, nanos: Int32) -> String? {
+    if ((seconds < 0 && nanos > 0)
+        || (seconds > 0 && nanos < 0)
+        || (seconds < -315576000000)
+        || (seconds > 315576000000)) {
+        return nil
+    } else if nanos == 0 {
+        return "\(seconds)s"
+    } else {
+        // String(format:...) is broken on Swift 2.2/Linux
+        // So we do this the hard way...
+        var digits: Int
+        var fraction: Int
+        let n = abs(nanos)
+        if n % 1000000 == 0 {
+            fraction = Int(n) / 1000000
+            digits = 3
+        } else if n % 1000 == 0 {
+            fraction = Int(n) / 1000
+            digits = 6
+        } else {
+            fraction = Int(n)
+            digits = 9
+        }
+        var formatted_fraction = ""
+        while digits > 0 {
+            formatted_fraction = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"][fraction % 10] + formatted_fraction
+            fraction /= 10
+            digits -= 1
+        }
+        return "\(seconds).\(formatted_fraction)s"
+    }
+}
+
+public extension Google_Protobuf_Duration {
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if case .string(let s) = token,
+            let duration = parseDuration(text: s) {
+            seconds = duration.0
+            nanos = duration.1
+        } else {
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+
+    public func serializeJSON() throws -> String {
+        let s = seconds
+        let n = nanos
+        if let formatted = formatDuration(seconds: s, nanos: n) {
+            return "\"\(formatted)\""
+        } else {
+            throw ProtobufEncodingError.durationJSONRange
+        }
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+}
+
+extension Google_Protobuf_Duration: ExpressibleByFloatLiteral {
+    public typealias FloatLiteralType = Double
+    public init(floatLiteral: Double) {
+        let seconds = Int64(floatLiteral)
+        let fractionalSeconds = floatLiteral - Double(seconds)
+        let nanos = Int32(fractionalSeconds * 1000000000.0)
+        self.init(seconds: seconds, nanos: nanos)
+    }
+}
+
+private func normalizedDuration(seconds: Int64, nanos: Int32) -> Google_Protobuf_Duration {
+    var s = seconds
+    var n = nanos
+    if n >= 1000000000 || n <= -1000000000 {
+        s += Int64(n) / 1000000000
+        n = n % 1000000000
+    }
+    if s > 0 && n < 0 {
+        n += 1000000000
+        s -= 1
+    } else if s < 0 && n > 0 {
+        n -= 1000000000
+        s += 1
+    }
+    return Google_Protobuf_Duration(seconds: s, nanos: n)
+}
+
+public func -(lhs: Google_Protobuf_Timestamp, rhs: Google_Protobuf_Timestamp) -> Google_Protobuf_Duration {
+    return normalizedDuration(seconds: lhs.seconds - rhs.seconds, nanos: lhs.nanos - rhs.nanos)
+}
+
+public func -(lhs: Google_Protobuf_Duration, rhs: Google_Protobuf_Duration) -> Google_Protobuf_Duration {
+    return normalizedDuration(seconds: lhs.seconds - rhs.seconds, nanos: lhs.nanos - rhs.nanos)
+}
+
+public func+(lhs: Google_Protobuf_Duration, rhs: Google_Protobuf_Duration) -> Google_Protobuf_Duration {
+    return normalizedDuration(seconds: lhs.seconds + rhs.seconds, nanos: lhs.nanos + rhs.nanos)
+}
+
+public prefix func -(operand: Google_Protobuf_Duration) -> Google_Protobuf_Duration {
+    return normalizedDuration(seconds: -operand.seconds, nanos: -operand.nanos)
+}

+ 158 - 0
Sources/Protobuf/Google_Protobuf_FieldMask_Extensions.swift

@@ -0,0 +1,158 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_FieldMask_Extensions.swift - Fieldmask extensions
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Extend the generated FieldMask message with customized JSON coding and
+/// convenience methods.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+// TODO: We should have utilities to apply a fieldmask to an arbitrary
+// message, intersect two fieldmasks, etc.
+
+private func ProtoToJSON(name: String) -> String? {
+    var jsonPath = ""
+    var chars = name.characters.makeIterator()
+    while let c = chars.next() {
+        switch c {
+        case "_":
+            if let toupper = chars.next() {
+                switch toupper {
+                case "a"..."z":
+                    jsonPath.append(String(toupper).uppercased())
+                default:
+                    return nil
+                }
+            } else {
+                return nil
+            }
+        case "A"..."Z":
+            return nil
+        default:
+            jsonPath.append(c)
+        }
+    }
+    return jsonPath
+}
+
+private func JSONToProto(name: String) -> String? {
+    var path = ""
+    for c in name.characters {
+        switch c {
+        case "_":
+            return nil
+        case "A"..."Z":
+            path.append(Character("_"))
+            path.append(String(c).lowercased())
+        default:
+            path.append(c)
+        }
+    }
+    return path
+}
+
+private func parseJSONFieldNames(names: String) -> [String]? {
+    var fieldNameCount = 0
+    var fieldName = ""
+    var split = [String]()
+    for c: Character in names.characters {
+        switch c {
+        case ",":
+            if fieldNameCount == 0 {
+                return nil
+            }
+            if let pbName = JSONToProto(name: fieldName) {
+                split.append(pbName)
+            } else {
+                return nil
+            }
+            fieldName = ""
+            fieldNameCount = 0
+        default:
+            fieldName.append(c)
+            fieldNameCount += 1
+        }
+    }
+    if fieldNameCount == 0 { // Last field name can't be empty
+        return nil
+    }
+    if let pbName = JSONToProto(name: fieldName) {
+        split.append(pbName)
+    } else {
+        return nil
+    }
+    return split
+}
+
+public extension Google_Protobuf_FieldMask {
+    /// Initialize a FieldMask object with an array of paths.
+    /// The paths should match the names used in the proto file (which
+    /// will be different than the corresponding Swift property names).
+    public init(protoPaths: [String]) {
+        self.init()
+        paths = protoPaths
+    }
+
+    /// Initialize a FieldMask object with the provided paths.
+    /// The paths should match the names used in the proto file (which
+    /// will be different than the corresponding Swift property names).
+    public init(protoPaths: String...) {
+        self.init(protoPaths: protoPaths)
+    }
+
+    /// Initialize a FieldMask object with the provided paths.
+    /// The paths should match the names used in the JSON serialization
+    /// (which will be different than the field names in the proto file
+    /// or the corresponding Swift property names).
+    public init?(jsonPaths: String...) {
+        // TODO: This should fail if any of the conversions from JSON fails
+        self.init(protoPaths: jsonPaths.flatMap(JSONToProto))
+    }
+
+    // It would be nice if to have an initializer that accepted Swift property
+    // names, but translating between swift and protobuf/json property
+    // names is not entirely deterministic.
+
+    mutating public func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        switch token {
+        case .string(let s):
+            if let names = parseJSONFieldNames(names: s) {
+                paths = names
+            } else {
+                throw ProtobufDecodingError.fieldMaskConversion
+            }
+        default:
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+
+    // Custom hand-rolled JSON serializer
+    public func serializeJSON() throws -> String {
+        // Note:  Proto requires alphanumeric field names, so there
+        // cannot be a ',' or '"' character to mess up this formatting.
+        var jsonPaths = [String]()
+        for p in paths {
+            if let jsonPath = ProtoToJSON(name: p) {
+                jsonPaths.append(jsonPath)
+            } else {
+                throw ProtobufEncodingError.fieldMaskConversion
+            }
+        }
+        return "\"" + jsonPaths.joined(separator: ",") + "\""
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+}

+ 753 - 0
Sources/Protobuf/Google_Protobuf_Struct.swift

@@ -0,0 +1,753 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_Struct.swift - Well-known Struct types.
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Struct, Value, ListValue are well-known message types that can be used
+/// to parse or encode arbitrary JSON without a predefined schema.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+/*
+ * Hand-built implementation.
+ */
+
+public enum Google_Protobuf_NullValue: ProtobufEnum {
+    // TODO: This is awkward, see the references to .NullValue(.NullValue) below.
+    // TODO: The .nullValue property on Google_Protobuf_Value has to have
+    // a type; but this is a little weird.
+    public typealias RawValue = Int
+    ///   Null value.
+    case nullValue
+
+    public init?(rawValue: Int) {self = .nullValue}
+    public init?(name: String) {self = .nullValue}
+    public init?(jsonName: String) {self = .nullValue}
+    public init?(protoName: String) {self = .nullValue}
+    public init() {self = .nullValue}
+    public var rawValue: Int {return 0}
+    public var json: String {return "null"}
+    public var hashValue: Int {return 0}
+    public var debugDescription: String {return "NullValue"}
+}
+
+///   `Struct` represents a structured data value, consisting of fields
+///   which map to dynamically typed values. In some languages, `Struct`
+///   might be supported by a native representation. For example, in
+///   scripting languages like JS a struct is represented as an
+///   object. The details of that representation are described together
+///   with the proto support for the language.
+///
+///   The JSON representation for `Struct` is JSON object.
+
+// Should Google_Protobuf_Struct be a synonym for [String: Any]?
+// TODO: Implement CollectionType
+public struct Google_Protobuf_Struct: ProtobufGeneratedMessage, Hashable, CustomReflectable, ExpressibleByDictionaryLiteral {
+    public var swiftClassName: String {return "Google_Protobuf_Struct"}
+    public var protoMessageName: String {return "Struct"}
+    public var protoPackageName: String {return "google.protobuf"}
+    public var jsonFieldNames: [String:Int] {return ["fields":1]}
+    public var protoFieldNames: [String:Int] {return ["fields":1]}
+    public typealias Key = String
+    public typealias Value = Google_Protobuf_Value
+
+    ///   Unordered map of dynamically typed values.
+    public var fields: Dictionary<String,Google_Protobuf_Value> = [:]
+
+    public init() {}
+
+    public init(fields: [String: Google_Protobuf_Value]) {
+        self.fields = fields
+    }
+    
+    public init(dictionaryLiteral: (String, Google_Protobuf_Value)...) {
+        fields = [:]
+        for (k,v) in dictionaryLiteral {
+            fields[k] = v
+        }
+    }
+    
+    public subscript(index: String) -> Google_Protobuf_Value? {
+        get {return fields[index]}
+        set(newValue) {fields[index] = newValue}
+    }
+
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var key = ""
+        var state = ProtobufJSONDecoder.ObjectParseState.expectFirstKey
+        while let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .string(let s): // This is a key
+                if state != .expectKey && state != .expectFirstKey {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                key = s
+                state = .expectColon
+            case .colon:
+                if state != .expectColon {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                guard let valueToken = try jsonDecoder.nextToken() else {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                var value = Google_Protobuf_Value()
+                switch valueToken {
+                case .number(_), .string(_), .boolean(_):
+                    try value.decodeFromJSONToken(token: valueToken)
+                case .null:
+                    break
+                case .beginArray:
+                    try value.decodeFromJSONArray(jsonDecoder: &jsonDecoder)
+                case .beginObject:
+                    try value.decodeFromJSONObject(jsonDecoder: &jsonDecoder)
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                fields[key] = value
+                state = .expectComma
+            case .comma:
+                if state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectKey
+            case .endObject:
+                if state != .expectFirstKey && state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                return
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public func serializeJSON() throws -> String {
+        var jsonEncoder = ProtobufJSONEncoder()
+        jsonEncoder.startObject()
+        for (k,v) in fields {
+            jsonEncoder.startField(name: k)
+            try v.serializeJSONValue(jsonEncoder: &jsonEncoder)
+        }
+        jsonEncoder.endObject()
+        return jsonEncoder.result
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+
+    public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        var handled = false
+        switch protoFieldNumber {
+        case 1: handled = try setter.decodeMapField(fieldType: ProtobufMap<ProtobufString,Google_Protobuf_Value>.self, value: &fields)
+        default:
+            break
+        }
+        return handled
+    }
+
+    public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+        if !fields.isEmpty {
+            try visitor.visitMapField(fieldType: ProtobufMap<ProtobufString,Google_Protobuf_Value>.self, value: fields, protoFieldNumber: 1, protoFieldName: "fields", jsonFieldName: "fields", swiftFieldName: "fields")
+        }
+    }
+
+    public var _protoc_generated_isEmpty: Bool {
+        if !fields.isEmpty {return false}
+        return true
+    }
+    
+    public  func _protoc_generated_isEqualTo(other: Google_Protobuf_Struct) -> Bool {
+        if fields != other.fields {return false}
+        return true
+    }
+}
+
+///   `Value` represents a dynamically typed value which can be either
+///   null, a number, a string, a boolean, a recursive struct value, or a
+///   list of values. A producer of value is expected to set one of that
+///   variants, absence of any variant indicates an error.
+///
+///   The JSON representation for `Value` is JSON value.
+public struct Google_Protobuf_Value: ProtobufAbstractMessage, Hashable, CustomReflectable, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByStringLiteral, ExpressibleByBooleanLiteral, ExpressibleByNilLiteral {
+    public var swiftClassName: String {return "Google_Protobuf_Value"}
+    public var protoMessageName: String {return "Value"}
+    public var protoPackageName: String {return "google.protobuf"}
+    public var jsonFieldNames: [String: Int] {return [
+                                                          "nullValue": 1,
+                                                          "numberValue": 2,
+                                                          "stringValue": 3,
+                                                          "boolValue": 4,
+                                                          "structValue": 5,
+                                                          "listValue": 6,
+        ]}
+    public var protoFieldNames: [String: Int] {return [
+                                                          "null_value": 1,
+                                                          "number_value": 2,
+                                                          "string_value": 3,
+                                                          "bool_value": 4,
+                                                          "struct_value": 5,
+                                                          "list_value": 6,
+        ]}
+    // TODO: Would it make sense to collapse the implementation here and
+    // make Google_Protobuf_Value be the enum directly?
+    public typealias FloatLiteralType = Double
+    public typealias IntegerLiteralType = Int64
+    public typealias StringLiteralType = String
+    public typealias ExtendedGraphemeClusterLiteralType = String
+    public typealias UnicodeScalarLiteralType = String
+    public typealias BooleanLiteralType = Bool
+
+    public init() {
+        kind = .nullValue(.nullValue)
+    }
+
+    public init(nullValue: ()) {
+        kind = .nullValue(.nullValue)
+    }
+    public init(nilLiteral: ()) {
+        kind = .nullValue(.nullValue)
+    }
+
+    public init(numberValue: Double) {
+        kind = .numberValue(numberValue)
+    }
+    public init(integerLiteral value: Int64) {
+        kind = .numberValue(Double(value))
+    }
+    public init(floatLiteral value: Double) {
+        kind = .numberValue(value)
+    }
+
+    public init(stringValue: String) {
+        kind = .stringValue(stringValue)
+    }
+    public init(stringLiteral value: String) {
+        kind = .stringValue(value)
+    }
+    public init(unicodeScalarLiteral value: String) {
+        kind = .stringValue(value)
+    }
+    public init(extendedGraphemeClusterLiteral value: String) {
+        kind = .stringValue(value)
+    }
+
+    public init(boolValue: Bool) {
+        kind = .boolValue(boolValue)
+    }
+    public init(booleanLiteral value: Bool) {
+        kind = .boolValue(value)
+    }
+
+    public init(structValue: Google_Protobuf_Struct) {
+        kind = .structValue(structValue)
+    }
+
+    public init(listValue: Google_Protobuf_ListValue) {
+        kind = .listValue(listValue)
+    }
+
+    public init<T>(array: [T]) {
+        let anyList = array.map {$0 as Any}
+        kind = .listValue(Google_Protobuf_ListValue(any: anyList))
+    }
+
+    public init(anyArray: [Any]) {
+        kind = .listValue(Google_Protobuf_ListValue(any: anyArray))
+    }
+
+    public init(any: Any) {
+        switch any {
+        case let i as Int:
+            self.init(numberValue: Double(i))
+        case let d as Double:
+            self.init(numberValue: d)
+        case let f as Float:
+            self.init(numberValue: Double(f))
+        case let b as Bool:
+            self.init(boolValue: b)
+        case let s as String:
+            self.init(stringValue: s)
+        default:
+            self.init()
+        }
+    }
+
+    mutating public func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        switch protoFieldNumber {
+        case 1, 2, 3, 4, 5, 6:
+            return try kind.decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
+        default: return false
+        }
+    }
+
+    public static func decodeFromJSONNull() throws -> Google_Protobuf_Value? {
+        return Google_Protobuf_Value()
+    }
+
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        try kind.decodeFromJSONToken(token: token)
+    }
+
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var s = Google_Protobuf_Struct()
+        try s.decodeFromJSONObject(jsonDecoder: &jsonDecoder)
+        kind = .structValue(s)
+    }
+
+    public mutating func decodeFromJSONArray(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var s = Google_Protobuf_ListValue()
+        try s.decodeFromJSONArray(jsonDecoder: &jsonDecoder)
+        kind = .listValue(s)
+    }
+
+    public func serializeJSON() throws -> String {
+        var jsonEncoder = ProtobufJSONEncoder()
+        try serializeJSONValue(jsonEncoder: &jsonEncoder)
+        return jsonEncoder.result
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+
+    fileprivate func serializeJSONValue(jsonEncoder: inout ProtobufJSONEncoder) throws {
+        try kind.serializeJSONField(encoder: &jsonEncoder)
+    }
+
+    public var isEmpty: Bool {return kind == .None}
+
+    public func isEqualTo(other: Google_Protobuf_Value) -> Bool {
+        return kind == other.kind
+    }
+
+    public init(any: Google_Protobuf_Any) throws {
+        try any.unpackTo(target: &self)
+    }
+
+    public var debugDescription: String {
+        get {
+            do {
+                let json = try serializeJSON()
+                switch kind {
+                case .nullValue(_): return "\(swiftClassName)(null)"
+                case .numberValue(_): return "\(swiftClassName)(numberValue:\(json))"
+                case .stringValue(_): return"\(swiftClassName)(stringValue:\(json))"
+                case .boolValue(_): return"\(swiftClassName)(boolValue:\(json))"
+                case .structValue(_): return"\(swiftClassName)(structValue:\(json))"
+                case .listValue(_): return"\(swiftClassName)(listValue:\(json))"
+                case .None: return "\(swiftClassName)()"
+                }
+            } catch let e {
+                return "\(swiftClassName)(FAILURE: \(e))"
+            }
+        }
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        try kind.traverse(visitor: &visitor, start:1, end: 7)
+    }
+
+    // Storage ivars
+    private var kind = Google_Protobuf_Value.OneOf_Kind()
+
+    ///   Represents a null value.
+    public var nullValue: Google_Protobuf_NullValue? {
+        get {
+            if case .nullValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .nullValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    ///   Represents a double value.
+    public var numberValue: Double? {
+        get {
+            if case .numberValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .numberValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    ///   Represents a string value.
+    public var stringValue: String? {
+        get {
+            if case .stringValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .stringValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    ///   Represents a boolean value.
+    public var boolValue: Bool? {
+        get {
+            if case .boolValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .boolValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    ///   Represents a structured value.
+    public var structValue: Google_Protobuf_Struct? {
+        get {
+            if case .structValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .structValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    ///   Represents a repeated `Value`.
+    public var listValue: Google_Protobuf_ListValue? {
+        get {
+            if case .listValue(let v) = kind {
+                return v
+            }
+            return nil
+        }
+        set {
+            if let newValue = newValue {
+                kind = .listValue(newValue)
+            } else {
+                kind = .None
+            }
+        }
+    }
+
+    public enum OneOf_Kind: ExpressibleByNilLiteral, ProtobufOneofEnum {
+        case nullValue(Google_Protobuf_NullValue)
+        case numberValue(Double)
+        case stringValue(String)
+        case boolValue(Bool)
+        case structValue(Google_Protobuf_Struct)
+        case listValue(Google_Protobuf_ListValue)
+        case None
+
+        public init(nilLiteral: ()) {
+            self = .None
+        }
+
+        public init() {
+            self = .None
+        }
+
+        public mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+            let handled: Bool
+            switch protoFieldNumber {
+            case 1:
+                var value: Google_Protobuf_NullValue?
+                handled = try setter.decodeOptionalField(fieldType: Google_Protobuf_NullValue.self, value: &value)
+                if let value = value, handled {
+                    self = .nullValue(value)
+                }
+            case 2:
+                var value: Double?
+                handled = try setter.decodeOptionalField(fieldType: ProtobufDouble.self, value: &value)
+                if let value = value, handled {
+                    self = .numberValue(value)
+                }
+            case 3:
+                var value: String?
+                handled = try setter.decodeOptionalField(fieldType: ProtobufString.self, value: &value)
+                if let value = value, handled {
+                    self = .stringValue(value)
+                }
+            case 4:
+                var value: Bool?
+                handled = try setter.decodeOptionalField(fieldType: ProtobufBool.self, value: &value)
+                if let value = value, handled {
+                    self = .boolValue(value)
+                }
+            case 5:
+                var value: Google_Protobuf_Struct?
+                handled = try setter.decodeOptionalMessageField(fieldType: Google_Protobuf_Struct.self, value: &value)
+                if let value = value, handled {
+                    self = .structValue(value)
+                }
+            case 6:
+                var value: Google_Protobuf_ListValue?
+                handled = try setter.decodeOptionalMessageField(fieldType: Google_Protobuf_ListValue.self, value: &value)
+                if let value = value, handled {
+                    self = .listValue(value)
+                }
+            default:
+                throw ProtobufDecodingError.schemaMismatch
+            }
+            return true
+        }
+
+        fileprivate func serializeJSONField(encoder: inout ProtobufJSONEncoder) throws {
+            switch self {
+            case .nullValue(_): encoder.putNullValue()
+            case .numberValue(let v): encoder.putDoubleValue(value: v, quote: false)
+            case .stringValue(let v): encoder.putStringValue(value: v)
+            case .boolValue(let v): encoder.putBoolValue(value: v, quote: false)
+            case .structValue(let v): encoder.append(text: try v.serializeJSON())
+            case .listValue(let v): encoder.append(text: try v.serializeJSON())
+            case .None:
+                break
+            }
+        }
+
+        public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+            switch token {
+            case .null:
+                self = .nullValue(.nullValue)
+            case .number(_):
+                if let value = token.asDouble {
+                    self = .numberValue(value)
+                } else {
+                    throw ProtobufDecodingError.malformedJSONNumber
+                }
+            case .string(let s):
+                self = .stringValue(s)
+            case .boolean(let b):
+                self = .boolValue(b)
+            default:
+                throw ProtobufDecodingError.schemaMismatch
+            }
+        }
+
+        public func traverse(visitor: inout ProtobufVisitor, start: Int, end: Int) throws {
+            switch self {
+            case .nullValue(let v):
+                if start <= 1 && 1 < end {
+                    try visitor.visitSingularField(fieldType: Google_Protobuf_NullValue.self, value: v, protoFieldNumber: 1, protoFieldName: "null_value", jsonFieldName: "value", swiftFieldName: "nullValue")
+                }
+            case .numberValue(let v):
+                if start <= 2 && 2 < end {
+                    try visitor.visitSingularField(fieldType: ProtobufDouble.self, value: v, protoFieldNumber: 2, protoFieldName: "number_value", jsonFieldName: "value", swiftFieldName: "numberValue")
+                }
+            case .stringValue(let v):
+                if start <= 3 && 3 < end {
+                    try visitor.visitSingularField(fieldType: ProtobufString.self, value: v, protoFieldNumber: 3, protoFieldName: "string_value", jsonFieldName: "value", swiftFieldName: "stringValue")
+                }
+            case .boolValue(let v):
+                if start <= 4 && 4 < end {
+                    try visitor.visitSingularField(fieldType: ProtobufBool.self, value: v, protoFieldNumber: 4, protoFieldName: "bool_value", jsonFieldName: "value", swiftFieldName: "boolValue")
+                }
+            case .structValue(let v):
+                if start <= 5 && 5 < end {
+                    try visitor.visitSingularMessageField(value: v, protoFieldNumber: 5, protoFieldName: "struct_value", jsonFieldName: "value", swiftFieldName: "structValue")
+                }
+            case .listValue(let v):
+                if start <= 6 && 6 < end {
+                    try visitor.visitSingularMessageField(value: v, protoFieldNumber: 6, protoFieldName: "list_value", jsonFieldName: "value", swiftFieldName: "listValue")
+                }
+            case .None:
+                break
+            }
+        }
+
+        public var hashValue: Int {
+            switch self {
+            case .nullValue(_): return 1
+            case .numberValue(let v): return v.hashValue
+            case .stringValue(let v): return v.hashValue
+            case .boolValue(let v): return v.hashValue
+            case .structValue(let v): return v.hashValue
+            case .listValue(let v): return v.hashValue
+            case .None: return 0
+            }
+        }
+
+        public var isEmpty: Bool {return self == .None}
+    }
+}
+
+///   `ListValue` is a wrapper around a repeated field of values.
+///
+///   The JSON representation for `ListValue` is JSON array.
+public struct Google_Protobuf_ListValue: ProtobufAbstractMessage, Hashable, CustomReflectable, ExpressibleByArrayLiteral {
+    public var swiftClassName: String {return "Google_Protobuf_ListValue"}
+    public var protoMessageName: String {return "ListValue"}
+    public var protoPackageName: String {return "google.protobuf"}
+    public var jsonFieldNames: [String:Int] {return ["values":1]}
+    public var protoFieldNames: [String:Int] {return ["values":1]}
+
+    // TODO: Give this a direct array interface by proxying the interesting
+    // bits down to values
+    public typealias Element = Google_Protobuf_Value
+    
+    ///   Repeated field of dynamically typed values.
+    public var values: [Google_Protobuf_Value] = []
+
+    public init() {}
+
+    public init(values: [Google_Protobuf_Value]) {
+        self.values = values
+    }
+
+    public init(arrayLiteral elements: Google_Protobuf_ListValue.Element...) {
+        values = elements
+    }
+
+    public init(any: [Any]) {
+        values = any.map {Google_Protobuf_Value(any: $0)}
+    }
+
+    public subscript(index: Int) -> Google_Protobuf_Value {
+        get {return values[index]}
+        set(newValue) {values[index] = newValue}
+    }
+
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public mutating func decodeFromJSONArray(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var firstItem = true
+        while true {
+            guard let token = try jsonDecoder.nextToken() else {
+                throw ProtobufDecodingError.truncatedInput
+            }
+            switch token {
+            case .endArray:
+                if !firstItem {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                return
+            case .null:
+                values.append(Google_Protobuf_Value())
+            case .beginObject:
+                var message = Google_Protobuf_Value()
+                try message.decodeFromJSONObject(jsonDecoder: &jsonDecoder)
+                values.append(message)
+            case .beginArray:
+                var message = Google_Protobuf_Value()
+                try message.decodeFromJSONArray(jsonDecoder: &jsonDecoder)
+                values.append(message)
+            case .boolean(_), .string(_), .number(_):
+                var message = Google_Protobuf_Value()
+                try message.decodeFromJSONToken(token: token)
+                values.append(message)
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+            firstItem = false
+            if let separatorToken = try jsonDecoder.nextToken() {
+                switch separatorToken {
+                case .comma: break
+                case .endArray: return
+                default: throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+
+    public func serializeJSON() throws -> String {
+        var jsonEncoder = ProtobufJSONEncoder()
+        jsonEncoder.append(text: "[")
+        var separator = ""
+        for v in values {
+            jsonEncoder.append(text: separator)
+            try v.serializeJSONValue(jsonEncoder: &jsonEncoder)
+            separator = ","
+        }
+        jsonEncoder.append(text: "]")
+        return jsonEncoder.result
+    }
+
+    public func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+
+    public init(any: Google_Protobuf_Any) throws {
+        try any.unpackTo(target: &self)
+    }
+
+    public var debugDescription: String {
+        get {
+            do {
+                let json = try serializeJSON()
+                return "\(swiftClassName)(\(json))"
+            } catch let e {
+                return "\(swiftClassName)(FAILURE: \(e))"
+            }
+        }
+    }
+
+    mutating public func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        switch protoFieldNumber {
+        case 1: return try setter.decodeRepeatedMessageField(fieldType: Google_Protobuf_Value.self, value: &values)
+        default: return false
+        }
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if !values.isEmpty {
+            try visitor.visitRepeatedMessageField(value: values, protoFieldNumber: 1, protoFieldName: "values", jsonFieldName: "values", swiftFieldName: "values")
+        }
+    }
+
+    public var isEmpty: Bool {return (values.isEmpty)}
+
+    public func isEqualTo(other: Google_Protobuf_ListValue) -> Bool {
+        return values == other.values
+    }
+}
+
+public func ==(lhs: Google_Protobuf_Value.OneOf_Kind, rhs: Google_Protobuf_Value.OneOf_Kind) -> Bool {
+  switch (lhs, rhs) {
+  case (.nullValue(_), .nullValue(_)): return true
+  case (.numberValue(let l), .numberValue(let r)): return l == r
+  case (.stringValue(let l), .stringValue(let r)): return l == r
+  case (.boolValue(let l), .boolValue(let r)): return l == r
+  case (.structValue(let l), .structValue(let r)): return l == r
+  case (.listValue(let l), .listValue(let r)): return l == r
+  case (.None, .None): return true
+  default: return false
+  }
+}

+ 322 - 0
Sources/Protobuf/Google_Protobuf_Timestamp_Extensions.swift

@@ -0,0 +1,322 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_Timestamp_Extensions.swift - Timestamp extensions
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Extend the generated Timestamp message with customized JSON coding,
+/// arithmetic operations, and convenience methods.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+// TODO: Add convenience methods to interoperate with standard
+// date/time classes:  an initializer that accepts Unix timestamp as
+// Int or Double, an easy way to convert to/from Foundation's
+// NSDateTime (on Apple platforms only?), others?
+
+private func FormatInt(n: Int32, digits: Int) -> String {
+    if n < 0 {
+        return FormatInt(n: -n, digits: digits)
+    } else if digits <= 0 {
+        return ""
+    } else if digits == 1 && n < 10 {
+        return ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"][Int(n)]
+    } else {
+        return FormatInt(n: n / 10, digits: digits - 1) +  ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"][Int(n % 10)]
+    }
+}
+
+private func fromAscii2(_ digit0: Int, _ digit1: Int) throws -> Int {
+    let zero = Int(48)
+    let nine = Int(57)
+
+    if digit0 < zero || digit0 > nine || digit1 < zero || digit1 > nine {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+    return digit0 * 10 + digit1 - 528
+}
+
+private func fromAscii4(_ digit0: Int, _ digit1: Int, _ digit2: Int, _ digit3: Int) throws -> Int {
+    let zero = Int(48)
+    let nine = Int(57)
+
+    if (digit0 < zero || digit0 > nine
+        || digit1 < zero || digit1 > nine
+        || digit2 < zero || digit2 > nine
+        || digit3 < zero || digit3 > nine) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+    return digit0 * 1000 + digit1 * 100 + digit2 * 10 + digit3 - 53328
+}
+
+// Parse an RFC3339 timestamp into a pair of seconds-since-1970 and nanos.
+private func parseTimestamp(s: String) throws -> (Int64, Int32) {
+    // Convert to an array of integer character values
+    let value = s.utf8.map{Int($0)}
+    if value.count < 20 {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+    // Since the format is fixed-layout, we can just decode
+    // directly as follows.
+    let zero = Int(48)
+    let nine = Int(57)
+    let dash = Int(45)
+    let colon = Int(58)
+    let plus = Int(43)
+    let letterT = Int(84)
+    let letterZ = Int(90)
+    let period = Int(46)
+
+    // Year: 4 digits followed by '-'
+    let year = try fromAscii4(value[0], value[1], value[2], value[3])
+    if value[4] != dash || year < Int(1) || year > Int(9999) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // Month: 2 digits followed by '-'
+    let month = try fromAscii2(value[5], value[6])
+    if value[7] != dash || month < Int(1) || month > Int(12) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // Day: 2 digits followed by 'T'
+    let mday = try fromAscii2(value[8], value[9])
+    if value[10] != letterT || mday < Int(1) || mday > Int(31) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // Hour: 2 digits followed by ':'
+    let hour = try fromAscii2(value[11], value[12])
+    if value[13] != colon || hour > Int(23) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // Minute: 2 digits followed by ':'
+    let minute = try fromAscii2(value[14], value[15])
+    if value[16] != colon || minute > Int(59) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // Second: 2 digits (following char is checked below)
+    let second = try fromAscii2(value[17], value[18])
+    if second > Int(61) {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+
+    // timegm() is almost entirely useless.  It's nonexistent on
+    // some platforms, broken on others.  Everything else I've tried
+    // is even worse.  Hence the code below.
+    // (If you have a better way to do this, try it and see if it
+    // passes the test suite on both Linux and OS X.)
+
+    // Day of year
+    let mdayStart: [Int] = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
+    var yday = Int64(mdayStart[month - 1])
+    let isleap = (year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0))
+    if isleap && (month > 2) {
+        yday += 1
+    }
+    yday += Int64(mday - 1)
+
+    // Days since start of epoch (including leap days)
+    var daysSinceEpoch = yday
+    daysSinceEpoch += Int64(365 * year) - Int64(719527)
+    daysSinceEpoch += Int64((year - 1) / 4)
+    daysSinceEpoch -= Int64((year - 1) / 100)
+    daysSinceEpoch += Int64((year - 1) / 400)
+
+    // Second within day
+    var daySec = Int64(hour)
+    daySec *= 60
+    daySec += Int64(minute)
+    daySec *= 60
+    daySec += Int64(second)
+
+    // Seconds since start of epoch
+    let t = daysSinceEpoch * Int64(86400) + daySec
+
+    // After seconds, comes various optional bits
+    var pos = 19
+
+    var nanos: Int32 = 0
+    if value[pos] == period { // "." begins fractional seconds
+        pos += 1
+        var digitValue = 100000000
+        while pos < value.count && value[pos] >= zero && value[pos] <= nine {
+            nanos += digitValue * (value[pos] - zero)
+            digitValue /= 10
+            pos += 1
+        }
+    }
+
+    var seconds: Int64 = 0
+    if value[pos] == plus || value[pos] == dash { // "+" or "-" starts Timezone offset
+        if pos + 6 > value.count {
+            throw ProtobufDecodingError.malformedJSONTimestamp
+        }
+        let hourOffset = try fromAscii2(value[pos + 1], value[pos + 2])
+        let minuteOffset = try fromAscii2(value[pos + 4], value[pos + 5])
+        if hourOffset > Int(13) || minuteOffset > Int(59) || value[pos + 3] != colon {
+            throw ProtobufDecodingError.malformedJSONTimestamp
+        }
+        var adjusted: Int64 = t
+        if value[pos] == plus {
+            adjusted -= Int64(hourOffset) * Int64(3600)
+            adjusted -= Int64(minuteOffset) * Int64(60)
+        } else {
+            adjusted += Int64(hourOffset) * Int64(3600)
+            adjusted += Int64(minuteOffset) * Int64(60)
+        }
+        if adjusted < -62135596800 || adjusted > 253402300799 {
+            throw ProtobufDecodingError.malformedJSONTimestamp
+        }
+        seconds = adjusted
+        pos += 6
+    } else if value[pos] == letterZ { // "Z" indicator for UTC
+        seconds = t
+        pos += 1
+    } else {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+    if pos != value.count {
+        throw ProtobufDecodingError.malformedJSONTimestamp
+    }
+    return (seconds, nanos)
+}
+
+private func formatTimestamp(seconds: Int64, nanos: Int32) -> String? {
+    if ((seconds < 0 && nanos > 0)
+        || (seconds > 0 && nanos < 0)
+        || (seconds < -62135596800)
+        || (seconds == -62135596800 && nanos < 0)
+        || (seconds >= 253402300800)) {
+            return nil
+    }
+
+    // Can't just use gmtime() here because time_t is sometimes 32 bits. Ugh.
+    let secondsSinceStartOfDay = (Int32(seconds % 86400) + 86400) % 86400
+    let sec = secondsSinceStartOfDay % 60
+    let min = (secondsSinceStartOfDay / 60) % 60
+    let hour = secondsSinceStartOfDay / 3600
+
+    // The following implements Richards' algorithm (see the Wikipedia article
+    // for "Julian day").
+    // If you touch this code, please test it exhaustively by playing with
+    // Test_Timestamp.testJSON_range.
+    let julian = (seconds + 210866803200) / 86400
+    let f = julian + 1401 + (((4 * julian + 274277) / 146097) * 3) / 4 - 38
+    let e = 4 * f + 3
+    let g = e % 1461 / 4
+    let h = 5 * g + 2
+    let mday = Int32(h % 153 / 5 + 1)
+    let month = (h / 153 + 2) % 12 + 1
+    let year = e / 1461 - 4716 + (12 + 2 - month) / 12
+
+    // We can't use strftime here (it varies with locale)
+    // We can't use strftime_l here (it's not portable)
+    // The following is crude, but it works.
+    // TODO: If String(format:) works, that might be even better
+    // (it was broken on Linux a while back...)
+    let result = (FormatInt(n: Int32(year), digits: 4)
+        + "-"
+        + FormatInt(n: Int32(month), digits: 2)
+        + "-"
+        + FormatInt(n: mday, digits: 2)
+        + "T"
+        + FormatInt(n: hour, digits: 2)
+        + ":"
+        + FormatInt(n: min, digits: 2)
+        + ":"
+        + FormatInt(n: sec, digits: 2))
+    if nanos == 0 {
+        return "\(result)Z"
+    } else {
+        var digits: Int
+        var fraction: Int
+        if nanos % 1000000 == 0 {
+            fraction = Int(nanos) / 1000000
+            digits = 3
+        } else if nanos % 1000 == 0 {
+            fraction = Int(nanos) / 1000
+            digits = 6
+        } else {
+            fraction = Int(nanos)
+            digits = 9
+        }
+        var formatted_fraction = ""
+        while digits > 0 {
+            formatted_fraction = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"][fraction % 10] + formatted_fraction
+            fraction /= 10
+            digits -= 1
+        }
+        return "\(result).\(formatted_fraction)Z"
+    }
+}
+
+
+public extension Google_Protobuf_Timestamp {
+    public init(secondsSinceEpoch: Int64, nanos: Int32 = 0) {
+        self.init()
+        self.seconds = secondsSinceEpoch
+        self.nanos = nanos
+    }
+
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if case .string(let s) = token {
+            let timestamp = try parseTimestamp(s: s)
+            seconds = timestamp.0
+            nanos = timestamp.1
+        } else {
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+
+    public func serializeJSON() throws -> String {
+        let s = seconds
+        let n = nanos
+        if let formatted = formatTimestamp(seconds: s, nanos: n) {
+            return "\"\(formatted)\""
+        } else {
+            throw ProtobufEncodingError.timestampJSONRange
+        }
+    }
+
+    func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+}
+
+private func normalizedTimestamp(seconds: Int64, nanos: Int32) -> Google_Protobuf_Timestamp {
+    var s = seconds
+    var n = nanos
+    if n >= 1000000000 || n <= -1000000000 {
+        s += Int64(n) / 1000000000
+        n = n % 1000000000
+    }
+    if s > 0 && n < 0 {
+        n += 1000000000
+        s -= 1
+    } else if s < 0 && n > 0 {
+        n -= 1000000000
+        s += 1
+    }
+    return Google_Protobuf_Timestamp(seconds: s, nanos: n)
+}
+
+public func -(lhs: Google_Protobuf_Timestamp, rhs: Google_Protobuf_Duration) -> Google_Protobuf_Timestamp {
+    return normalizedTimestamp(seconds: lhs.seconds - rhs.seconds, nanos: lhs.nanos - rhs.nanos)
+}
+
+public func+(lhs: Google_Protobuf_Timestamp, rhs: Google_Protobuf_Duration) -> Google_Protobuf_Timestamp {
+    return normalizedTimestamp(seconds: lhs.seconds + rhs.seconds, nanos: lhs.nanos + rhs.nanos)
+}
+

+ 258 - 0
Sources/Protobuf/Google_Protobuf_Wrappers.swift

@@ -0,0 +1,258 @@
+// ProtobufRuntime/Sources/Protobuf/Google_Protobuf_Wrappers.swift - Well-known Wrapper types
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// This is a hand-built implementation of the well-known wrapper types.
+/// It exploits a common generic protocol to reduce duplicated code.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol Google_Protobuf_Wrapper: ProtobufAbstractMessage, Hashable, CustomReflectable {
+    associatedtype WrappedType: ProtobufTypeProperties
+    var protoMessageName: String { get }
+    var value: WrappedType.BaseType? { get set }
+}
+
+public extension Google_Protobuf_Wrapper {
+    var protoPackageName: String {return "google.protobuf"}
+    var swiftClassName: String {return "Google_Protobuf_" + protoMessageName}
+    var isEmpty: Bool {return (value == nil)}
+    var jsonFieldNames: [String:Int] {return ["value":1]}
+    var protoFieldNames: [String:Int] {return ["value":1]}
+
+    public init(_ value: WrappedType.BaseType) {
+        self.init()
+        self.value = value
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        switch protoFieldNumber {
+        case 1: return try setter.decodeOptionalField(fieldType: WrappedType.self, value: &value)
+        default: return false
+        }
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldName: String) throws -> Bool {
+        return try decodeField(setter: &setter, protoFieldNumber: 1)
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder, jsonFieldName: String) throws -> Bool {
+        return try decodeField(setter: &setter, protoFieldNumber: 1)
+    }
+
+    func serializeJSON() throws -> String {
+        if let value = value {
+            var encoder = ProtobufJSONEncoder()
+            try WrappedType.serializeJSONValue(encoder: &encoder, value: value)
+            return encoder.result
+        } else {
+            return "null"
+        }
+    }
+
+    func serializeAnyJSON() throws -> String {
+        let value = try serializeJSON()
+        return "{\"@type\":\"\(anyTypeURL)\",\"value\":\(value)}"
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if let value = value {
+            try visitor.visitSingularField(fieldType: WrappedType.self, value: value, protoFieldNumber: 1, protoFieldName: "value", jsonFieldName: "value", swiftFieldName: "value")
+        }
+    }
+}
+
+public extension Google_Protobuf_Wrapper where WrappedType.BaseType: Equatable {
+    public func isEqualTo(other: Self) -> Bool {
+        return value == other.value
+    }
+}
+
+///   Wrapper message for `double`.
+///
+///   The JSON representation for `DoubleValue` is JSON number.
+public struct Google_Protobuf_DoubleValue: Google_Protobuf_Wrapper, ExpressibleByFloatLiteral {
+    public typealias WrappedType = ProtobufDouble
+    public var protoMessageName: String {return "DoubleValue"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public typealias FloatLiteralType = Double
+    public init(floatLiteral: FloatLiteralType) {value = floatLiteral}
+
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asDouble {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `float`.
+///
+///   The JSON representation for `FloatValue` is JSON number.
+public struct Google_Protobuf_FloatValue: Google_Protobuf_Wrapper, ExpressibleByFloatLiteral {
+    public typealias WrappedType = ProtobufFloat
+    public var protoMessageName: String {return "FloatValue"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public typealias FloatLiteralType = Float
+    public init(floatLiteral: FloatLiteralType) {value = floatLiteral}
+
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asFloat {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `int64`.
+///
+///   The JSON representation for `Int64Value` is JSON string.
+public struct Google_Protobuf_Int64Value: Google_Protobuf_Wrapper {
+    public typealias WrappedType = ProtobufInt64
+    public var protoMessageName: String {return "Int64Value"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asInt64 {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `uint64`.
+///
+///   The JSON representation for `UInt64Value` is JSON string.
+public struct Google_Protobuf_UInt64Value: Google_Protobuf_Wrapper {
+    public typealias WrappedType = ProtobufUInt64
+    public var protoMessageName: String {return "UInt64Value"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asUInt64 {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `int32`.
+///
+///   The JSON representation for `Int32Value` is JSON number.
+public struct Google_Protobuf_Int32Value: Google_Protobuf_Wrapper {
+    public typealias WrappedType = ProtobufInt32
+    public var protoMessageName: String {return "Int32Value"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asInt32 {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `uint32`.
+///
+///   The JSON representation for `UInt32Value` is JSON number.
+public struct Google_Protobuf_UInt32Value: Google_Protobuf_Wrapper {
+    public typealias WrappedType = ProtobufUInt32
+    public var protoMessageName: String {return "UInt32Value"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asUInt32 {
+            value = t
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+}
+
+///   Wrapper message for `bool`.
+///
+///   The JSON representation for `BoolValue` is JSON `true` and `false`.
+public struct Google_Protobuf_BoolValue: Google_Protobuf_Wrapper, ExpressibleByBooleanLiteral {
+    public typealias WrappedType = ProtobufBool
+    public var protoMessageName: String {return "BoolValue"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public typealias BooleanLiteralType = Bool
+    public init(booleanLiteral: Bool) {value = booleanLiteral}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asBoolean {
+            value = t
+        } else {
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+}
+
+///   Wrapper message for `string`.
+///
+///   The JSON representation for `StringValue` is JSON string.
+public struct Google_Protobuf_StringValue: Google_Protobuf_Wrapper, ExpressibleByStringLiteral {
+    public typealias WrappedType = ProtobufString
+    public var protoMessageName: String {return "StringValue"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public typealias StringLiteralType = String
+    public init(stringLiteral: String) {value = stringLiteral}
+    public typealias ExtendedGraphemeClusterLiteralType = String
+    public init(extendedGraphemeClusterLiteral: String) {value = extendedGraphemeClusterLiteral}
+    public typealias UnicodeScalarLiteralType = String
+    public init(unicodeScalarLiteral: String) {value = unicodeScalarLiteral}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if case .string(let s) = token {
+            value = s
+        } else {
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+}
+
+///   Wrapper message for `bytes`.
+///
+///   The JSON representation for `BytesValue` is JSON string.
+public struct Google_Protobuf_BytesValue: Google_Protobuf_Wrapper {
+    public typealias WrappedType = ProtobufBytes
+    public var protoMessageName: String {return "BytesValue"}
+    public var value: WrappedType.BaseType?
+    public init() {}
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        if let t = token.asBytes {
+            value = t
+        } else {
+            throw ProtobufDecodingError.schemaMismatch
+        }
+    }
+    public func isEqualTo(other: Google_Protobuf_BytesValue) -> Bool {
+        if let l = value {
+            if let r = other.value {
+                return l == r
+            }
+            return l.isEmpty
+        } else if let r = value {
+            return r.isEmpty
+        } else {
+            return true
+        }
+    }
+}

+ 707 - 0
Sources/Protobuf/ProtobufBinaryDecoding.swift

@@ -0,0 +1,707 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufBinaryDecoding.swift - Binary decoding
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Protobuf binary format decoding engine.
+///
+/// This comprises:
+///  * A scanner that handles low-level parsing of the binary data
+///  * A decoder that provides higher-level structure knowledge
+///  * A collection of FieldDecoder types that handle field-level
+///    parsing for each wire type.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+private protocol ProtobufBinaryFieldDecoder: ProtobufFieldDecoder {
+    var scanner: ProtobufScanner {get}
+}
+
+extension ProtobufBinaryFieldDecoder {
+    mutating func decodeExtensionField(values: inout ProtobufExtensionFieldValueSet, messageType: ProtobufMessage.Type, protoFieldNumber: Int) throws -> Bool {
+        if let ext = scanner.extensions?[messageType, protoFieldNumber] {
+            var mutableSetter: ProtobufFieldDecoder = self
+            var fieldValue = values[protoFieldNumber] ?? ext.newField()
+            if try fieldValue.decodeField(setter: &mutableSetter) {
+                values[protoFieldNumber] = fieldValue
+                return true
+            }
+        }
+        return false
+    }
+}
+
+private struct ProtobufFieldWireType0: ProtobufBinaryFieldDecoder {
+    let varint: UInt64
+    let unknown: UnsafeBufferPointer<UInt8>
+    let scanner: ProtobufScanner
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        return try S.setFromProtobufVarint(varint: varint, value: &value)
+    }
+
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType?
+        let handled = try S.setFromProtobufVarint(varint: varint, value: &t)
+        if let t = t, handled {
+            value = t
+            return true
+        }
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufVarint(varint: varint, value: &value)
+    }
+
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufVarint(varint: varint, value: &value)
+    }
+
+
+    mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return [UInt8](unknown)
+    }
+}
+
+private struct ProtobufFieldWireType1: ProtobufBinaryFieldDecoder {
+    let fixed8: [UInt8]
+    let unknown: UnsafeBufferPointer<UInt8>
+    let scanner: ProtobufScanner
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        return try S.setFromProtobufFixed8(fixed8: fixed8, value: &value)
+    }
+
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType?
+        let handled = try S.setFromProtobufFixed8(fixed8: fixed8, value: &t)
+        if let t = t, handled {
+            value = t
+            return true
+        }
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufFixed8(fixed8: fixed8, value: &value)
+    }
+
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufFixed8(fixed8: fixed8, value: &value)
+    }
+
+    mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return [UInt8](unknown)
+    }
+}
+
+private struct ProtobufFieldWireType2: ProtobufBinaryFieldDecoder {
+    let buffer: UnsafeBufferPointer<UInt8>
+    let unknown: UnsafeBufferPointer<UInt8>
+    let scanner: ProtobufScanner
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        return try S.setFromProtobufBuffer(buffer: buffer, value: &value)
+    }
+
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType?
+        let handled = try S.setFromProtobufBuffer(buffer: buffer, value: &t)
+        if let t = t, handled {
+            value = t
+            return true
+        }
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufBuffer(buffer: buffer, value: &value)
+    }
+
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufBuffer(buffer: buffer, value: &value)
+    }
+
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        var v = value ?? M()
+        var subDecoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        try subDecoder.decodeFullObject(message: &v)
+        value = v
+        return true
+    }
+
+    mutating func decodeRepeatedMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout [M]) throws -> Bool {
+        value.append(try M(protobufBuffer: buffer))
+        return true
+    }
+
+    mutating func decodeMapField<KeyType: ProtobufTypeProperties, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: inout ProtobufMap<KeyType, ValueType>.BaseType) throws -> Bool where KeyType: ProtobufMapKeyType, KeyType.BaseType: Hashable {
+        var k: KeyType.BaseType?
+        var v: ValueType.BaseType?
+        var subdecoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        try subdecoder.decodeFullObject {(decoder: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool in
+            switch protoFieldNumber {
+            case 1:
+                // Keys are always basic types, so we can use the direct path here
+                let handled = try decoder.decodeOptionalField(fieldType: KeyType.self, value: &k)
+                if !handled {
+                    return false
+                }
+            case 2:
+                // Values can be message or basic types, so we need an indirection
+                try ValueType.decodeProtobufMapValue(decoder: &decoder, value: &v)
+            default: return false // Unhandled
+            }
+            return true
+        }
+        if let k = k, let v = v {
+            value[k] = v
+            return true
+        }
+        throw ProtobufDecodingError.malformedProtobuf
+    }
+
+    mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return [UInt8](unknown)
+    }
+}
+
+private struct ProtobufFieldWireType3: ProtobufBinaryFieldDecoder {
+    let scanner: ProtobufScanner
+    let protoFieldNumber: Int
+
+    mutating func decodeOptionalGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool {
+        var group = value ?? G()
+        var decoder = ProtobufBinaryDecoder(scanner: scanner)
+        try decoder.decodeFullGroup(group: &group, protoFieldNumber: protoFieldNumber)
+        value = group
+        return true
+    }
+
+    mutating func decodeRepeatedGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout [G]) throws -> Bool {
+        var group = G()
+        var decoder = ProtobufBinaryDecoder(scanner: scanner)
+        try decoder.decodeFullGroup(group: &group, protoFieldNumber: protoFieldNumber)
+        value.append(group)
+        return true
+    }
+
+    mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return [UInt8](try scanner.skip())
+    }
+}
+
+private struct ProtobufFieldWireType5: ProtobufBinaryFieldDecoder {
+    let fixed4: [UInt8]
+    let unknown: UnsafeBufferPointer<UInt8>
+    let scanner: ProtobufScanner
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        return try S.setFromProtobufFixed4(fixed4: fixed4, value: &value)
+    }
+
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType?
+        let handled = try S.setFromProtobufFixed4(fixed4: fixed4, value: &t)
+        if let t = t, handled {
+            value = t
+            return true
+        }
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufFixed4(fixed4: fixed4, value: &value)
+    }
+
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try S.setFromProtobufFixed4(fixed4: fixed4, value: &value)
+    }
+
+    mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return [UInt8](unknown)
+    }
+}
+
+/*
+ * Decoder object for Protobuf Binary format.
+ *
+ * Note:  This object is instantiated with an UnsafeBufferPointer<UInt8>
+ * that is assumed to be stable for the lifetime of this object.
+ */
+public struct ProtobufBinaryDecoder {
+    private var scanner: ProtobufScanner
+
+    public var complete: Bool {return scanner.available == 0}
+    public var fieldWireType: Int {return scanner.fieldWireType}
+
+    public init(protobufPointer: UnsafeBufferPointer<UInt8>, extensions: ProtobufExtensionSet? = nil) {
+        scanner = ProtobufScanner(protobufPointer: protobufPointer, extensions: extensions)
+    }
+
+    fileprivate init(scanner: ProtobufScanner) {
+        self.scanner = scanner
+    }
+
+    internal func getTagType() throws -> Int? {
+        return try scanner.getTagType()
+    }
+
+    @discardableResult
+    internal func skip() throws -> UnsafeBufferPointer<UInt8> {
+        return try scanner.skip()
+    }
+
+    public mutating func decodeFullObject(decodeField: (inout ProtobufFieldDecoder, Int) throws -> Bool) throws {
+        while let tagType = try scanner.getTagType() {
+            let protoFieldNumber = tagType / 8
+            var fieldDecoder: ProtobufFieldDecoder
+            switch scanner.fieldWireType {
+            case 0:
+                let value = try getVarint()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType0(varint: value, unknown: raw, scanner: scanner)
+            case 1:
+                let value = try getFixed8()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType1(fixed8: value, unknown: raw, scanner: scanner)
+            case 2:
+                let value = try getBytesRef()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType2(buffer: value, unknown: raw, scanner: scanner)
+            case 3:
+                fieldDecoder = ProtobufFieldWireType3(scanner: scanner, protoFieldNumber: protoFieldNumber)
+            case 4:
+                throw ProtobufDecodingError.malformedProtobuf
+            case 5:
+                let value = try getFixed4()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType5(fixed4: value, unknown: raw, scanner: scanner)
+            case 6:
+                throw ProtobufDecodingError.malformedProtobuf
+            case 7:
+                throw ProtobufDecodingError.malformedProtobuf
+            default:
+                throw ProtobufDecodingError.malformedProtobuf
+            }
+            if !(try decodeField(&fieldDecoder, protoFieldNumber)) {
+                let _ = try scanner.skip() // Skip and discard the field.
+            }
+        }
+        if scanner.available != 0 {
+            throw ProtobufDecodingError.trailingGarbage
+        }
+    }
+
+    public mutating func decodeFullObject<M: ProtobufMessage>(message: inout M) throws {
+        try decodeFullObject {(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool in
+            return try message.decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
+        }
+    }
+
+    public mutating func decodeFullGroup<G: ProtobufGroupBase>(group: inout G, protoFieldNumber: Int) throws {
+        guard scanner.fieldWireType == 3 else {throw ProtobufDecodingError.malformedProtobuf}
+        while let tagType = try scanner.getTagType() {
+            if tagType / 8 == protoFieldNumber {
+                if tagType % 8 == 4 {
+                    return
+                }
+                break // Fail and exit
+            }
+            var fieldDecoder: ProtobufFieldDecoder
+            switch scanner.fieldWireType {
+            case 0:
+                let value = try getVarint()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType0(varint: value, unknown: raw, scanner: scanner)
+            case 1:
+                let value = try getFixed8()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType1(fixed8: value, unknown: raw, scanner: scanner)
+            case 2:
+                let value = try getBytesRef()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType2(buffer: value, unknown: raw, scanner: scanner)
+            case 3:
+                fieldDecoder = ProtobufFieldWireType3(scanner: scanner, protoFieldNumber: protoFieldNumber)
+            case 4:
+                throw ProtobufDecodingError.malformedProtobuf
+            case 5:
+                let value = try getFixed4()
+                let raw = try scanner.getRawField()
+                fieldDecoder = ProtobufFieldWireType5(fixed4: value, unknown: raw, scanner: scanner)
+            default:
+                throw ProtobufDecodingError.malformedProtobuf
+            }
+            // Proto2 groups always consume fields or throw errors, so we can ignore return here
+            let _ = try group.decodeField(setter: &fieldDecoder, protoFieldNumber: tagType / 8)
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    // Marks failure if no or broken varint but returns zero
+    fileprivate mutating func getVarint() throws -> UInt64 {
+        if let t = try scanner.getRawVarint() {
+            return t
+        }
+        throw ProtobufDecodingError.malformedProtobuf
+    }
+
+    fileprivate mutating func getFixed8() throws -> [UInt8] {
+        guard scanner.available >= 8 else {throw ProtobufDecodingError.truncatedInput}
+        var i = Array<UInt8>(repeating: 0, count: 8)
+        i.withUnsafeMutableBufferPointer { ip -> Void in
+            let src = UnsafeMutablePointer<UInt8>(mutating: scanner.p)
+            ip.baseAddress!.initialize(from: src, count: 8)
+        }
+        scanner.consume(length: 8)
+        return i
+    }
+
+    fileprivate mutating func getFixed4() throws -> [UInt8] {
+        guard scanner.available >= 4 else {throw ProtobufDecodingError.truncatedInput}
+        var i = Array<UInt8>(repeating: 0, count: 4)
+        i.withUnsafeMutableBufferPointer { ip -> Void in
+            let src = UnsafeMutablePointer<UInt8>(mutating: scanner.p)
+            ip.baseAddress!.initialize(from: src, count: 4)
+        }
+        scanner.consume(length: 4)
+        return i
+    }
+
+    mutating func decodeFloat() throws -> Float? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 4 else {throw ProtobufDecodingError.truncatedInput}
+        var i: Float = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 4)
+        }
+        scanner.consume(length: 4)
+        return i
+    }
+
+    mutating func decodeDouble() throws -> Double? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 8 else {throw ProtobufDecodingError.truncatedInput}
+        var i: Double = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 8)
+        }
+        scanner.consume(length: 8)
+        return i
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeInt32() throws -> Int32? {
+        if let t = try scanner.getRawVarint() {
+            return Int32(truncatingBitPattern: t)
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeInt64() throws -> Int64? {
+        if let t = try scanner.getRawVarint() {
+            return Int64(bitPattern: t)
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeUInt32() throws -> UInt32? {
+        if let t = try scanner.getRawVarint() {
+            return UInt32(truncatingBitPattern: t)
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeUInt64() throws -> UInt64? {
+        if let t = try scanner.getRawVarint() {
+            return t
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeSInt32() throws -> Int32? {
+        if let t = try scanner.getRawVarint() {
+            return unZigZag32(zigZag: t)
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeSInt64() throws -> Int64? {
+        if let t = try scanner.getRawVarint() {
+            return unZigZag64(zigZag: t)
+        } else {
+            return nil
+        }
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeFixed32() throws -> UInt32? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 4 else {throw ProtobufDecodingError.truncatedInput}
+        var i: UInt32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 4)
+        }
+        scanner.consume(length: 4)
+        return UInt32(littleEndian: i)
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeFixed64() throws -> UInt64? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 8 else {throw ProtobufDecodingError.truncatedInput}
+        var i: UInt64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 8)
+        }
+        scanner.consume(length: 8)
+        return UInt64(littleEndian: i)
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeSFixed32() throws -> Int32? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 4 else {throw ProtobufDecodingError.truncatedInput}
+        var i: Int32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 4)
+        }
+        scanner.consume(length: 4)
+        return Int32(littleEndian: i)
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeSFixed64() throws -> Int64? {
+        guard scanner.available > 0 else {return nil}
+        guard scanner.available >= 8 else {throw ProtobufDecodingError.truncatedInput}
+        var i: Int64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            let dest = UnsafeMutableRawPointer(ip).assumingMemoryBound(to: UInt8.self)
+            let src = UnsafeRawPointer(scanner.p).assumingMemoryBound(to: UInt8.self)
+            dest.initialize(from: src, count: 8)
+        }
+        scanner.consume(length: 8)
+        return Int64(littleEndian: i)
+    }
+
+    // Returns nil at end-of-input, throws on broken data
+    mutating func decodeBool() throws -> Bool? {
+        if let t = try scanner.getRawVarint() {
+            return t != 0
+        } else {
+            return nil
+        }
+    }
+
+    // Throws on broken data or premature end-of-input
+    mutating func decodeBytes() throws -> [UInt8]? {
+        return [UInt8](try getBytesRef())
+    }
+
+    mutating func getBytesRef() throws -> UnsafeBufferPointer<UInt8> {
+        if let length = try scanner.getRawVarint(), length <= UInt64(scanner.available) {
+            let n = Int(length)
+            let bp = UnsafeBufferPointer<UInt8>(start: scanner.p, count: n)
+            scanner.consume(length: n)
+            return bp
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    // Convert a 64-bit value from zigzag coding.
+    fileprivate func unZigZag64(zigZag: UIntMax) -> Int64 {
+        let n = Int64(bitPattern: (zigZag >> 1))
+        return n ^ -Int64(bitPattern: zigZag & 1)
+    }
+
+    // Convert a 32-bit value from zigzag coding.
+    fileprivate func unZigZag32(zigZag: UIntMax) -> Int32 {
+        let t = UInt32(truncatingBitPattern: zigZag)
+        let n = Int32(bitPattern: (t >> 1))
+        return n ^ -Int32(bitPattern: t & 1)
+    }
+}
+
+private class ProtobufScanner {
+    // Current position
+    var p : UnsafePointer<UInt8>
+    // Remaining bytes in input.
+    var available : Int
+    // Position of start of field currently being parsed
+    private var fieldStartP : UnsafePointer<UInt8>
+    // Remaining bytes from start of field to end of input
+    var fieldStartAvailable : Int
+    // Wire type for last-examined field
+    var fieldWireType: Int = 0
+    // Collection of extension fields for this decode
+    var extensions: ProtobufExtensionSet?
+
+    init(protobufPointer: UnsafeBufferPointer<UInt8>, extensions: ProtobufExtensionSet? = nil) {
+        // Assuming baseAddress is not nil.
+        p = protobufPointer.baseAddress!
+        available = protobufPointer.count
+        fieldStartP = p
+        fieldStartAvailable = available
+        self.extensions = extensions
+    }
+
+    fileprivate func consume(length: Int) {
+        available -= length
+        p += length
+    }
+
+    // Returns tagType for the field being skipped
+    // Recursively processes groups; returns the start group marker
+    func skipOver(tagType: UInt64) throws {
+        if tagType < 8 || tagType > UInt64(UInt32.max) {
+            throw ProtobufDecodingError.malformedProtobuf
+        }
+        switch tagType % 8 {
+        case 0:
+            if available < 1 {
+                throw ProtobufDecodingError.truncatedInput
+            }
+            var c = p[0]
+            while (c & 0x80) != 0 {
+                p += 1
+                available -= 1
+                if available < 1 {
+                    throw ProtobufDecodingError.truncatedInput
+                }
+                c = p[0]
+            }
+            p += 1
+            available -= 1
+        case 1:
+            if available < 8 {
+                throw ProtobufDecodingError.truncatedInput
+            }
+            p += 8
+            available -= 8
+        case 2:
+            if let n = try getRawVarint(), n <= UInt64(available) {
+                p += Int(n)
+                available -= Int(n)
+            } else {
+                throw ProtobufDecodingError.malformedProtobuf
+            }
+        case 3:
+            while true {
+                if let innerTagType = try getRawVarint() {
+                    if innerTagType == tagType + 1 {
+                        break
+                    } else if innerTagType / 8 != tagType / 8 {
+                        try skipOver(tagType: innerTagType)
+                    }
+                } else {
+                    throw ProtobufDecodingError.truncatedInput
+                }
+            }
+        case 4:
+            throw ProtobufDecodingError.malformedProtobuf
+        case 5:
+            if available < 4 {
+                throw ProtobufDecodingError.truncatedInput
+            }
+            p += 4
+            available -= 4
+        default:
+            throw ProtobufDecodingError.malformedProtobuf
+        }
+    }
+
+    // Returns block of bytes representing the skipped field or nil if failure.
+    //
+    // This uses the bookmarked position saved by the last call to getTagType().
+    //
+    func skip() throws -> UnsafeBufferPointer<UInt8> {
+        p = fieldStartP
+        available = fieldStartAvailable
+        guard let tagType = try getRawVarint() else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+        try skipOver(tagType: tagType)
+        return UnsafeBufferPointer<UInt8>(start: fieldStartP, count: p - fieldStartP)
+    }
+
+    // Nil at end-of-input, throws if broken varint
+    func getRawVarint() throws -> UInt64? {
+        if available < 1 {
+            return nil
+        }
+        var start = p
+        var length = available
+        var c = start[0]
+        start += 1
+        length -= 1
+        var value = UInt64(c & 0x7f)
+        var shift = UInt64(7)
+        while (c & 0x80) != 0 {
+            if length < 1 || shift > 63 {
+                throw ProtobufDecodingError.malformedProtobuf
+            }
+            c = start[0]
+            start += 1
+            length -= 1
+            value |= UInt64(c & 0x7f) << shift
+            shift += 7
+        }
+        p = start
+        available = length
+        return value
+    }
+
+    // Parse index/type marker that starts each field.
+    // This also bookmarks the start of field for a possible skip().
+    func getTagType() throws -> Int? {
+        fieldStartP = p
+        fieldStartAvailable = available
+        if let t = try getRawVarint() {
+            if t > 7 && t < UInt64(UInt32.max) {
+                let tagType = Int(truncatingBitPattern: t)
+                fieldWireType = tagType % 8
+                return tagType
+            } else {
+                throw ProtobufDecodingError.malformedProtobuf
+            }
+        }
+        return nil
+    }
+
+    func getRawField() throws -> UnsafeBufferPointer<UInt8> {
+        let s = fieldStartP
+        let c = p - fieldStartP
+        return UnsafeBufferPointer<UInt8>(start: s, count: c)
+    }
+}

+ 220 - 0
Sources/Protobuf/ProtobufBinaryEncoding.swift

@@ -0,0 +1,220 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufBinaryEncoding.swift - Binary encoding support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Core support for protobuf binary encoding.  Note that this is built
+/// on the general traversal machinery.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public struct ProtobufBinaryEncodingVisitor: ProtobufVisitor {
+    private var encoder = ProtobufBinaryEncoder()
+
+    public var buffer: [UInt8] {return encoder.buffer}
+
+    public init(message: ProtobufMessageBase) throws {
+        try withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try message.traverse(visitor: &visitor)
+        }
+    }
+
+    public mutating func withAbstractVisitor(clause: (inout ProtobufVisitor) throws ->()) throws {
+        var visitor: ProtobufVisitor = self
+        try clause(&visitor)
+        encoder.buffer = (visitor as! ProtobufBinaryEncodingVisitor).encoder.buffer
+    }
+
+    mutating public func visitUnknown(bytes: [UInt8]) {
+        encoder.appendUnknown(bytes: bytes)
+    }
+
+    mutating public func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(tagType: protoFieldNumber * 8 + S.protobufWireType())
+        try S.serializeProtobufValue(encoder: &encoder, value: value)
+    }
+
+    mutating public func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        for v in value {
+            encoder.startField(tagType: protoFieldNumber * 8 + S.protobufWireType())
+            try S.serializeProtobufValue(encoder: &encoder, value: v)
+        }
+    }
+
+    mutating public func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(tagType: protoFieldNumber * 8 + 2)
+        var subencoder = ProtobufBinaryEncoder()
+        for v in value {
+            try S.serializeProtobufValue(encoder: &subencoder, value: v)
+        }
+        encoder.putBytesValue(value: subencoder.buffer)
+    }
+
+    mutating public func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        let t = try value.serializeProtobuf()
+        encoder.startField(tagType: protoFieldNumber * 8 + M.protobufWireType())
+        encoder.putBytesValue(value: t)
+    }
+
+    mutating public func visitRepeatedMessageField<M: ProtobufMessage>(value: [M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        for v in value {
+            let t = try v.serializeProtobuf()
+            encoder.startField(tagType: protoFieldNumber * 8 + M.protobufWireType())
+            encoder.putBytesValue(value: t)
+        }
+    }
+
+    mutating public func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(tagType: protoFieldNumber * 8 + 3) // Start of group
+        try withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try value.traverse(visitor: &visitor)
+        }
+        encoder.startField(tagType: protoFieldNumber * 8 + 4) // End of group
+    }
+
+    mutating public func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        for v in value {
+            encoder.startField(tagType: protoFieldNumber * 8 + 3) // Start of group
+            try withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+                try v.traverse(visitor: &visitor)
+            }
+            encoder.startField(tagType: protoFieldNumber * 8 + 4) // End of group
+        }
+    }
+
+    mutating public func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws where KeyType.BaseType: Hashable {
+        for (k,v) in value {
+            encoder.startField(tagType: protoFieldNumber * 8 + 2)
+            var subencoder = ProtobufBinaryEncoder()
+            subencoder.startField(tagType: 8 + KeyType.protobufWireType())
+            KeyType.serializeProtobufValue(encoder: &subencoder, value: k)
+            subencoder.startField(tagType: 16 + ValueType.protobufWireType())
+            // Note: ValueType could be a message, so messages need
+            // static func serializeProtobufValue(...)
+            // TODO: Could we traverse the valuetype instead?
+            // TODO: Propagate failure out of here...
+            try ValueType.serializeProtobufValue(encoder: &subencoder, value: v)
+            encoder.putBytesValue(value: subencoder.buffer)
+        }
+    }
+}
+
+/*
+ * Encoder for Binary Protocol Buffer format
+ *
+ * TODO: Should this be a class?
+ */
+public struct ProtobufBinaryEncoder {
+    public fileprivate(set) var buffer: [UInt8] = []
+
+    public init() {}
+
+    public mutating func appendUnknown(bytes: [UInt8]) {
+        buffer.append(contentsOf: bytes)
+    }
+
+    mutating func startField(tagType: Int) {
+        putVarInt(value: UInt64(tagType))
+    }
+
+    mutating func putVarInt(value: UInt64) {
+        var v = value
+        while v > 127 {
+            buffer.append(UInt8(v & 0x7f | 0x80))
+            v >>= 7
+        }
+        buffer.append(UInt8(v))
+    }
+
+    mutating func putVarInt(value: Int64) {
+        putVarInt(value: UInt64(bitPattern: value))
+    }
+
+    mutating func putVarInt(value: Int) {
+        putVarInt(value: Int64(value))
+    }
+
+    mutating func putZigZagVarInt(value: Int64) {
+        let coded = UInt64(bitPattern: (value << 1))
+            ^ UInt64(bitPattern: (value >> 63))
+        putVarInt(value: coded)
+    }
+
+    mutating func putBoolValue(value: Bool) {
+        buffer.append(value ? 1 : 0)
+    }
+
+    mutating func putFixedUInt64(value : UInt64) {
+        var v = value
+        let n = MemoryLayout<UInt64>.size
+        withUnsafePointer(to: &v) { v -> () in
+            v.withMemoryRebound(to: UInt8.self, capacity: n) { p -> () in
+                let buff = UnsafeBufferPointer<UInt8>(start: p, count: n)
+                buffer.append(contentsOf: buff)
+            }
+        }
+    }
+
+    mutating func putFixedUInt32(value : UInt32) {
+        var v = value
+        let n = MemoryLayout<UInt32>.size
+        withUnsafePointer(to: &v) { v -> () in
+            v.withMemoryRebound(to: UInt8.self, capacity: n) { p -> () in
+                let buff = UnsafeBufferPointer<UInt8>(start: p, count: n)
+                buffer.append(contentsOf: buff)
+            }
+        }
+    }
+
+    mutating func putFloatValue(value: Float) {
+        var v = value
+        let n = MemoryLayout<Float>.size
+        withUnsafePointer(to: &v) { v -> () in
+            v.withMemoryRebound(to: UInt8.self, capacity: n) { p -> () in
+                let buff = UnsafeBufferPointer<UInt8>(start: p, count: n)
+                buffer.append(contentsOf: buff)
+            }
+        }
+    }
+
+    mutating func putDoubleValue(value: Double) {
+        var v = value
+        let n = MemoryLayout<Double>.size
+        withUnsafePointer(to: &v) { v -> () in
+            v.withMemoryRebound(to: UInt8.self, capacity: n) { p -> () in
+                let buff = UnsafeBufferPointer<UInt8>(start: p, count: n)
+                buffer.append(contentsOf: buff)
+            }
+        }
+    }
+
+    // Write a string field, including the leading index/tag value.
+    mutating func putStringValue(value: String) {
+        let stringWithNul = value.utf8CString
+        let stringLength = stringWithNul.count - 1
+        putVarInt(value: stringLength)
+        if stringLength > 0 {
+            // TODO: There has got to be a better way to do this...
+            stringWithNul.withUnsafeBufferPointer { bp -> () in
+                bp.baseAddress?.withMemoryRebound(to: UInt8.self, capacity: stringLength) { p -> () in
+                    let stringWithoutNul = UnsafeBufferPointer<UInt8>(start: p, count: stringLength)
+                    buffer.append(contentsOf: stringWithoutNul)
+                }
+            }
+        }
+    }
+
+    mutating func putBytesValue(value: [UInt8]) {
+        putVarInt(value: value.count)
+        buffer.append(contentsOf: value)
+    }
+}

+ 752 - 0
Sources/Protobuf/ProtobufBinaryTypes.swift

@@ -0,0 +1,752 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufBinaryTypes.swift - Per-type binary coding
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Extensions to the proto types defined in ProtobufTypes.swift to provide
+/// type-specific binary coding and decoding.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+import Foundation
+
+public protocol ProtobufBinaryCodableType: ProtobufTypePropertiesBase {
+    static func protobufWireType() -> Int
+    /// Write out the protobuf value only.
+    static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: BaseType) throws
+
+    static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool
+    static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool
+    static func setFromProtobufFixed4(fixed4: [UInt8], value: inout BaseType?) throws -> Bool
+    static func setFromProtobufFixed4(fixed4: [UInt8], value: inout [BaseType]) throws -> Bool
+    static func setFromProtobufFixed8(fixed8: [UInt8], value: inout BaseType?) throws -> Bool
+    static func setFromProtobufFixed8(fixed8: [UInt8], value: inout [BaseType]) throws -> Bool
+    static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout BaseType?) throws -> Bool
+    static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool
+
+    static func setFromProtobufBinaryDecoder(decoder: inout ProtobufBinaryDecoder, value: inout [BaseType]) throws -> Bool
+
+    // Special interface for decoding a value of this type as a map value.
+    static func decodeProtobufMapValue(decoder: inout ProtobufFieldDecoder, value: inout BaseType?) throws
+}
+
+/// Extension defines default handling for mismatched wire types.
+/// TODO: Examine how C++ proto2 treats wire type mismatches -- if
+/// it treats them as unknown fields, consider changing the following
+/// to 'return false' to match.
+public extension ProtobufBinaryCodableType {
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout BaseType?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout [BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout BaseType?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout [BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout BaseType?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromProtobufBinaryDecoder(decoder: inout ProtobufBinaryDecoder, value: inout [BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+}
+
+public extension ProtobufTypeProperties {
+    public static func decodeProtobufMapValue(decoder: inout ProtobufFieldDecoder, value: inout BaseType?) throws {
+        let handled = try decoder.decodeOptionalField(fieldType: Self.self, value: &value)
+        assert(handled)
+    }
+}
+
+public protocol ProtobufBinaryCodableMapKeyType: ProtobufTypePropertiesBase {
+    /// Basic protobuf encoding hooks.
+    static func protobufWireType() -> Int
+    /// Write out the protobuf value only.
+    static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: BaseType)
+}
+
+
+///
+/// Float traits
+///
+public extension ProtobufFloat {
+    public static func protobufWireType() -> Int { return 5 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Float) {
+        encoder.putFloatValue(value: value)
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: Float = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: Float = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeFloat() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+
+///
+/// Double traits
+///
+public extension ProtobufDouble {
+    public static func protobufWireType() -> Int { return 1 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Double) {
+        encoder.putDoubleValue(value: value)
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: Double = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: Double = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeDouble() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// Int32 traits
+///
+public extension ProtobufInt32 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int32) {
+        encoder.putVarInt(value: Int64(value))
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        value = Int32(truncatingBitPattern: varint)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        value.append(Int32(truncatingBitPattern: varint))
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeInt32() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// Int64 traits
+///
+public extension ProtobufInt64 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int64) {
+        encoder.putVarInt(value: value)
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        value = Int64(bitPattern: varint)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        value.append(Int64(bitPattern: varint))
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeInt64() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// UInt32 traits
+///
+public extension ProtobufUInt32 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: UInt32) {
+        encoder.putVarInt(value: UInt64(value))
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        value = UInt32(truncatingBitPattern: varint)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        value.append(UInt32(truncatingBitPattern: varint))
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeUInt32() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// UInt64 traits
+///
+public extension ProtobufUInt64 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: UInt64) {
+        encoder.putVarInt(value: value)
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        value = varint
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        value.append(varint)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeUInt64() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// SInt32 traits
+///
+public extension ProtobufSInt32 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int32) {
+        encoder.putZigZagVarInt(value: Int64(value))
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        let t = UInt32(truncatingBitPattern: varint)
+        let n = Int32(bitPattern: (t >> 1))
+        value = n ^ -Int32(bitPattern: t & 1)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        let t = UInt32(truncatingBitPattern: varint)
+        let n = Int32(bitPattern: (t >> 1))
+        value.append(n ^ -Int32(bitPattern: t & 1))
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeSInt32() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// SInt64 traits
+///
+public extension ProtobufSInt64 {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int64) {
+        encoder.putZigZagVarInt(value: value)
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        let n = Int64(bitPattern: (varint >> 1))
+        value = n ^ -Int64(bitPattern: varint & 1)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        let n = Int64(bitPattern: (varint >> 1))
+        value.append(n ^ -Int64(bitPattern: varint & 1))
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeSInt64() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// Fixed32 traits
+///
+public extension ProtobufFixed32 {
+    public static func protobufWireType() -> Int { return 5 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: UInt32) {
+        encoder.putFixedUInt32(value: value)
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: UInt32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: UInt32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeFixed32() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// Fixed64 traits
+///
+public extension ProtobufFixed64 {
+    public static func protobufWireType() -> Int { return 1 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: UInt64) {
+        encoder.putFixedUInt64(value: value.littleEndian)
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: UInt64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: UInt64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeFixed64() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// SFixed32 traits
+///
+public extension ProtobufSFixed32 {
+    public static func protobufWireType() -> Int { return 5 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int32) {
+        encoder.putFixedUInt32(value: UInt32(bitPattern: value))
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: Int32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed4(fixed4: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed4.count == 4)
+        var i: Int32 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 4) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed4)
+                dest.initialize(from: src, count: 4)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeSFixed32() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// SFixed64 traits
+///
+public extension ProtobufSFixed64 {
+    public static func protobufWireType() -> Int { return 1 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Int64) {
+        encoder.putFixedUInt64(value: UInt64(bitPattern: value.littleEndian))
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout BaseType?) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: Int64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value = i
+        return true
+    }
+
+    public static func setFromProtobufFixed8(fixed8: [UInt8], value: inout [BaseType]) throws -> Bool {
+        assert(fixed8.count == 8)
+        var i: Int64 = 0
+        withUnsafeMutablePointer(to: &i) { ip -> Void in
+            ip.withMemoryRebound(to: UInt8.self, capacity: 8) { dest -> () in
+                let src = UnsafeMutablePointer<UInt8>(mutating: fixed8)
+                dest.initialize(from: src, count: 8)
+            }
+        }
+        value.append(i)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeSFixed64() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// Bool traits
+///
+public extension ProtobufBool {
+    public static func protobufWireType() -> Int { return 0 }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Bool) {
+        encoder.putBoolValue(value: value)
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout BaseType?) throws -> Bool {
+        value = (varint != 0)
+        return true
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [BaseType]) throws -> Bool {
+        value.append(varint != 0)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [BaseType]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeBool() {
+            value.append(t)
+        }
+        return true
+    }
+}
+
+///
+/// String traits
+///
+private func bufferToString(buffer: UnsafeBufferPointer<UInt8>) -> String? {
+    var s = ""
+    var bytes = buffer.makeIterator()
+    var utf8Decoder = UTF8()
+    while true {
+        switch utf8Decoder.decode(&bytes) {
+        case .scalarValue(let scalar): s.append(String(scalar))
+        case .emptyInput: return s
+        case .error: return nil
+        }
+    }
+}
+
+public extension ProtobufString {
+    public static func protobufWireType() -> Int { return 2 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: String) {
+        encoder.putStringValue(value: value)
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout String?) throws -> Bool {
+        if let s = bufferToString(buffer: buffer) {
+            value = s
+            return true
+        }
+        throw ProtobufDecodingError.invalidUTF8
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [String]) throws -> Bool {
+        if let s = bufferToString(buffer: buffer) {
+            value.append(s)
+            return true
+        }
+        throw ProtobufDecodingError.invalidUTF8
+    }
+}
+
+///
+/// Bytes traits
+///
+public extension ProtobufBytes {
+    public static func protobufWireType() -> Int { return 2 }
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: [UInt8]) {
+        encoder.putBytesValue(value: value)
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [UInt8]?) throws -> Bool {
+        value = [UInt8](buffer)
+        return true
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [[UInt8]]) throws -> Bool {
+        value.append([UInt8](buffer))
+        return true
+    }
+}
+
+//
+// Enum traits
+//
+extension ProtobufEnum where RawValue == Int {
+    public static func protobufWireType() -> Int { return 0 }
+    public static func decodeOptionalField(decoder: inout ProtobufFieldDecoder, value: inout BaseType?) throws -> Bool {
+        return try decoder.decodeOptionalField(fieldType: Self.self, value: &value)
+    }
+
+    public static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Self) {
+        encoder.putVarInt(value: value.rawValue)
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout Self?) throws -> Bool {
+        if let v = Self(rawValue: Int(Int32(truncatingBitPattern: varint))) {
+            value = v
+            return true
+        } else {
+            return false
+        }
+    }
+
+    public static func setFromProtobufVarint(varint: UInt64, value: inout [Self]) throws -> Bool {
+        if let v = Self(rawValue: Int(Int32(truncatingBitPattern: varint))) {
+            value.append(v)
+            return true
+        } else {
+            return false
+        }
+    }
+
+    public static func setFromProtobufBuffer(buffer: UnsafeBufferPointer<UInt8>, value: inout [Self]) throws -> Bool {
+        var decoder = ProtobufBinaryDecoder(protobufPointer: buffer)
+        while let t = try decoder.decodeInt32() {
+            if let e = Self(rawValue:Int(t)) {
+                value.append(e)
+            }
+        }
+        return true
+    }
+}
+
+///
+/// Messages
+///
+
+public protocol ProtobufBinaryMessageBase: ProtobufMessageBase {
+    // Serialize to protobuf
+    func serializeProtobuf() throws -> [UInt8]
+    // Decode from protobuf
+#if !os(Linux)
+    init(protobuf: Data) throws
+    init(protobuf: Data, extensions: ProtobufExtensionSet?) throws
+#endif
+    init(protobuf: [UInt8]) throws
+    init(protobuf: [UInt8], extensions: ProtobufExtensionSet?) throws
+    init(protobufBuffer: UnsafeBufferPointer<UInt8>) throws
+    init(protobufBuffer: UnsafeBufferPointer<UInt8>, extensions: ProtobufExtensionSet?) throws
+}
+
+public extension ProtobufBinaryMessageBase {
+    func serializeProtobuf() throws -> [UInt8] {
+        return try ProtobufBinaryEncodingVisitor(message: self).buffer
+    }
+
+    static func protobufWireType() -> Int {return 2}
+
+    static func serializeProtobufValue(encoder: inout ProtobufBinaryEncoder, value: Self) throws {
+        let t = try value.serializeProtobuf()
+        encoder.putBytesValue(value: t)
+    }
+}
+
+public extension ProtobufMessage {
+    static func decodeProtobufMapValue(decoder: inout ProtobufFieldDecoder, value: inout Self?) throws {
+        let handled = try decoder.decodeOptionalMessageField(fieldType: Self.self, value: &value)
+        assert(handled)
+    }
+
+#if !os(Linux)
+    init(protobuf: Data) throws {
+        try self.init(protobuf: protobuf, extensions: nil)
+    }
+
+    init(protobuf: Data, extensions: ProtobufExtensionSet? = nil) throws {
+        try self.init(protobuf: [UInt8](protobuf), extensions: extensions)
+    }
+#endif
+
+    init(protobuf: [UInt8]) throws {
+        try self.init(protobuf: protobuf, extensions: nil)
+    }
+    init(protobuf: [UInt8], extensions: ProtobufExtensionSet? = nil) throws {
+        self.init()
+        try protobuf.withUnsafeBufferPointer { (bp) in
+            var protobufDecoder = ProtobufBinaryDecoder(protobufPointer: bp, extensions: extensions)
+            try protobufDecoder.decodeFullObject(message: &self)
+        }
+    }
+
+    init(protobufBuffer: UnsafeBufferPointer<UInt8>) throws {
+        try self.init(protobufBuffer: protobufBuffer, extensions: nil)
+    }
+    init(protobufBuffer: UnsafeBufferPointer<UInt8>, extensions: ProtobufExtensionSet? = nil) throws {
+        self.init()
+        var protobufDecoder = ProtobufBinaryDecoder(protobufPointer: protobufBuffer, extensions: extensions)
+        try protobufDecoder.decodeFullObject(message: &self)
+    }
+}
+
+///
+/// Groups
+///
+
+// TODO:  Does something belong here?
+
+///
+/// Maps
+///
+public extension ProtobufMap {
+}
+

+ 155 - 0
Sources/Protobuf/ProtobufDebugDescription.swift

@@ -0,0 +1,155 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufDebugDescription.swift - debugDescription support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// We treat the debugDescription as a serialization process, using the
+/// same traversal machinery that is used by binary and JSON serialization.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public struct ProtobufDebugDescriptionVisitor: ProtobufVisitor {
+    public var description = ""
+    private var separator = ""
+
+    public init() {}
+
+    public init(message: ProtobufMessageBase) {
+        description.append(message.swiftClassName)
+        description.append("(")
+        withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try message.traverse(visitor: &visitor)
+        }
+        description.append(")")
+    }
+
+    public init(group: ProtobufGroupBase) {
+        description.append(group.swiftClassName)
+        description.append("(")
+        withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try group.traverse(visitor: &visitor)
+        }
+        description.append(")")
+    }
+
+    public mutating func withAbstractVisitor(clause: (inout ProtobufVisitor) throws -> ()) {
+        var visitor: ProtobufVisitor = self
+        do {
+            try clause(&visitor)
+            description = (visitor as! ProtobufDebugDescriptionVisitor).description
+        } catch let e {
+            description = (visitor as! ProtobufDebugDescriptionVisitor).description
+            description.append("\(e)")
+        }
+    }
+
+    mutating public func visitUnknown(bytes: [UInt8]) {}
+
+    mutating public func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        separator = ","
+        description.append(swiftFieldName + ":" + String(reflecting: value))
+    }
+    
+    mutating public func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":[")
+        var arraySeparator = ""
+        for v in value {
+            description.append(arraySeparator)
+            arraySeparator = ","
+            description.append(String(reflecting: v))
+        }
+        description.append("]")
+        separator = ","
+    }
+
+    mutating public func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":[")
+        var arraySeparator = ""
+        for v in value {
+            description.append(arraySeparator)
+            arraySeparator = ","
+            description.append(String(reflecting: v))
+        }
+        description.append("]")
+        separator = ","
+    }
+
+    mutating public func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":")
+        let messageDescription = ProtobufDebugDescriptionVisitor(message: value).description
+        description.append(messageDescription)
+        separator = ","
+    }
+
+    mutating public func visitRepeatedMessageField<M: ProtobufMessage>(value: [M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":[")
+        var arraySeparator = ""
+        for v in value {
+            description.append(arraySeparator)
+            let messageDescription = ProtobufDebugDescriptionVisitor(message: v).description
+            description.append(messageDescription)
+            arraySeparator = ","
+        }
+        description.append("]")
+        separator = ","
+   }
+
+
+    mutating public func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":")
+        let groupDescription = ProtobufDebugDescriptionVisitor(group: value).description
+        description.append(groupDescription)
+        separator = ","
+    }
+
+    mutating public func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":[")
+        var arraySeparator = ""
+        for v in value {
+            description.append(arraySeparator)
+            let groupDescription = ProtobufDebugDescriptionVisitor(group: v).description
+            description.append(groupDescription)
+            arraySeparator = ","
+        }
+        description.append("]")
+        separator = ","
+    }
+
+    mutating public func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws where KeyType.BaseType: Hashable {
+        description.append(separator)
+        description.append(swiftFieldName)
+        description.append(":{")
+        var mapSeparator = ""
+        for (k,v) in value {
+            description.append(mapSeparator)
+            description.append(String(reflecting: k))
+            description.append(":")
+            description.append(String(reflecting: v))
+            mapSeparator = ","
+        }
+        description.append("}")
+        separator = ","
+    }
+}

+ 30 - 0
Sources/Protobuf/ProtobufEnum.swift

@@ -0,0 +1,30 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufEnum.swift - Enum support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Generated enums conform to ProtobufEnum
+///
+/// See ProtobufBinaryTypes and ProtobufJSONTypes for extension
+/// methods to support binary and JSON coding.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol ProtobufEnum: RawRepresentable, Hashable, CustomDebugStringConvertible, ProtobufTypeProperties, ProtobufMapValueType {
+    init?(name: String)
+    init?(jsonName: String)
+    var json: String { get }
+    var rawValue: Int { get }
+}
+
+// TODO: This is a transition aid, remove this in August 2016.
+public typealias ProtobufEnumType = ProtobufEnum

+ 72 - 0
Sources/Protobuf/ProtobufError.swift

@@ -0,0 +1,72 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufError.swift - Error constants
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Enum constants that identify the particular error.
+///
+// -----------------------------------------------------------------------------
+
+// TODO: It would be nice if coding/decoding errors could include the name
+// of the specific field where the error was detected.
+
+import Swift
+
+public enum ProtobufDecodingError: Error {
+    /// An unspecified decoding failure
+    case failure
+    /// JSON format does not allow a oneof field to be specified more than once
+    /// TODO: Remove me!  (This was in generated code until May 18, 2016; remove in July 2016.)
+    case DuplicatedOneOf // TODO: Remove me!
+    /// JSON format does not allow a oneof field to be specified more than once
+    /// Note:  This is used in generated code!  Changing this is difficult.
+    case duplicatedOneOf
+    /// Extraneous data remained after decoding should have been complete
+    case trailingGarbage
+    /// Input was truncated
+    case truncatedInput
+    /// The data being parsed does not match the type specified in the proto file
+    case schemaMismatch
+    /// Any field could not be unpacked
+    case malformedAnyField
+    /// Names in a field mask could not be converted
+    case fieldMaskConversion
+    /// The JSON was syntactically invalid
+    case malformedJSON
+    /// A JSON number was not parseable
+    case malformedJSONNumber
+    /// A JSON timestamp was not parseable
+    case malformedJSONTimestamp
+    /// The enum value was not recognized (for JSON, this is a parse error)
+    case unrecognizedEnumValue
+    /// Strings must always be valid UTF-8
+    case invalidUTF8
+    /// Protobuf binary was syntactically invalid
+    case malformedProtobuf
+    /// TODO: More here?
+}
+
+public enum ProtobufEncodingError: Error {
+    /// An unspecified encoding failure
+    case failure
+    /// Any fields cannot be transcoded between JSON and protobuf unless
+    /// the object they hold is a well-known type or a type registered with
+    /// via Google_Protobuf_Any.register()
+    case anyTranscodeFailure
+    /// Timestamp values can only be JSON encoded if they hold a value
+    /// between 0001-01-01Z00:00:00 and 9999-12-31Z23:59:59.
+    case timestampJSONRange
+    /// Duration values can only be JSON encoded if they hold a value
+    /// less than +/- 100 years.
+    case durationJSONRange
+    /// Field masks get edited when converting between JSON and protobuf
+    case fieldMaskConversion
+    /// TODO: More here.
+}

+ 453 - 0
Sources/Protobuf/ProtobufExtensionFields.swift

@@ -0,0 +1,453 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufExtensionFields.swift - Extension support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Core protocols implemented by generated extensions.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+private let i_2166136261 = Int(bitPattern: 2166136261)
+private let i_16777619 = Int(16777619)
+
+//
+// All extension field implementations build on this basic protocol.
+// Note that it has no "self or associated type" references, so can
+// be used as a protocol type.
+//
+// This also provides type-sealed serialization methods that use the
+// contained value.
+//
+public protocol ProtobufExtensionField: CustomDebugStringConvertible {
+    init(protobufExtension: ProtobufMessageExtension)
+    var isEmpty: Bool { get }
+    var hashValue: Int { get }
+    func isEqual(other: ProtobufExtensionField) -> Bool
+
+    /// General field decoding
+    mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool
+
+    /// Fields know their own type, so can dispatch to a visitor
+    func traverse(visitor: inout ProtobufVisitor) throws
+}
+
+// Backwards compatibility; Remove in August 2016
+public typealias ProtobufExtensionFieldType = ProtobufExtensionField
+
+///
+/// A "typed" FieldType includes all the necessary generic information
+/// needed to work with the contained value.
+///
+/// In particular, it can expose typed accessors and serialization methods
+/// that can accept or return a typed value.
+///
+public protocol ProtobufTypedExtensionField: ProtobufExtensionField, Hashable {
+    // Only used in Map to fetch the base type; we can eliminate this by
+    // restoring BaseType here
+    associatedtype ValueType
+    var value: ValueType {get set}
+}
+
+///
+/// Singular field
+///
+public struct ProtobufOptionalField<T: ProtobufTypeProperties>: ProtobufTypedExtensionField {
+    public typealias BaseType = T.BaseType
+    public typealias ValueType = BaseType?
+    public var value: ValueType
+    public var protobufExtension: ProtobufMessageExtension
+
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool {return value == nil}
+
+    public var debugDescription: String {
+        get {
+            if let value = value {
+                return String(reflecting: value)
+            }
+            return ""
+        }
+    }
+
+    public var hashValue: Int {
+        get {
+            if let value = value {
+                return T.hash(value: value)
+            }
+            return 0
+        }
+    }
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufOptionalField<T>
+        return self == o
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeOptionalField(fieldType: T.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if let v = value {
+            try visitor.visitSingularField(fieldType: T.self, value: v, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+
+}
+
+public func ==<T: ProtobufTypeProperties>(lhs: ProtobufOptionalField<T>, rhs: ProtobufOptionalField<T>) -> Bool {
+    if let l = lhs.value {
+        if let r = rhs.value {
+            return T.isEqual(l, r)
+        }
+        return false
+    } else if let _ = rhs.value {
+        return false
+    }
+    return true // Both nil
+}
+
+///
+/// Repeated fields
+///
+public struct ProtobufRepeatedField<T: ProtobufTypeProperties>: ProtobufTypedExtensionField {
+    public typealias BaseType = T.BaseType
+    public typealias ValueType = [BaseType]
+    public var value = ValueType()
+    public var protobufExtension: ProtobufMessageExtension
+    
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool { return value.count == 0 }
+
+    public var hashValue: Int {
+        get {
+            var hash = i_2166136261
+            for e in value {
+                hash = (hash &* i_16777619) ^ T.hash(value: e)
+            }
+            return hash
+        }
+    }
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufRepeatedField<T>
+        return self == o
+    }
+
+    public var debugDescription: String {
+        return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]"
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeRepeatedField(fieldType: T.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if value.count > 0 {
+            try visitor.visitRepeatedField(fieldType: T.self, value: value, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func ==<T: ProtobufTypeProperties>(lhs: ProtobufRepeatedField<T>, rhs: ProtobufRepeatedField<T>) -> Bool {
+    if lhs.value.count != rhs.value.count {
+        return false
+    }
+    for (l, r) in zip(lhs.value, rhs.value) {
+        if !T.isEqual(l, r) {
+            return false
+        }
+    }
+    return true
+}
+
+///
+/// Packed Repeated fields
+///
+/// TODO: This is almost (but not quite) identical to ProtobufRepeatedFields;
+/// find a way to collapse the implementations.
+///
+public struct ProtobufPackedField<T: ProtobufTypeProperties>: ProtobufTypedExtensionField {
+
+    public typealias BaseType = T.BaseType
+    public typealias ValueType = [BaseType]
+    public var value = ValueType()
+    public var protobufExtension: ProtobufMessageExtension
+    
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool { return value.count == 0 }
+
+    public var hashValue: Int {
+        get {
+            var hash = i_2166136261
+            for e in value {
+                hash = (hash &* i_16777619) ^ T.hash(value: e)
+            }
+            return hash
+        }
+    }
+    
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufPackedField<T>
+        return self == o
+    }
+
+    public var debugDescription: String {
+        return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]"
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodePackedField(fieldType: T.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if value.count > 0 {
+            try visitor.visitPackedField(fieldType: T.self, value: value, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func ==<T: ProtobufTypeProperties>(lhs: ProtobufPackedField<T>, rhs: ProtobufPackedField<T>) -> Bool {
+    if lhs.value.count != rhs.value.count {
+        return false
+    }
+    for (l, r) in zip(lhs.value, rhs.value) {
+        if !T.isEqual(l, r) {
+            return false
+        }
+    }
+    return true
+}
+
+//
+// ========== Message ==========
+//
+public struct ProtobufOptionalMessageField<M: ProtobufAbstractMessage>: ProtobufTypedExtensionField {
+    public typealias BaseType = M
+    public typealias ValueType = BaseType?
+    public var value: ValueType
+    public var protobufExtension: ProtobufMessageExtension
+    
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool {
+        return value?.isEmpty ?? true
+    }
+
+    public var debugDescription: String {
+        get {
+            if let value = value {
+                return String(reflecting: value)
+            }
+            return ""
+        }
+    }
+
+    public static func hash(value: BaseType) -> Int {return value.hashValue}
+
+    public var hashValue: Int {return value?.hashValue ?? 0}
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufOptionalMessageField<M>
+        return self == o
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeOptionalMessageField(fieldType: M.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if let v = value {
+            try visitor.visitSingularMessageField(value: v, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func ==<M: ProtobufAbstractMessage>(lhs: ProtobufOptionalMessageField<M>, rhs: ProtobufOptionalMessageField<M>) -> Bool {
+    if let l = lhs.value {
+        if let r = rhs.value {
+            return l == r
+        }
+        return false
+    } else if let _ = rhs.value {
+        return false
+    }
+    return true // Both nil
+}
+
+public struct ProtobufRepeatedMessageField<M: ProtobufAbstractMessage>: ProtobufTypedExtensionField {
+    public typealias BaseType = M
+    public typealias ValueType = [BaseType]
+    public var value = ValueType()
+    public var protobufExtension: ProtobufMessageExtension
+    
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool {
+        return value.count == 0
+    }
+
+    public var hashValue: Int {
+        get {
+            var hash = i_2166136261
+            for e in value {
+                hash = (hash &* i_16777619) ^ e.hashValue
+            }
+            return hash
+        }
+    }
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufRepeatedMessageField<M>
+        return self == o
+    }
+
+    public var debugDescription: String {
+        return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]"
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeRepeatedMessageField(fieldType: M.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if value.count > 0 {
+            try visitor.visitRepeatedMessageField(value: value, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func ==<M: ProtobufAbstractMessage>(lhs: ProtobufRepeatedMessageField<M>, rhs: ProtobufRepeatedMessageField<M>) -> Bool {
+    if lhs.value.count != rhs.value.count {
+        return false
+    }
+    for (l, r) in zip(lhs.value, rhs.value) {
+        if l != r {
+            return false
+        }
+    }
+    return true
+}
+
+//
+// ======== Groups within Messages ========
+//
+// Protoc internally treats groups the same as messages, but
+// they serialize very differently, so we have separate serialization
+// handling here...
+public struct ProtobufOptionalGroupField<G: ProtobufGroup & Hashable>: ProtobufTypedExtensionField {
+    public typealias BaseType = G
+    public typealias ValueType = BaseType?
+    public var value: G?
+    public var protobufExtension: ProtobufMessageExtension
+
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool {return value == nil}
+    public var hashValue: Int {return value?.hashValue ?? 0}
+
+    public var debugDescription: String { get {return value?.debugDescription ?? ""} }
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufOptionalGroupField<G>
+        return self == o
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeOptionalGroupField(fieldType: G.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if let v = value {
+            try visitor.visitSingularGroupField(value: v, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func==<M: ProtobufGroup>(lhs:ProtobufOptionalGroupField<M>, rhs:ProtobufOptionalGroupField<M>) -> Bool {
+    if let l = lhs.value {
+        if let r = rhs.value {
+            return l == r
+        }
+        return false
+    } else if let _ = rhs.value {
+        return false
+    }
+    return true // Both nil
+}
+
+
+public struct ProtobufRepeatedGroupField<G: ProtobufGroup & Hashable>: ProtobufTypedExtensionField {
+    public typealias BaseType = G
+    public typealias ValueType = [BaseType]
+    public var value = [G]()
+    public var protobufExtension: ProtobufMessageExtension
+    
+    public init(protobufExtension: ProtobufMessageExtension) {
+        self.protobufExtension = protobufExtension
+    }
+
+    public var isEmpty: Bool {return value.count == 0}
+    public var hashValue: Int {
+        get {
+            var hash = i_2166136261
+            for e in value {
+                hash = (hash &* i_16777619) ^ e.hashValue
+            }
+            return hash
+        }
+    }
+
+    public var debugDescription: String {return "[" + value.map{$0.debugDescription}.joined(separator: ",") + "]"}
+
+    public func isEqual(other: ProtobufExtensionField) -> Bool {
+        let o = other as! ProtobufRepeatedGroupField<G>
+        return self == o
+    }
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        return try setter.decodeRepeatedGroupField(fieldType: G.self, value: &value)
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        if value.count > 0 {
+            try visitor.visitRepeatedGroupField(value: value, protoFieldNumber: protobufExtension.protoFieldNumber, protoFieldName: protobufExtension.protoFieldName, jsonFieldName: protobufExtension.jsonFieldName, swiftFieldName: protobufExtension.swiftFieldName)
+        }
+    }
+}
+
+public func ==<G: ProtobufGroup>(lhs: ProtobufRepeatedGroupField<G>, rhs: ProtobufRepeatedGroupField<G>) -> Bool {
+    if lhs.value.count != rhs.value.count {
+        return false
+    }
+    for (l, r) in zip(lhs.value, rhs.value) {
+        if l != r {
+            return false
+        }
+    }
+    return true
+}

+ 255 - 0
Sources/Protobuf/ProtobufExtensions.swift

@@ -0,0 +1,255 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufExtensions.swift - Extension support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// A 'Message Extension' is an immutable class object that describes
+/// a particular extension field, including string and number
+/// identifiers, serialization details, and the identity of the
+/// message that is being extended.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+/// Note that the base ProtobufMessageExtension class has no generic
+/// pieces, which allows us to construct dictionaries of
+/// ProtobufMessageExtension-typed objects.
+public class ProtobufMessageExtension {
+    public let protoFieldNumber: Int
+    public let protoFieldName: String
+    public let jsonFieldName: String
+    public let swiftFieldName: String
+    public let messageType: ProtobufMessage.Type
+    init(protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String, messageType: ProtobufMessage.Type) {
+        self.protoFieldNumber = protoFieldNumber
+        self.protoFieldName = protoFieldName
+        self.jsonFieldName = jsonFieldName
+        self.swiftFieldName = swiftFieldName
+        self.messageType = messageType
+    }
+    public func newField() -> ProtobufExtensionField {
+        fatalError("newField() -> ProtobufExtensionField must always be overridden.")
+    }
+}
+
+public func ==(lhs: ProtobufMessageExtension, rhs: ProtobufMessageExtension) -> Bool {
+    return lhs.protoFieldNumber == rhs.protoFieldNumber
+}
+
+/// A "Generic Message Extension" augments the base Extension type
+/// with generic information about the type of the message being
+/// extended.  These generic constrints enable compile-time checks on
+/// compatibility.
+public class ProtobufGenericMessageExtension<FieldType: ProtobufTypedExtensionField, MessageType: ProtobufMessage>: ProtobufMessageExtension {
+    public init(protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String, defaultValue: FieldType.ValueType) {
+        self.defaultValue = defaultValue
+        super.init(protoFieldNumber: protoFieldNumber, protoFieldName: protoFieldName, jsonFieldName: jsonFieldName, swiftFieldName: swiftFieldName, messageType: MessageType.self)
+    }
+    public let defaultValue: FieldType.ValueType
+    public func set(value: FieldType.ValueType) -> ProtobufExtensionField {
+        var f = FieldType(protobufExtension: self)
+        f.value = value
+        return f
+    }
+    override public func newField() -> ProtobufExtensionField {
+        return FieldType(protobufExtension: self)
+    }
+}
+
+// Messages that support extensions implement this protocol
+public protocol ProtobufExtensibleMessage: ProtobufMessage {
+    mutating func setExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, Self>, value: F.ValueType)
+    mutating func getExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, Self>) -> F.ValueType
+}
+
+// Backwards compatibility shim:  Remove in August 2016
+public typealias ProtobufExtensibleMessageType = ProtobufExtensibleMessage
+
+// Common support for storage classes to handle extension fields
+public protocol ProtobufExtensibleMessageStorage: class {
+    associatedtype ProtobufExtendedMessage: ProtobufMessage
+    var extensionFieldValues: ProtobufExtensionFieldValueSet {get set}
+    func setExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, ProtobufExtendedMessage>, value: F.ValueType)
+    func getExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, ProtobufExtendedMessage>) -> F.ValueType
+}
+
+// Backwards compatibility shim:  Remove in August 2016
+public typealias ProtobufExtensibleMessageStorageType = ProtobufExtensibleMessageStorage
+
+public extension ProtobufExtensibleMessageStorage {
+    public func setExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, ProtobufExtendedMessage>, value: F.ValueType) {
+        extensionFieldValues[ext.protoFieldNumber] = ext.set(value: value)
+    }
+
+    public func getExtensionValue<F: ProtobufExtensionField>(ext: ProtobufGenericMessageExtension<F, ProtobufExtendedMessage>) -> F.ValueType {
+        if let fieldValue = extensionFieldValues[ext.protoFieldNumber] as? F {
+            return fieldValue.value
+        }
+        return ext.defaultValue
+    }
+}
+
+///
+/// A set of extensions that can be passed into deserializers
+/// to provide details of the particular extensions that should
+/// be recognized.
+///
+
+// TODO: Make this more Set-like
+// Note: The generated code only relies on ExpressibleByArrayLiteral
+public struct ProtobufExtensionSet: CustomDebugStringConvertible, ExpressibleByArrayLiteral {
+    public typealias Element = ProtobufMessageExtension
+
+    // Since type objects aren't Hashable, we can't do much better than this...
+    private var fields = [Int: Array<(ProtobufMessage.Type, ProtobufMessageExtension)>]()
+
+    public init() {}
+
+    public init(arrayLiteral: Element...) {
+        insert(contentsOf: arrayLiteral)
+    }
+
+    public subscript(messageType: ProtobufMessage.Type, protoFieldNumber: Int) -> ProtobufMessageExtension? {
+        get {
+            if let l = fields[protoFieldNumber] {
+                for (t, e) in l {
+                    if t == messageType {
+                        return e
+                    }
+                }
+            }
+            return nil
+        }
+        set(newValue) {
+            if let l = fields[protoFieldNumber] {
+                var newL = l.flatMap {
+                    pair -> (ProtobufMessage.Type, ProtobufMessageExtension)? in
+                    if pair.0 == messageType { return nil }
+                    else { return pair }
+                }
+                if let newValue = newValue {
+                    newL.append((messageType, newValue))
+                    fields[protoFieldNumber] = newL
+                }
+                fields[protoFieldNumber] = newL
+            } else if let newValue = newValue {
+                fields[protoFieldNumber] = [(messageType, newValue)]
+            }
+        }
+    }
+
+    public func fieldNumberForJson(messageType: ProtobufJSONMessageBase.Type, jsonFieldName: String) -> Int? {
+        // TODO: Make this faster...
+        for (_, list) in fields {
+            for (_, e) in list {
+                if e.jsonFieldName == jsonFieldName {
+                    return e.protoFieldNumber
+                }
+            }
+        }
+        return nil
+    }
+
+    public mutating func insert(_ e: Element) {
+        self[e.messageType, e.protoFieldNumber] = e
+    }
+
+    public var debugDescription: String {
+        var names = [String]()
+        for (_, list) in fields {
+            for (_, e) in list {
+                names.append("\(e.protoFieldName)(\(e.protoFieldNumber))")
+            }
+        }
+        let d = names.joined(separator: ",")
+        return "ProtobufExtensionSet(\(d))"
+    }
+
+    public mutating func unionInPlace(_ contentsOf: ProtobufExtensionSet) {
+        for (_, list) in contentsOf.fields {
+            for (_, e) in list {
+                insert(e)
+            }
+        }
+    }
+
+    public mutating func insert(contentsOf: [Element]) {
+        for e in contentsOf {
+            insert(e)
+        }
+    }
+}
+
+/// A collection of extension field values on a particular object.
+/// This is only used within messages to manage the values of extension fields;
+/// it does not need to be very sophisticated.
+public struct ProtobufExtensionFieldValueSet: Equatable, Sequence {
+    public typealias Iterator = Dictionary<Int, ProtobufExtensionField>.Iterator
+    fileprivate var values = [Int : ProtobufExtensionField]()
+    public init() {}
+
+    public func makeIterator() -> Iterator {
+        return values.makeIterator()
+    }
+    public var isEmpty: Bool {
+        for (_, value) in values {
+            if !value.isEmpty {
+                return false
+            }
+        }
+        return true
+    }
+
+    public var hashValue: Int {
+        var hash: Int = 0
+        for i in values.keys.sorted() {
+            hash = (hash &* 16777619) ^ values[i]!.hashValue
+        }
+        return hash
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor, start: Int, end: Int) throws {
+         let validIndexes = values.keys.filter {$0 >= start && $0 < end}
+         for i in validIndexes.sorted() {
+            let value = values[i]!
+            try value.traverse(visitor: &visitor)
+         }
+    }
+
+    public subscript(index: Int) -> ProtobufExtensionField? {
+        get {return values[index]}
+        set(newValue) {values[index] = newValue}
+    }
+}
+
+public func ==(lhs: ProtobufExtensionFieldValueSet, rhs: ProtobufExtensionFieldValueSet) -> Bool {
+    for (index, l) in lhs.values {
+        if let r = rhs.values[index] {
+            if type(of: l) != type(of: r) {
+                return false
+            }
+            if !l.isEqual(other: r) {
+                return false
+            }
+        } else {
+            return false
+        }
+    }
+    for (index, r) in rhs.values {
+        if let _ = lhs.values[index] {
+            // already checked above
+        } else if !r.isEmpty {
+            // in r but not l:  okay if r is empty
+            return false
+        }
+    }
+    return true
+}

+ 114 - 0
Sources/Protobuf/ProtobufFieldDecoder.swift

@@ -0,0 +1,114 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufFieldDecoder.swift - Basic field setting
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// A "field decoder" is an object that knows how to set
+/// specific field types.
+///
+/// The rough flow is:
+///   * Decoder looks ahead and creates a suitable field decoder
+///     for the upcoming field data
+///   * Decoder calls decodeField() with the field decoder object
+///   * decodeField() calls the appropriate field decoder method
+///     based on the schema.
+///
+/// In this way, the generated code only knows about schema
+/// information; the decoder logic knows how to decode particular
+/// wire types based on that information.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol ProtobufFieldDecoder {
+    // Some decoders require that multiple values for a oneof must fail
+    var rejectConflictingOneof: Bool { get }
+
+    // Special support for protobuf binary decoder; all other formats should ignore this.
+    mutating func asProtobufUnknown() throws -> [UInt8]?
+
+    // Generic decode methods; defaults are provided below
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool
+    mutating func decodeSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool
+    mutating func decodeRequiredMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool
+    mutating func decodeSingularMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool
+    mutating func decodeRepeatedMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout [M]) throws -> Bool
+    mutating func decodeOptionalGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool
+    mutating func decodeRequiredGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool
+    mutating func decodeRepeatedGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout [G]) throws -> Bool
+    mutating func decodeMapField<KeyType: ProtobufTypeProperties, ValueType: ProtobufTypeProperties>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: inout ProtobufMap<KeyType, ValueType>.BaseType) throws -> Bool  where KeyType: ProtobufMapKeyType, KeyType.BaseType: Hashable, ValueType: ProtobufMapValueType
+    mutating func decodeExtensionField(values: inout ProtobufExtensionFieldValueSet, messageType: ProtobufMessage.Type, protoFieldNumber: Int) throws -> Bool
+}
+
+public extension ProtobufFieldDecoder {
+    var rejectConflictingOneof: Bool {return false}
+
+    public mutating func asProtobufUnknown() throws -> [UInt8]? {
+        return nil
+    }
+
+    public mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType? = value
+        if try decodeOptionalField(fieldType: fieldType, value: &t) {
+            if let newValue = t {
+                value = newValue
+            }
+            // TODO: else value = S.proto3DefaultValue
+            return true
+        }
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        return try decodeSingularField(fieldType: fieldType, value: &value)
+    }
+    public mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeRequiredMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        return try decodeOptionalMessageField(fieldType: fieldType, value: &value)
+    }
+    public mutating func decodeSingularMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        return try decodeOptionalMessageField(fieldType: fieldType, value: &value)
+    }
+    public mutating func decodeRepeatedMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout [M]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeOptionalGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeRequiredGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool {
+        return try decodeOptionalGroupField(fieldType: fieldType, value: &value)
+    }
+    public mutating func decodeRepeatedGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout [G]) throws -> Bool {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    public mutating func decodeMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: inout ProtobufMap<KeyType, ValueType>.BaseType) throws -> Bool  where KeyType.BaseType: Hashable {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+    mutating func decodeExtensionField(values: inout ProtobufExtensionFieldValueSet, messageType: ProtobufMessage.Type, protoFieldNumber: Int) throws -> Bool {
+        return false
+    }
+}
+
+

+ 80 - 0
Sources/Protobuf/ProtobufGroup.swift

@@ -0,0 +1,80 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufGroup.swift - Group support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// These are the core protocols that are implemented by generated group types.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+///
+/// Generated Groups conform to ProtobufGroup
+///
+public protocol ProtobufGroupBase: CustomDebugStringConvertible, ProtobufTraversable {
+    init()
+
+    mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool
+
+    mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws
+
+    var isEmpty: Bool { get }
+    var swiftClassName: String { get }
+}
+
+public extension ProtobufGroupBase {
+    var hashValue: Int {
+        return ProtobufHashVisitor(group: self).hashValue
+    }
+    var debugDescription: String {
+        return ProtobufDebugDescriptionVisitor(group: self).description
+    }
+}
+
+public protocol ProtobufGroup: ProtobufGroupBase, Hashable {
+    func isEqualTo(other: Self) -> Bool
+    var jsonFieldNames: [String: Int] {get}
+    var protoFieldNames: [String: Int] {get}
+}
+
+public func ==<G: ProtobufGroup>(lhs: G, rhs: G) -> Bool {
+    return lhs.isEqualTo(other: rhs)
+}
+
+public protocol ProtobufGeneratedGroup: ProtobufGroup {
+    // The compiler actually generates the following methods.
+    // Default implementations below redirect the standard names.
+    // This allows developers to override the standard names to
+    // customize the behavior.
+    mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool
+    func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws
+    var _protoc_generated_isEmpty: Bool { get }
+    func _protoc_generated_isEqualTo(other: Self) -> Bool
+}
+
+public extension ProtobufGeneratedGroup {
+    // Default implementations simply redirect to the generated versions.
+    func traverse(visitor: inout ProtobufVisitor) throws {
+        try _protoc_generated_traverse(visitor: &visitor)
+    }
+
+    mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        return try _protoc_generated_decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
+    }
+
+    var isEmpty: Bool { get { return _protoc_generated_isEmpty } }
+    func isEqualTo(other: Self) -> Bool {
+        return _protoc_generated_isEqualTo(other: other)
+    }
+}
+
+// TODO: This is a transition aid, remove this in August 2016.
+public typealias ProtobufGeneratedGroupType = ProtobufGeneratedGroup

+ 124 - 0
Sources/Protobuf/ProtobufHash.swift

@@ -0,0 +1,124 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufHash.swift - Hashing support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Hashing is basically a serialization problem, so we can leverage the
+/// generated traversal methods for that.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+
+private let i_2166136261 = Int(bitPattern: 2166136261)
+private let i_16777619 = Int(16777619)
+
+/// Utility hash function for a [UInt8]
+public func ProtobufHash(bytes: [UInt8]) -> Int {
+    var byteHash = i_2166136261
+    for b in bytes {
+        byteHash = (byteHash &* i_16777619) ^ Int(b)
+    }
+    return byteHash
+}
+
+//
+// The hashValue property is computed with a visitor that
+// traverses the message tree.
+//
+public struct ProtobufHashVisitor: ProtobufVisitor {
+    // Roughly based on FNV hash:
+    // http://tools.ietf.org/html/draft-eastlake-fnv-03
+    public private(set) var hashValue = i_2166136261
+
+    private mutating func mix(_ hash: Int) {
+        hashValue = (hashValue ^ hash) &* i_16777619
+    }
+
+    public init() {}
+
+    public init(message: ProtobufMessageBase) {
+        withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try message.traverse(visitor: &visitor)
+        }
+    }
+
+    public init(group: ProtobufGroupBase) {
+        withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try group.traverse(visitor: &visitor)
+        }
+    }
+
+    public mutating func withAbstractVisitor(clause: (inout ProtobufVisitor) throws -> ()) {
+        var visitor: ProtobufVisitor = self
+        let _ = try? clause(&visitor)
+        hashValue = (visitor as! ProtobufHashVisitor).hashValue
+    }
+
+    mutating public func visitUnknown(bytes: [UInt8]) {
+        mix(ProtobufHash(bytes: bytes))
+    }
+
+    mutating public func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        mix(S.hash(value: value))
+    }
+
+    mutating public func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        for v in value {
+            mix(S.hash(value: v))
+        }
+    }
+
+    mutating public func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        for v in value {
+            mix(S.hash(value: v))
+        }
+    }
+
+    mutating public func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        mix(value.hashValue)
+    }
+
+    mutating public func visitRepeatedMessageField<M: ProtobufMessage>(value: [M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        for v in value {
+            mix(v.hashValue)
+        }
+   }
+
+    mutating public func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        mix(value.hashValue)
+    }
+
+    mutating public func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mix(protoFieldNumber)
+        for v in value {
+            mix(v.hashValue)
+        }
+    }
+
+    mutating public func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws where KeyType.BaseType: Hashable {
+        mix(protoFieldNumber)
+        // Note: When Map<Hashable,Hashable> is Hashable, this will simplify to
+        // mix(value.hashValue)
+        var mapHash = 0
+        for (k,v) in value {
+            // Note: This calculation cannot depend on the order of the items.
+            mapHash += k.hashValue ^ ValueType.hash(value: v)
+        }
+        mix(mapHash)
+    }
+}

+ 1168 - 0
Sources/Protobuf/ProtobufJSONDecoding.swift

@@ -0,0 +1,1168 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufJSONDecoding.swift - JSON decoding
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// JSON decoding engine.
+///
+/// This comprises:
+/// * A token struct that represents a single JSON token
+/// * A scanner that decomposes a string into JSON tokens.
+/// * A decoder that provides high-level parsing functions
+///   of the token string.
+/// * A collection of FieldDecoder types that handle field-level
+///   parsing for each type of JSON data.
+///
+/// A wrinkle:  you can also instantiate a JSON scanner with
+/// a pre-parsed list of tokens.  This is used by Any to defer
+/// JSON decoding when schema details are not yet available.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+private func fromHexDigit(_ c: Character?) -> UInt32? {
+    if let c = c {
+        switch c {
+        case "0": return 0
+        case "1": return 1
+        case "2": return 2
+        case "3": return 3
+        case "4": return 4
+        case "5": return 5
+        case "6": return 6
+        case "7": return 7
+        case "8": return 8
+        case "9": return 9
+        case "a", "A": return 10
+        case "b", "B": return 11
+        case "c", "C": return 12
+        case "d", "D": return 13
+        case "e", "E": return 14
+        case "f", "F": return 15
+        default: return nil
+        }
+    }
+    return nil
+}
+
+///
+/// Provides a higher-level interface to the JSON token stream coming
+/// from a ProtobufJSONScanner.  In particular, this provides single-token
+/// pushback and convenience functions for iterating over complex
+/// structures.
+///
+public struct ProtobufJSONDecoder {
+    private var scanner: ProtobufJSONScanner
+    public var complete: Bool {return scanner.complete}
+
+
+    public enum ObjectParseState {
+        case expectFirstKey
+        case expectKey
+        case expectColon
+        case expectComma
+    }
+
+    public init(json: String, extensions: ProtobufExtensionSet? = nil) {
+        scanner = ProtobufJSONScanner(json: json, tokens: [], extensions: extensions)
+    }
+
+    public init(tokens: [ProtobufJSONToken]) {
+        scanner = ProtobufJSONScanner(json: "", tokens: tokens)
+    }
+
+    fileprivate init(scanner: ProtobufJSONScanner) {
+        self.scanner = scanner
+    }
+
+    public mutating func pushback(token: ProtobufJSONToken) {
+        scanner.pushback(token: token)
+    }
+
+    /// Returns nil if no more tokens, throws an error if
+    /// the data being parsed is malformed.
+    public mutating func nextToken() throws -> ProtobufJSONToken? {
+        return try scanner.next()
+    }
+
+    public mutating func decodeFullObject<M: ProtobufJSONMessageBase>(message: inout M) throws {
+        guard let token = try nextToken() else {throw ProtobufDecodingError.truncatedInput}
+        switch token {
+        case .null:
+            return
+        case .beginArray:
+            try message.decodeFromJSONArray(jsonDecoder: &self)
+            if !complete {
+                throw ProtobufDecodingError.trailingGarbage
+            }
+        case .beginObject:
+            try message.decodeFromJSONObject(jsonDecoder: &self)
+            if !complete {
+                throw ProtobufDecodingError.trailingGarbage
+            }
+        case .string(_), .number(_), .boolean(_):
+            // Some special types can decode themselves
+            // from a single token (e.g., Timestamp)
+            try message.decodeFromJSONToken(token: token)
+        default:
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    // TODO: ProtobufMessage here should be ProtobufFieldDecodableType to encompass both groups and messages
+    // then this can merge with the decodeValue below...
+    public mutating func decodeValue<M: ProtobufMessage>(key: String, message: inout M) throws {
+        var handled = false
+        if let token = try nextToken() {
+            let protoFieldNumber = (message.jsonFieldNames[key]
+                ?? message.protoFieldNames[key]
+                ?? scanner.extensions?.fieldNumberForJson(messageType: M.self, jsonFieldName: key))
+            switch token {
+            case .colon, .comma, .endObject, .endArray:
+                throw ProtobufDecodingError.malformedJSON
+            case .beginObject:
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONObjectFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try message.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    var skipped: [ProtobufJSONToken] = []
+                    try skipObject(tokens: &skipped)
+                }
+            case .beginArray:
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONArrayFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try message.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    var skipped: [ProtobufJSONToken] = []
+                    try skipArray(tokens: &skipped)
+                }
+            case .null:
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONNullFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try message.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                // Don't need to handle false case here; null token is already skipped
+            case .boolean(_), .string(_), .number(_):
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONSingleTokenFieldDecoder(token: token, scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try message.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    // Token was already implicitly skipped, but we
+                    // need to handle one deferred failure check:
+                    if case .number(_) = token, token.asDouble == nil {
+                        throw ProtobufDecodingError.malformedJSONNumber
+                    }
+                }
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+    }
+    
+    public mutating func decodeValue<G: ProtobufGroup>(key: String, group: inout G) throws {
+        if let token = try nextToken() {
+            let protoFieldNumber = (group.jsonFieldNames[key]
+                ?? group.protoFieldNames[key])
+            // TODO: Look up field number for extension?
+            //?? scanner.extensions?.fieldNumberForJson(messageType: G.self, jsonFieldName: key))
+            switch token {
+            case .colon, .comma, .endObject, .endArray:
+                throw ProtobufDecodingError.malformedJSON
+            case .beginObject:
+                var handled = false
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONObjectFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try group.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    var skipped: [ProtobufJSONToken] = []
+                    try skipObject(tokens: &skipped)
+                }
+            case .beginArray:
+                var handled = false
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONArrayFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try group.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    var skipped: [ProtobufJSONToken] = []
+                    try skipArray(tokens: &skipped)
+                }
+            case .null:
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONNullFieldDecoder(scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    _ = try group.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+            // Don't need to handle false case here; null token is already skipped
+            case .boolean(_), .string(_), .number(_):
+                var handled = false
+                var fieldDecoder:ProtobufFieldDecoder = ProtobufJSONSingleTokenFieldDecoder(token: token, scanner: scanner)
+                if let protoFieldNumber = protoFieldNumber {
+                    handled = try group.decodeField(setter: &fieldDecoder, protoFieldNumber: protoFieldNumber)
+                }
+                if !handled {
+                    // Token was already implicitly skipped, but we
+                    // need to handle one deferred failure check:
+                    if case .number(_) = token, token.asDouble == nil {
+                        throw ProtobufDecodingError.malformedJSONNumber
+                    }
+                }
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+    }
+
+
+    // Build parseArrayFields() method, use it.
+
+    /// Updates the provided array with the tokens that were skipped.
+    /// This is used for deferred parsing of Any fields.
+    public mutating func skip() throws -> [ProtobufJSONToken] {
+        var tokens = [ProtobufJSONToken]()
+        try skipValue(tokens: &tokens)
+        return tokens
+    }
+
+    private mutating func skipValue(tokens: inout [ProtobufJSONToken]) throws {
+        if let token = try nextToken() {
+            switch token {
+            case .beginObject:
+                try skipObject(tokens: &tokens)
+            case .beginArray:
+                try skipArray(tokens: &tokens)
+            case .endObject, .endArray, .comma, .colon:
+                throw ProtobufDecodingError.malformedJSON
+            case .number(_):
+                // Make sure numbers are actually syntactically valid
+                if token.asDouble == nil {
+                    throw ProtobufDecodingError.malformedJSONNumber
+                }
+                tokens.append(token)
+            default:
+                tokens.append(token)
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+    }
+
+    // Assumes begin object already consumed
+    private mutating func skipObject( tokens: inout [ProtobufJSONToken]) throws {
+        tokens.append(.beginObject)
+        if let token = try nextToken() {
+            switch token {
+            case .endObject:
+                tokens.append(token)
+                return
+            case .string(_):
+                pushback(token: token)
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+
+        while true {
+            if let token = try nextToken() {
+                if case .string(_) = token {
+                    tokens.append(token)
+                } else {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+
+            if let token = try nextToken() {
+                if case .colon = token {
+                    tokens.append(token)
+                } else {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+
+            try skipValue(tokens: &tokens)
+
+            if let token = try nextToken() {
+                switch token {
+                case .comma:
+                    tokens.append(token)
+                case .endObject:
+                    tokens.append(token)
+                    return
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+
+    private mutating func skipArray( tokens: inout [ProtobufJSONToken]) throws {
+        tokens.append(.beginArray)
+        if let token = try nextToken() {
+            switch token {
+            case .endArray:
+                tokens.append(token)
+                return
+            default:
+                pushback(token: token)
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+
+        while true {
+            try skipValue(tokens: &tokens)
+
+            if let token = try nextToken() {
+                switch token {
+                case .comma:
+                    tokens.append(token)
+                case .endArray:
+                    tokens.append(token)
+                    return
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+}
+
+public protocol ProtobufJSONFieldDecoder: ProtobufFieldDecoder {
+    var scanner: ProtobufJSONScanner {get}
+}
+
+extension ProtobufJSONFieldDecoder {
+    public mutating func decodeExtensionField(values: inout ProtobufExtensionFieldValueSet, messageType: ProtobufMessage.Type, protoFieldNumber: Int) throws -> Bool {
+        if let ext = scanner.extensions?[messageType, protoFieldNumber] {
+            var mutableSetter: ProtobufFieldDecoder = self
+            var fieldValue = values[protoFieldNumber] ?? ext.newField()
+            if try fieldValue.decodeField(setter: &mutableSetter) {
+                values[protoFieldNumber] = fieldValue
+                return true
+            }
+        }
+        return false
+    }
+}
+
+private struct ProtobufJSONNullFieldDecoder: ProtobufJSONFieldDecoder {
+    let scanner: ProtobufJSONScanner
+    var rejectConflictingOneof: Bool {return true}
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        return true
+    }
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        return true
+    }
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return true
+    }
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return true
+    }
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        value = try M.decodeFromJSONNull()
+        return true
+    }
+    mutating func decodeRepeatedMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout [M]) throws -> Bool {
+        return true
+    }
+    mutating func decodeOptionalGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool {
+        return true
+    }
+    mutating func decodeRepeatedGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout [G]) throws -> Bool {
+        return true
+    }
+    mutating func decodeMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: inout ProtobufMap<KeyType, ValueType>.BaseType) throws -> Bool where KeyType.BaseType: Hashable {
+        return true
+    }
+    mutating func decodeExtensionField(values: inout ProtobufExtensionFieldValueSet, messageType: ProtobufMessage.Type, protoFieldNumber: Int) throws -> Bool {
+        return true
+    }
+}
+
+private struct ProtobufJSONSingleTokenFieldDecoder: ProtobufJSONFieldDecoder {
+    var rejectConflictingOneof: Bool {return true}
+
+    var token: ProtobufJSONToken
+    var scanner: ProtobufJSONScanner
+
+    mutating func decodeOptionalField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType?) throws -> Bool {
+        try S.setFromJSONToken(token: token, value: &value)
+        return true
+    }
+
+    mutating func decodeRequiredField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout S.BaseType) throws -> Bool {
+        var t: S.BaseType?
+        try S.setFromJSONToken(token: token, value: &t)
+        if let t = t {
+            value = t
+            return true
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+    
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        var m = M()
+        try m.decodeFromJSONToken(token: token)
+        value = m
+        return true
+    }
+}
+
+private struct ProtobufJSONObjectFieldDecoder: ProtobufJSONFieldDecoder {
+    var rejectConflictingOneof: Bool {return true}
+
+    var scanner: ProtobufJSONScanner
+
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        var message = M()
+        var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+        try message.decodeFromJSONObject(jsonDecoder: &subDecoder)
+        value = message
+        return true
+    }
+
+    mutating func decodeOptionalGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout G?) throws -> Bool {
+        var group = G()
+        var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+        try group.decodeFromJSONObject(jsonDecoder: &subDecoder)
+        value = group
+        return true
+    }
+    mutating func decodeMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: inout ProtobufMap<KeyType, ValueType>.BaseType) throws -> Bool where KeyType.BaseType: Hashable {
+        var keyToken: ProtobufJSONToken?
+        var state = ProtobufJSONDecoder.ObjectParseState.expectFirstKey
+        while let token = try scanner.next() {
+            switch token {
+            case .string(_): // This is a key
+                if state != .expectKey && state != .expectFirstKey {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                keyToken = token
+                state = .expectColon
+            case .colon:
+                if state != .expectColon {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                if let keyToken = keyToken,
+                    let mapKey = try KeyType.decodeJSONMapKeyValue(token: keyToken),
+                    let token = try scanner.next() {
+
+                    let mapValue: ValueType.BaseType?
+                    scanner.pushback(token: token)
+                    var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+                    switch token {
+                    case .beginObject, .boolean(_), .string(_), .number(_):
+                        mapValue = try ValueType.decodeJSONMapFieldValue(jsonDecoder: &subDecoder)
+                        if mapValue == nil {
+                            throw ProtobufDecodingError.malformedJSON
+                        }
+                    default:
+                        throw ProtobufDecodingError.malformedJSON
+                    }
+                    value[mapKey] = mapValue
+                } else {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectComma
+            case .comma:
+                if state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectKey
+            case .endObject:
+                if state != .expectFirstKey && state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                return true
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+internal struct ProtobufJSONArrayFieldDecoder: ProtobufJSONFieldDecoder {
+    var scanner: ProtobufJSONScanner
+
+    // Decode a field containing repeated basic type
+    mutating func decodeRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        var token: ProtobufJSONToken
+        if let startToken = try scanner.next() {
+            switch startToken {
+            case .endArray: return true // Empty array case
+            default: token = startToken
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+
+        while true {
+            switch token {
+            case .boolean(_), .string(_), .number(_):
+                try S.setFromJSONToken(token: token, value: &value)
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+            if let separatorToken = try scanner.next() {
+                switch separatorToken {
+                case .comma:
+                    if let t = try scanner.next() {
+                       token = t
+                    } else {
+                       throw ProtobufDecodingError.malformedJSON
+                    }
+                    break
+                case .endArray:
+                    return true
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+
+    mutating func decodePackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: inout [S.BaseType]) throws -> Bool {
+        return try decodeRepeatedField(fieldType: fieldType, value: &value)
+    }
+    
+    mutating func decodeOptionalMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout M?) throws -> Bool {
+        var m = value ?? M()
+        var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+        try m.decodeFromJSONArray(jsonDecoder: &subDecoder)
+        value = m
+        return true
+    }
+
+    mutating func decodeRepeatedMessageField<M: ProtobufMessage>(fieldType: M.Type, value: inout [M]) throws -> Bool {
+        var token: ProtobufJSONToken
+        if let startToken = try scanner.next() {
+            switch startToken {
+            case .endArray: return true // Empty array case
+            default: token = startToken
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+
+        while true {
+            switch token {
+            case .beginObject:
+                var message = M()
+                var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+                try message.decodeFromJSONObject(jsonDecoder: &subDecoder)
+                value.append(message)
+            case .boolean(_), .string(_), .number(_):
+                var message = M()
+                try message.decodeFromJSONToken(token: token)
+                value.append(message)
+            case .null:
+                if let message = try M.decodeFromJSONNull() {
+                    // Sometimes 'null' is a valid message value
+                    value.append(message)
+                } else {
+                    // Otherwise, null is not allowed in repeated fields
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+            if let separatorToken = try scanner.next() {
+                switch separatorToken {
+                case .comma:
+                    if let t = try scanner.next() {
+                       token = t
+                    } else {
+                       throw ProtobufDecodingError.truncatedInput
+                    }
+                    break
+                case .endArray:
+                    return true
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+
+    mutating func decodeRepeatedGroupField<G: ProtobufGroup>(fieldType: G.Type, value: inout [G]) throws -> Bool {
+        var token: ProtobufJSONToken
+        if let startToken = try scanner.next() {
+            switch startToken {
+            case .endArray: return true // Empty array case
+            default: token = startToken
+            }
+        } else {
+            throw ProtobufDecodingError.truncatedInput
+        }
+        
+        while true {
+            switch token {
+            case .beginObject:
+                var group = G()
+                var subDecoder = ProtobufJSONDecoder(scanner: scanner)
+                try group.decodeFromJSONObject(jsonDecoder: &subDecoder)
+                value.append(group)
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+            if let separatorToken = try scanner.next() {
+                switch separatorToken {
+                case .comma:
+                    if let t = try scanner.next() {
+                        token = t
+                    } else {
+                        throw ProtobufDecodingError.truncatedInput
+                    }
+                    break
+                case .endArray:
+                    return true
+                default:
+                    throw ProtobufDecodingError.malformedJSON
+                }
+            }
+        }
+    }
+}
+
+
+private func parseQuotedString( charGenerator: inout String.CharacterView.Generator) -> String? {
+    var result = ""
+    while let c = charGenerator.next() {
+        switch c {
+        case "\"":
+            return result
+        case "\\":
+            if let escaped = charGenerator.next() {
+                switch escaped {
+                case "b": result.append(Character("\u{0008}"))
+                case "t": result.append(Character("\u{0009}"))
+                case "n": result.append(Character("\u{000a}"))
+                case "f": result.append(Character("\u{000c}"))
+                case "r": result.append(Character("\u{000d}"))
+                case "\"": result.append(escaped)
+                case "\\": result.append(escaped)
+                case "/": result.append(escaped)
+                case "u":
+                    if let c1 = fromHexDigit(charGenerator.next()),
+                        let c2 = fromHexDigit(charGenerator.next()),
+                        let c3 = fromHexDigit(charGenerator.next()),
+                        let c4 = fromHexDigit(charGenerator.next()) {
+                            let scalar = ((c1 * 16 + c2) * 16 + c3) * 16 + c4
+                            if let char = UnicodeScalar(scalar) {
+                                result.append(String(char))
+                            } else if scalar < 0xD800 || scalar >= 0xE000 {
+                                // Invalid Unicode scalar
+                                return nil
+                            } else if scalar >= UInt32(0xDC00) {
+                                // Low surrogate is invalid
+                                return nil
+                            } else {
+                                // We have a high surrogate, must be followed by low
+                                if let slash = charGenerator.next(), slash == "\\",
+                                   let u = charGenerator.next(), u == "u",
+                                   let c1 = fromHexDigit(charGenerator.next()),
+                                   let c2 = fromHexDigit(charGenerator.next()),
+                                   let c3 = fromHexDigit(charGenerator.next()),
+                                   let c4 = fromHexDigit(charGenerator.next()) {
+                                    let follower = ((c1 * 16 + c2) * 16 + c3) * 16 + c4
+                                    if follower >= UInt32(0xDC00) && follower < UInt32(0xE000) {
+                                            let high = scalar - UInt32(0xD800)
+                                            let low = follower - UInt32(0xDC00)
+                                            let composed = UInt32(0x10000) + high << 10 + low
+                                            if let char = UnicodeScalar(composed) {
+                                                result.append(String(char))
+                                            } else {
+                                                // Composed value is not valid
+                                                return nil
+                                            }
+                                        } else {
+                                            // high surrogate was not followed by low
+                                            return nil
+                                        }
+                                } else {
+                                    // high surrogate not followed by unicode hex escape
+                                    return nil
+                                }
+                        }
+                    } else {
+                        // Broken unicode escape
+                        return nil
+                    }
+                default:
+                    // Unrecognized backslash escape
+                    return nil
+                }
+            } else {
+                // Input ends in backslash
+                return nil
+            }
+        default:
+            result.append(c)
+        }
+    }
+    // Unterminated quoted string
+    return nil
+}
+
+// Protobuf JSON allows integers (signed and unsigned) to be
+// coded using floating-point exponential format, but does
+// reject anything that actually has a fractional part.
+// This code converts numbers like 4.294967e9 to a standard
+// integer decimal string format 429496700 using only pure
+// textual operations (adding/removing trailing zeros, removing
+// decimal point character).  The result can be handed
+// to IntMax(string:) or UIntMax(string:) as appropriate.
+//
+// Returns an array of Character (to make it easy for clients to
+// check specific character values) or nil if the provided string
+// cannot be normalized to a valid integer format.
+//
+// Here are some sample inputs and outputs to clarify what this function does:
+//   = "0.1.2" => nil (extra period)
+//   = "0x02" => nil (invalid 'x' character)
+//   = "4.123" => nil (not an integer)
+//   = "012" => nil (leading zero rejected)
+//   = "0" => "0" (bare zero is okay)
+//   = "400e-1" => "40" (adjust decimal point)
+//   = "4.12e2" => "412" (adjust decimal point)
+//   = "1.0000" => "1" (drop extraneous trailing zeros)
+//
+// Note: This does reject sequences that are "obviously" out
+// of the range of a 64-bit integer, but that's just to avoid
+// crazy cases like trying to build million-character string for
+// "1e1000000".  The client code is responsible for real range
+// checking.
+//
+private func normalizeIntString(_ s: String) -> [Character]? {
+    var total = 0
+    var digits = 0
+    var fractionalDigits: Int?
+    var hasLeadingZero = false
+    var chars = s.characters.makeIterator()
+    var number = [Character]()
+    while let c = chars.next() {
+        if hasLeadingZero { // Leading zero must be last character
+            return nil
+        }
+        switch c {
+        case "-":
+            if total > 0 {
+                return nil
+            }
+            number.append(c)
+            total += 1
+        case "0":
+            if digits == 0 {
+                hasLeadingZero = true
+            }
+            fallthrough
+        case "1", "2", "3", "4", "5", "6", "7", "8", "9":
+            if fractionalDigits != nil {
+                fractionalDigits = fractionalDigits! + 1
+            } else {
+                digits += 1
+            }
+            number.append(c)
+            total += 1
+        case ".":
+            if fractionalDigits != nil {
+                return nil // Duplicate '.'
+            }
+            fractionalDigits = 0
+            total += 1
+        case "e", "E":
+            var expString = ""
+            var c2 = chars.next()
+            if c2 == "+" || c2 == "-" {
+                expString.append(c2!)
+                c2 = chars.next()
+            }
+            if c2 == nil {
+                return nil
+            }
+            while let expDigit = c2 {
+                switch expDigit {
+                case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9":
+                    expString.append(expDigit)
+                default:
+                    return nil
+                }
+                c2 = chars.next()
+            }
+            // Limit on exp here follows from:
+            //   = 64-bit int has range less than 10 ^ 20,
+            //     so a positive exponent can't result in
+            //     more than 20 digits wihout overflow
+            //   = Value must be integral, so a negative exponent
+            //     can't be greater than number of digits
+            // The limit here is deliberately sloppy, it is only intended
+            // to avoid painful abuse cases (e.g., 1e1000000000 will be
+            // quickly dropped without trying to build a an array
+            // of a billion characters).
+            if let exp = Int(expString), exp + digits < 20 && exp > -digits {
+                // Fold fractional digits into exponent
+                var adjustment = exp - (fractionalDigits ?? 0)
+                fractionalDigits = 0
+                // Adjust digit string to account for exponent
+                while adjustment > 0 {
+                    number.append("0")
+                    adjustment -= 1
+                }
+                while adjustment < 0 {
+                    if number.isEmpty || number[number.count - 1] != "0" {
+                        return nil
+                    }
+                    number.remove(at: number.count - 1)
+                    adjustment += 1
+                }
+            } else {
+                // Error if exponent is malformed or out of range
+                return nil
+            }
+        default:
+            return nil
+        }
+    }
+    if number.isEmpty {
+        return nil
+    }
+    // Allow 7.000 and 1.23000e2 by trimming fractional zero digits
+    if let f = fractionalDigits {
+        var fractionalDigits = f
+        while fractionalDigits > 0 && !number.isEmpty && number[number.count - 1] == "0" {
+            number.remove(at: number.count - 1)
+            fractionalDigits -= 1
+        }
+        if fractionalDigits > 0 {
+            return nil
+        }
+    }
+    return number
+}
+
+private func decodeBytes(_ s: String) -> [UInt8]? {
+    var out = [UInt8]()
+    let digits = s.utf8
+    var n = 0
+    var bits = 0
+    for (i, digit) in digits.enumerated() {
+        n <<= 6
+        switch digit {
+        case 65...90: n |= Int(digit - 65); bits += 6
+        case 97...122: n |= Int(digit - 97 + 26); bits += 6
+        case 48...57: n |= Int(digit - 48 + 52); bits += 6
+        case 43: n |= 62; bits += 6
+        case 47: n |= 63; bits += 6
+        case 61: n |= 0
+        default:
+            return nil
+        }
+        if i % 4 == 3 {
+            out.append(UInt8(truncatingBitPattern: n >> 16))
+            if bits >= 16 {
+                out.append(UInt8(truncatingBitPattern: n >> 8))
+                if bits >= 24 {
+                    out.append(UInt8(truncatingBitPattern: n))
+                }
+            }
+            bits = 0
+        }
+    }
+    if bits != 0 {
+        return nil
+    }
+    return out
+}
+
+
+public enum ProtobufJSONToken: Equatable, ProtobufFieldDecoder {
+    case colon
+    case comma
+    case beginObject
+    case endObject
+    case beginArray
+    case endArray
+    case null
+    case boolean(Bool)
+    case string(String)
+    case number(String)
+    
+    public var asBoolean: Bool? {
+        switch self {
+        case .boolean(let b): return b
+        default: return nil
+        }
+    }
+    
+    public var asBooleanMapKey: Bool? {
+        switch self {
+        case .string("true"): return true
+        case .string("false"): return false
+        default: return nil
+        }
+    }
+
+    var asInt64: Int64? {
+        let text: String
+        switch self {
+        case .string(let s): text = s
+        case .number(let n): text = n
+        default: return nil
+        }
+        if let normalized = normalizeIntString(text) {
+            let numberString = String(normalized)
+            if let n = Int64(numberString) {
+                return n
+            }
+        }
+        return nil
+    }
+
+    var asInt32: Int32? {
+        let text: String
+        switch self {
+        case .string(let s): text = s
+        case .number(let n): text = n
+        default: return nil
+        }
+        if let normalized = normalizeIntString(text) {
+            let numberString = String(normalized)
+            if let n = Int32(numberString) {
+                return n
+            }
+        }
+        return nil
+    }
+
+    var asUInt64: UInt64? {
+        let text: String
+        switch self {
+        case .string(let s): text = s
+        case .number(let n): text = n
+        default: return nil
+        }
+        if let normalized = normalizeIntString(text), normalized[0] != "-" {
+            let numberString = String(normalized)
+            if let n = UInt64(numberString) {
+                return n
+            }
+        }
+        return nil
+    }
+
+    var asUInt32: UInt32? {
+        let text: String
+        switch self {
+        case .string(let s): text = s
+        case .number(let n): text = n
+        default: return nil
+        }
+        if let normalized = normalizeIntString(text), normalized[0] != "-" {
+            let numberString = String(normalized)
+            if let n = UInt32(numberString) {
+                return n
+            }
+        }
+        return nil
+    }
+
+    var asFloat: Float? {
+        switch self {
+        case .string(let s): return Float(s)
+        case .number(let n): return Float(n)
+        default: return nil
+        }
+    }
+
+    var asDouble: Double? {
+        switch self {
+        case .string(let s): return Double(s)
+        case .number(let n): return Double(n)
+        default: return nil
+        }
+    }
+
+    var asBytes: [UInt8]? {
+        switch self {
+        case .string(let s): return decodeBytes(s)
+        default: return nil
+        }
+    }
+}
+
+public func ==(lhs: ProtobufJSONToken, rhs: ProtobufJSONToken) -> Bool {
+    switch (lhs, rhs) {
+    case (.colon, .colon),
+    (.comma, .comma),
+    (.beginObject, .beginObject),
+    (.endObject, .endObject),
+    (.beginArray, .beginArray),
+    (.endArray, .endArray),
+    (.null, .null):
+        return true
+    case (.boolean(let a), .boolean(let b)):
+        return a == b
+    case (.string(let a), .string(let b)):
+        return a == b
+    case (.number(let a), .number(let b)):
+        return a == b
+    default:
+        return false
+    }
+}
+
+public class ProtobufJSONScanner {
+    fileprivate var extensions: ProtobufExtensionSet?
+    private var charGenerator: String.CharacterView.Generator
+    private var characterPushback: Character?
+    private var tokenPushback: [ProtobufJSONToken]
+    private var eof: Bool = false
+    private var wordSeparator: Bool = true
+    public var complete: Bool {
+        switch characterPushback {
+        case .some(" "), .some("\t"), .some("\r"), .some("\n"): break
+        case .none: break
+        default:
+            return false
+        }
+        var g = charGenerator
+        while let c = g.next() {
+            switch c {
+            case " ", "\t", "\r", "\n":
+                break
+            default:
+                return false
+            }
+        }
+        return true
+    }
+
+    public init(json: String, tokens: [ProtobufJSONToken], extensions: ProtobufExtensionSet? = nil) {
+        charGenerator = json.characters.makeIterator()
+        tokenPushback = tokens.reversed()
+        self.extensions = extensions
+    }
+
+    public func pushback(token: ProtobufJSONToken) {
+        tokenPushback.append(token)
+    }
+
+    public func next() throws -> ProtobufJSONToken? {
+        if eof {
+            return nil
+        }
+        if let t = tokenPushback.popLast() {
+            return t
+        }
+        while let next = characterPushback ?? charGenerator.next() {
+            characterPushback = nil
+            switch next {
+            case " ", "\t", "\r", "\n":
+                wordSeparator = true
+                break
+            case ":":
+                wordSeparator = true
+                return .colon
+            case ",":
+                wordSeparator = true
+                return .comma
+            case "{":
+                wordSeparator = true
+                return .beginObject
+            case "}":
+                wordSeparator = true
+                return .endObject
+            case "[":
+                wordSeparator = true
+                return .beginArray
+            case "]":
+                wordSeparator = true
+                return .endArray
+            case "n": // null
+                if wordSeparator {
+                    wordSeparator = false
+                    if let u = charGenerator.next(), u == "u" {
+                        if let l = charGenerator.next(), l == "l" {
+                            if let l = charGenerator.next(), l == "l" {
+                                return .null
+                            }
+                        }
+                    }
+                }
+                throw ProtobufDecodingError.malformedJSON
+            case "t": // true
+                if wordSeparator {
+                    wordSeparator = false
+                    if let r = charGenerator.next(), r == "r" {
+                        if let u = charGenerator.next(), u == "u" {
+                            if let e = charGenerator.next(), e == "e" {
+                                return .boolean(true)
+                            }
+                        }
+                    }
+                }
+                throw ProtobufDecodingError.malformedJSON
+            case "f": // false
+                if wordSeparator {
+                    wordSeparator = false
+                    if let a = charGenerator.next(), a == "a" {
+                        if let l = charGenerator.next(), l == "l" {
+                            if let s = charGenerator.next(), s == "s" {
+                                if let e = charGenerator.next(), e == "e" {
+                                    return .boolean(false)
+                                }
+                            }
+                        }
+                    }
+                }
+                throw ProtobufDecodingError.malformedJSON
+            case "\"": // string
+                if wordSeparator {
+                    wordSeparator = false
+                    if let s = parseQuotedString(charGenerator: &charGenerator) {
+                        return .string(s)
+                    }
+                }
+                throw ProtobufDecodingError.malformedJSON
+            case "-", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9":
+                if wordSeparator {
+                    wordSeparator = false
+                    var s = String(next)
+                    while let c = charGenerator.next() {
+                        switch c {
+                        case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "+", "-", "e", "E":
+                            s.append(c)
+                        default:
+                            characterPushback = c // Note: Only place we need pushback
+                            return .number(s)
+                        }
+                    }
+                    return .number(s)
+                }
+                throw ProtobufDecodingError.malformedJSON
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        eof = true
+        return nil
+    }
+}

+ 296 - 0
Sources/Protobuf/ProtobufJSONEncoding.swift

@@ -0,0 +1,296 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufJSONEncoding.swift - JSON Encoding support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// JSON serialization engine.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public struct ProtobufJSONEncodingVisitor: ProtobufVisitor {
+    private var encoder = ProtobufJSONEncoder()
+    public var result: String {return encoder.result}
+
+    public init() {}
+
+    public init(message: ProtobufJSONMessageBase) throws {
+        try withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try message.traverse(visitor: &visitor)
+        }
+    }
+
+    public init(group: ProtobufGroupBase) throws {
+        try withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try group.traverse(visitor: &visitor)
+        }
+    }
+
+    mutating public func withAbstractVisitor(clause: (inout ProtobufVisitor) throws -> ()) throws {
+        encoder.startObject()
+        var visitor: ProtobufVisitor = self
+        try clause(&visitor)
+        encoder.json = (visitor as! ProtobufJSONEncodingVisitor).encoder.json
+        encoder.endObject()
+    }
+
+
+    mutating public func visitUnknown(bytes: [UInt8]) {
+        // JSON encoding has no provision for carrying proto2 unknown fields
+    }
+
+    mutating public func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        try S.serializeJSONValue(encoder: &encoder, value: value)
+    }
+
+    mutating public func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        var arraySeparator = ""
+        encoder.append(text: "[")
+        for v in value {
+            encoder.append(text: arraySeparator)
+            try S.serializeJSONValue(encoder: &encoder, value: v)
+            arraySeparator = ","
+        }
+        encoder.append(text: "]")
+    }
+
+    mutating public func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        try visitRepeatedField(fieldType: fieldType, value: value, protoFieldNumber: protoFieldNumber, protoFieldName: protoFieldName, jsonFieldName: jsonFieldName, swiftFieldName: swiftFieldName)
+    }
+
+    mutating public func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        // Note: We ask the message to serialize itself instead of
+        // using ProtobufJSONEncodingVisitor(message:) since
+        // some messages override the JSON format at this point.
+        try M.serializeJSONValue(encoder: &encoder, value: value)
+    }
+
+    mutating public func visitRepeatedMessageField<M: ProtobufMessage>(value: [M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        var arraySeparator = ""
+        encoder.append(text: "[")
+        for v in value {
+            encoder.append(text: arraySeparator)
+            // Note: We ask the message to serialize itself instead of
+            // using ProtobufJSONEncodingVisitor(message:) since
+            // some messages override the JSON format at this point.
+            try M.serializeJSONValue(encoder: &encoder, value: v)
+            arraySeparator = ","
+        }
+        encoder.append(text: "]")
+    }
+
+    // Note that JSON encoding for groups is not officially supported
+    // by any Google spec.  But it's trivial to support it here.
+    mutating public func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        // Groups have no special JSON support, so we use only the generic traversal mechanism here
+        let t = try ProtobufJSONEncodingVisitor(group: value).result
+        encoder.append(text: t)
+    }
+
+    mutating public func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        encoder.startField(name: jsonFieldName)
+        var arraySeparator = ""
+        encoder.append(text: "[")
+        for v in value {
+            encoder.append(text: arraySeparator)
+            // Groups have no special JSON support, so we use only the generic traversal mechanism here
+            let t = try ProtobufJSONEncodingVisitor(group: v).result
+            encoder.append(text: t)
+            arraySeparator = ","
+        }
+        encoder.append(text: "]")
+    }
+
+    mutating public func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws  where KeyType.BaseType: Hashable {
+        encoder.startField(name: jsonFieldName)
+        var arraySeparator = ""
+        encoder.append(text: "{")
+        for (k,v) in value {
+            encoder.append(text: arraySeparator)
+            KeyType.serializeJSONMapKeyValue(encoder: &encoder, value: k)
+            encoder.append(text: ":")
+            try ValueType.serializeJSONValue(encoder: &encoder, value: v)
+            arraySeparator = ","
+        }
+        encoder.append(text: "}")
+    }
+}
+
+
+public struct ProtobufJSONEncoder {
+    fileprivate var json: [String] = []
+    private var separator: String = ""
+    public init() {}
+    public var result: String { return json.joined(separator: "") }
+
+    mutating func append(text: String) {
+        json.append(text)
+    }
+    mutating func appendTokens(tokens: [ProtobufJSONToken]) {
+        for t in tokens {
+            switch t {
+            case .beginArray: append(text: "[")
+            case .beginObject: append(text: "{")
+            case .boolean(let v):
+                // Note that quoted boolean map keys get stored as .string()
+                putBoolValue(value: v, quote: false)
+            case .colon: append(text: ":")
+            case .comma: append(text: ",")
+            case .endArray: append(text: "]")
+            case .endObject: append(text: "}")
+            case .null: putNullValue()
+            case .number(let v): append(text: v)
+            case .string(let v): putStringValue(value: v)
+            }
+        }
+    }
+    mutating func startField(name: String) {
+        append(text: separator + "\"" + name + "\":")
+        separator = ","
+    }
+    public mutating func startObject() {
+        append(text: "{")
+        separator = ""
+    }
+    public mutating func endObject() {
+        append(text: "}")
+        separator = ","
+    }
+    mutating func putNullValue() {
+        append(text: "null")
+    }
+    mutating func putFloatValue(value: Float, quote: Bool) {
+        putDoubleValue(value: Double(value), quote: quote)
+    }
+    mutating func putDoubleValue(value: Double, quote: Bool) {
+        if value.isNaN {
+            append(text: "\"NaN\"")
+        } else if !value.isFinite {
+            if value < 0 {
+                append(text: "\"-Infinity\"")
+            } else {
+                append(text: "\"Infinity\"")
+            }
+        } else {
+            // TODO: Be smarter here about choosing significant digits
+            // See: protoc source has C++ code for this with interesting ideas
+            let s: String
+            if value < Double(Int64.max) && value > Double(Int64.min) && value == Double(Int64(value)) {
+                s = String(Int64(value))
+            } else {
+                s = String(value)
+            }
+            if quote {
+                append(text: "\"" + s + "\"")
+            } else {
+                append(text: s)
+            }
+        }
+    }
+    mutating func putInt64(value: Int64, quote: Bool) {
+        // Always quote integers with abs value > 2^53
+        if quote || value > 0x1FFFFFFFFFFFFF || value < -0x1FFFFFFFFFFFFF {
+            append(text: "\"" + String(value) + "\"")
+        } else {
+            append(text: String(value))
+        }
+    }
+    mutating func putUInt64(value: UInt64, quote: Bool) {
+        if quote || value > 0x1FFFFFFFFFFFFF { // 2^53 - 1
+            append(text: "\"" + String(value) + "\"")
+        } else {
+            append(text: String(value))
+        }
+    }
+
+    mutating func putBoolValue(value: Bool, quote: Bool) {
+        if quote {
+            append(text: value ? "\"true\"" : "\"false\"")
+        } else {
+            append(text: value ? "true" : "false")
+        }
+    }
+    mutating func putStringValue(value: String) {
+        let hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
+        append(text: "\"")
+        for c in value.unicodeScalars {
+            switch c.value {
+            // Special two-byte escapes
+            case 8: append(text: "\\b")
+            case 9: append(text: "\\t")
+            case 10: append(text: "\\n")
+            case 12: append(text: "\\f")
+            case 13: append(text: "\\r")
+            case 34: append(text: "\\\"")
+            case 92: append(text: "\\\\")
+            case 0...31, 127...159: // Hex form for C0 and C1 control chars
+                let digit1 = hexDigits[Int(c.value / 16)]
+                let digit2 = hexDigits[Int(c.value & 15)]
+                append(text: "\\u00\(digit1)\(digit2)")
+            case 0...127:  // ASCII
+                append(text: String(c))
+            default: // Non-ASCII
+                append(text: String(c))
+            }
+        }
+        append(text: "\"")
+    }
+    mutating func putBytesValue(value: [UInt8]) {
+        var out: String = ""
+        if value.count > 0 {
+            let digits: [Character] = ["A", "B", "C", "D", "E", "F",
+            "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
+            "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b",
+            "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
+            "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
+            "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8",
+            "9", "+", "/"]
+            var t: Int = 0
+            for (i,v) in value.enumerated() {
+                if i > 0 && i % 3 == 0 {
+                    out.append(digits[(t >> 18) & 63])
+                    out.append(digits[(t >> 12) & 63])
+                    out.append(digits[(t >> 6) & 63])
+                    out.append(digits[t & 63])
+                    t = 0
+                }
+                t <<= 8
+                t += Int(v)
+            }
+            switch value.count % 3 {
+            case 0:
+                out.append(digits[(t >> 18) & 63])
+                out.append(digits[(t >> 12) & 63])
+                out.append(digits[(t >> 6) & 63])
+                out.append(digits[t & 63])
+            case 1:
+                t <<= 16
+                out.append(digits[(t >> 18) & 63])
+                out.append(digits[(t >> 12) & 63])
+                out.append(Character("="))
+                out.append(Character("="))
+            default:
+                t <<= 8
+                out.append(digits[(t >> 18) & 63])
+                out.append(digits[(t >> 12) & 63])
+                out.append(digits[(t >> 6) & 63])
+                out.append(Character("="))
+            }
+        }
+        append(text: "\"" + out + "\"")
+    }
+}
+

+ 964 - 0
Sources/Protobuf/ProtobufJSONTypes.swift

@@ -0,0 +1,964 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufJSONTypes.swift - JSON primitive types
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Extend the type definitions from ProtobufTypes.swift with details
+/// of JSON handling.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol ProtobufJSONCodableType: ProtobufTypePropertiesBase {
+    static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: BaseType) throws
+    /// Consume tokens from a JSON decoder
+    static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> BaseType?
+    /// Set the value given a single JSON token
+    static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws
+    /// Update the repeated value given a single JSON token (used by repeated fields of basic types)
+    static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws
+}
+
+extension ProtobufJSONCodableType {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+}
+
+public protocol ProtobufJSONCodableMapKeyType: ProtobufTypePropertiesBase {
+    static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: BaseType)
+    static func decodeJSONMapKeyValue(token: ProtobufJSONToken) throws -> BaseType?
+}
+
+///
+/// Float traits
+///
+public extension ProtobufFloat {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asFloat {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asFloat {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Float) {
+        encoder.putFloatValue(value: value, quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Float? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asFloat {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+///
+/// Double traits
+///
+public extension ProtobufDouble {
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asDouble {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asDouble {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Double) {
+        encoder.putDoubleValue(value: value, quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Double? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asDouble {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+///
+/// Int32 traits
+///
+public extension ProtobufInt32 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt32 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt32 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int32? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt32 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int32? {
+        return token.asInt32
+    }
+}
+
+///
+/// Int64 traits
+///
+public extension ProtobufInt64 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt64 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt64 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int64? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt64 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int64? {
+        return token.asInt64
+    }
+}
+
+///
+/// UInt32 traits
+///
+public extension ProtobufUInt32 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asUInt32 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asUInt32 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: UInt32) {
+        encoder.putUInt64(value: UInt64(value), quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> UInt32? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asUInt32 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> UInt32? {
+        return token.asUInt32
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: UInt32) {
+        encoder.putUInt64(value: UInt64(value), quote: true)
+    }
+}
+
+///
+/// UInt64 traits
+///
+public extension ProtobufUInt64 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asUInt64 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asUInt64 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: UInt64) {
+        encoder.putUInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> UInt64? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asUInt64 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: UInt64) {
+        encoder.putUInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> UInt64? {
+        return token.asUInt64
+    }
+}
+
+///
+/// SInt32 traits
+///
+public extension ProtobufSInt32 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt32 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt32 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int32? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt32 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int32? {
+        return token.asInt32
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: true)
+    }
+}
+
+///
+/// SInt64 traits
+///
+public extension ProtobufSInt64 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt64 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt64 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int64? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt64 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int64? {
+        return token.asInt64
+    }
+}
+
+///
+/// Fixed32 traits
+///
+public extension ProtobufFixed32 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asUInt32 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asUInt32 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: UInt32) {
+        encoder.putUInt64(value: UInt64(value), quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> UInt32? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asUInt32 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: UInt32) {
+        encoder.putUInt64(value: UInt64(value), quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> UInt32? {
+        return token.asUInt32
+    }
+}
+
+///
+/// Fixed64 traits
+///
+public extension ProtobufFixed64 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asUInt64 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asUInt64 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: UInt64) {
+        encoder.putUInt64(value: value, quote: true)
+    }
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> UInt64? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asUInt64 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: UInt64) {
+        encoder.putUInt64(value: value.littleEndian, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> UInt64? {
+        return token.asUInt64
+    }
+}
+
+///
+/// SFixed32 traits
+///
+public extension ProtobufSFixed32 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt32 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt32 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int32? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt32 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int32) {
+        encoder.putInt64(value: Int64(value), quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int32? {
+        return token.asInt32
+    }
+}
+
+///
+/// SFixed64 traits
+///
+public extension ProtobufSFixed64 {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asInt64 {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asInt64 {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Int64? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asInt64 {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSONNumber
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Int64) {
+        encoder.putInt64(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Int64? {
+        return token.asInt64
+    }
+}
+
+///
+/// Bool traits
+///
+public extension ProtobufBool {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asBoolean {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asBoolean {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Bool) {
+        encoder.putBoolValue(value: value, quote: false)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Bool? {
+        if let t = try jsonDecoder.nextToken() {
+            if case .null = t {
+                return nil
+            } else if let n = t.asBoolean {
+                return n
+            }
+            throw ProtobufDecodingError.malformedJSON
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: Bool) {
+        encoder.putBoolValue(value: value, quote: true)
+    }
+
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> Bool? {
+        return token.asBooleanMapKey
+    }
+}
+
+///
+/// String traits
+///
+public extension ProtobufString {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if case .string(let s) = token {
+            value = s
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if case .string(let s) = token {
+            value.append(s)
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: String) {
+        encoder.putStringValue(value: value)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> String? {
+        switch try jsonDecoder.nextToken() {
+        case .some(.string(let s)):
+            return s
+        case .some(.null):
+            return nil
+        case .some(_):
+            throw ProtobufDecodingError.malformedJSON
+        default:
+            throw ProtobufDecodingError.truncatedInput
+        }
+    }
+
+    public static func serializeJSONMapKeyValue(encoder: inout ProtobufJSONEncoder, value: String) {
+        encoder.putStringValue(value: value)
+    }
+    public static func decodeJSONMapKeyValue(token: ProtobufJSONToken) -> String? {
+        if case .string(let s) = token {
+            return s
+        }
+        return nil
+    }
+}
+
+///
+/// Bytes traits
+///
+public extension ProtobufBytes {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout BaseType?) throws {
+        if let n = token.asBytes {
+            value = n
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [BaseType]) throws {
+        if let n = token.asBytes {
+            value.append(n)
+        } else {
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: [UInt8]) {
+        encoder.putBytesValue(value: value)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> [UInt8]? {
+        if let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .string(_):
+                if let bytes = token.asBytes {
+                    return bytes
+                }
+            case .null:
+                return nil
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+//
+// Enum traits
+//
+extension ProtobufEnum where RawValue == Int {
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout Self?) throws {
+        switch token {
+        case .string(let s):
+            if let b = Self(jsonName: s) {
+                value = b
+            } else {
+                throw ProtobufDecodingError.unrecognizedEnumValue
+            }
+        case .number(_):
+            if let n = token.asInt32 {
+                value = Self(rawValue: Int(n))
+            } else {
+                throw ProtobufDecodingError.malformedJSONNumber
+            }
+        default:
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func setFromJSONToken(token: ProtobufJSONToken, value: inout [Self]) throws {
+        switch token {
+        case .string(let s):
+            if let b = Self(jsonName: s) {
+                value.append(b)
+            } else {
+                throw ProtobufDecodingError.unrecognizedEnumValue
+            }
+        case .number(_):
+            if let n = token.asInt32 {
+                let e = Self(rawValue: Int(n))! // Note: Can never fail!
+                value.append(e)
+            } else {
+                throw ProtobufDecodingError.malformedJSONNumber
+            }
+        default:
+            throw ProtobufDecodingError.malformedJSON
+        }
+    }
+
+    public static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Self) {
+        encoder.append(text: value.json)
+    }
+
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Self? {
+        if let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .null: return nil
+            case .string(let s):
+                if let b = Self(jsonName: s) {
+                    return b
+                }
+                throw ProtobufDecodingError.unrecognizedEnumValue
+            case .number(_):
+                if let n = token.asInt32 {
+                    return Self(rawValue: Int(n))
+                }
+                throw ProtobufDecodingError.malformedJSONNumber
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+///
+/// Messages
+///
+public protocol ProtobufJSONMessageBase: ProtobufMessageBase {
+    init()
+
+    // Serialize to JSON
+    func serializeJSON() throws -> String
+
+    // Decode from JSON
+    init(json: String) throws
+    // Decode from JSON
+    init(json: String, extensions: ProtobufExtensionSet) throws
+
+    // TODO:  Can we get rid of this?
+    mutating func decodeFromJSON(jsonDecoder: inout ProtobufJSONDecoder) throws -> Bool
+    // Messages such as Value, NullValue override this to decode from Null.
+    // Default just returns nil.
+    static func decodeFromJSONNull() throws -> Self?
+    // Duration, Timestamp, FieldMask override this
+    // to decode themselves from a single token.
+    // Default always throws an error.
+    mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws
+    // Value, Struct, Any override this to change
+    // how they decode from a JSON object form.
+    // Default decodes keys and feeds them to decodeField()
+    mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws
+    // Value, ListValue override this to decode self from a JSON array form
+    // Default always throws an error
+    mutating func decodeFromJSONArray(jsonDecoder: inout ProtobufJSONDecoder) throws
+}
+
+public extension ProtobufJSONMessageBase {
+    public static func decodeJSONMapFieldValue(jsonDecoder: inout ProtobufJSONDecoder) throws -> Self? {
+        var m = Self()
+        if try m.decodeFromJSON(jsonDecoder: &jsonDecoder) {
+            return m
+        } else {
+            return nil
+        }
+    }
+
+    func serializeJSON() throws -> String {
+        return try ProtobufJSONEncodingVisitor(message: self).result
+    }
+
+    func serializeAnyJSON() throws -> String {
+        var jsonVisitor = ProtobufJSONEncodingVisitor()
+        try jsonVisitor.withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try visitor.visitSingularField(fieldType: ProtobufString.self, value: anyTypeURL, protoFieldNumber: 1, protoFieldName: "type_url", jsonFieldName: "@type", swiftFieldName: "typeURL")
+            try traverse(visitor: &visitor)
+        }
+        return jsonVisitor.result
+    }
+
+    // TODO: Can we get rid of this?  (This is leftover from an earlier generation of JSON encoding logic.)
+    static func serializeJSONValue(encoder: inout ProtobufJSONEncoder, value: Self) throws {
+        let json = try value.serializeJSON()
+        encoder.append(text: json)
+    }
+
+    // TODO: Can we get rid of this?  (This is leftover from an earlier generation of JSON decoding logic.)
+    public mutating func decodeFromJSON(jsonDecoder: inout ProtobufJSONDecoder) throws -> Bool {
+        if let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .beginObject:
+                try decodeFromJSONObject(jsonDecoder: &jsonDecoder)
+                return true
+            case .null:
+                break
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        return false
+    }
+
+    /// Decode an instance of this message type from the provided JSON string.
+    /// JSON "null" decodes to an empty object.
+    public init(json: String) throws {
+        self.init()
+        var jsonDecoder = ProtobufJSONDecoder(json: json)
+        try jsonDecoder.decodeFullObject(message: &self)
+        if !jsonDecoder.complete {
+            throw ProtobufDecodingError.trailingGarbage
+        }
+    }
+
+    public init(json: String, extensions: ProtobufExtensionSet) throws {
+        self.init()
+        var jsonDecoder = ProtobufJSONDecoder(json: json, extensions: extensions)
+        try jsonDecoder.decodeFullObject(message: &self)
+        if !jsonDecoder.complete {
+            throw ProtobufDecodingError.trailingGarbage
+        }
+    }
+
+    public static func decodeFromJSONNull() -> Self? {
+        return nil
+    }
+
+    public mutating func decodeFromJSONToken(token: ProtobufJSONToken) throws {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+
+    public mutating func decodeFromJSONArray(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        throw ProtobufDecodingError.schemaMismatch
+    }
+}
+
+extension ProtobufMessage {
+    // Open curly brace already consumed.
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var key = ""
+        var state = ProtobufJSONDecoder.ObjectParseState.expectFirstKey
+        while let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .string(let s): // This is a key
+                if state != .expectKey && state != .expectFirstKey {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                key = s
+                state = .expectColon
+            case .colon:
+                if state != .expectColon {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                try jsonDecoder.decodeValue(key: key, message: &self)
+                state = .expectComma
+            case .comma:
+                if state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectKey
+            case .endObject:
+                if state != .expectFirstKey && state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                return
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+///
+/// Groups
+///
+public extension ProtobufGroup {
+    // Open curly brace already consumed.
+    public mutating func decodeFromJSONObject(jsonDecoder: inout ProtobufJSONDecoder) throws {
+        var key = ""
+        var state = ProtobufJSONDecoder.ObjectParseState.expectFirstKey
+        while let token = try jsonDecoder.nextToken() {
+            switch token {
+            case .string(let s): // This is a key
+                if state != .expectKey && state != .expectFirstKey {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                key = s
+                state = .expectColon
+            case .colon:
+                if state != .expectColon {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                try jsonDecoder.decodeValue(key: key, group: &self)
+                state = .expectComma
+            case .comma:
+                if state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                state = .expectKey
+            case .endObject:
+                if state != .expectFirstKey && state != .expectComma {
+                    throw ProtobufDecodingError.malformedJSON
+                }
+                return
+            default:
+                throw ProtobufDecodingError.malformedJSON
+            }
+        }
+        throw ProtobufDecodingError.truncatedInput
+    }
+}
+
+///
+/// Maps
+///
+public extension ProtobufMap {
+}

+ 166 - 0
Sources/Protobuf/ProtobufMessage.swift

@@ -0,0 +1,166 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufMessage.swift - Message support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// All messages implement some of these protocols:  Generated messages output
+/// by protoc implement ProtobufGeneratedMessageType, hand-coded messages often
+/// implement ProtobufAbstractMessage.  The protocol heirarchy here is
+/// a little involved due to the variety of requirements and the need to
+/// mix in JSON and binary support (see ProtobufBinaryTypes and ProtobufJSONTypes
+/// for extensions that support binary and JSON coding).
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+///
+/// See ProtobufBinaryTypes and ProtobufJSONTypes for extensions
+/// to these protocols for supporting binary and JSON coding.
+///
+
+///
+/// The core protocol implemented by all messages, whether generated
+/// or hand-coded.
+///
+/// In particular, this has no associated types or self references
+/// so can be used as a variable or argument type.
+///
+public protocol ProtobufMessageBase: CustomDebugStringConvertible, ProtobufTraversable {
+    init()
+
+    // Basic facts about this class and the proto message it was generated from
+    // Used by various encoders and decoders
+    var swiftClassName: String { get }
+    var protoMessageName: String { get }
+    var protoPackageName: String { get }
+    var anyTypePrefix: String { get }
+    var anyTypeURL: String { get }
+    var jsonFieldNames: [String: Int] {get}
+    var protoFieldNames: [String: Int] {get}
+
+    /// Decode a field identified by a field number (as given in the .proto file).
+    ///
+    /// This is the core method used by the deserialization machinery.
+    ///
+    /// Note that this is not specific to protobuf encoding; formats
+    /// that use textual identifiers translate those to protoFieldNumbers and
+    /// then invoke this to decode the field value.
+    mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool
+
+    // The corresponding serialization support is the traverse() method
+    // declared in ProtobufTraversable
+
+    // Decode from an Any (which might itself have been decoded from JSON,
+    // protobuf, or another Any)
+    init(any: Google_Protobuf_Any) throws
+
+    /// Serialize as an Any object in JSON format
+    /// For generated message types, this generates the same JSON object
+    /// as serializeJSON() except it adds an additional `@type` field.
+    func serializeAnyJSON() throws -> String
+
+    // Standard utility properties and methods.
+    // Most of these are simple wrappers on top of the visitor machinery.
+    // They are implemented in the protocol, not in the generated structs,
+    // so can be overridden in user code by defining custom extensions to
+    // the generated struct.
+    var isEmpty: Bool { get }
+    var hashValue: Int { get }
+    var debugDescription: String { get }
+    var customMirror: Mirror { get }
+}
+
+public extension ProtobufMessageBase {
+    var hashValue: Int {return ProtobufHashVisitor(message: self).hashValue}
+
+    var debugDescription: String {return ProtobufDebugDescriptionVisitor(message: self).description}
+
+    var customMirror: Mirror {return ProtobufMirrorVisitor(message: self).mirror}
+
+    // TODO:  Add an option to the generator to override this in particular messages.
+    // TODO:  It would be nice if this could default to "" instead; that would save ~20
+    // bytes on every serialized Any.
+    var anyTypePrefix: String {return "type.googleapis.com"}
+
+    var anyTypeURL: String {
+        var url = anyTypePrefix
+        if anyTypePrefix == "" || anyTypePrefix.characters.last! != "/" {
+            url += "/"
+        }
+        if protoPackageName != "" {
+            url += protoPackageName
+            url += "."
+        }
+        url += protoMessageName
+        return url
+    }
+}
+
+///
+/// ProtobufMessage which extends ProtobufMessageBase with some
+/// additional requirements, including serialization extensions.
+/// This is used directly by hand-coded message implementations.
+///
+public protocol ProtobufMessage: ProtobufMessageBase, ProtobufBinaryMessageBase, ProtobufJSONMessageBase, CustomReflectable {
+}
+
+public protocol ProtobufAbstractMessage: ProtobufMessage, Hashable, ProtobufMapValueType {
+    func isEqualTo(other: Self) -> Bool
+}
+
+public extension ProtobufAbstractMessage {
+    static func isEqual(_ lhs: Self, _ rhs: Self) -> Bool {
+        return lhs == rhs
+    }
+
+    public init(any: Google_Protobuf_Any) throws {
+        self.init()
+        try any.unpackTo(target: &self)
+    }
+}
+
+public func ==<M: ProtobufAbstractMessage>(lhs: M, rhs: M) -> Bool {
+    return lhs.isEqualTo(other: rhs)
+}
+
+///
+/// Base type for Generated message types
+///
+/// This provides some basic indirection so end users can override
+/// generated methods.
+///
+public protocol ProtobufGeneratedMessage: ProtobufAbstractMessage {
+    // The compiler actually generates the following methods.
+    // Default implementations below redirect the standard names.
+    // This allows developers to override the standard names to
+    // customize the behavior.
+    mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool
+    func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws
+    func _protoc_generated_isEqualTo(other: Self) -> Bool
+    var _protoc_generated_isEmpty: Bool { get }
+}
+
+public extension ProtobufGeneratedMessage {
+    // Default implementations simply redirect to the generated versions.
+    public func traverse(visitor: inout ProtobufVisitor) throws {
+        try _protoc_generated_traverse(visitor: &visitor)
+    }
+    mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+        return try _protoc_generated_decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
+    }
+    func isEqualTo(other: Self) -> Bool {
+        return _protoc_generated_isEqualTo(other: other)
+    }
+    var isEmpty: Bool { get { return _protoc_generated_isEmpty } }
+}
+
+// TODO: This is a transition aid, remove this in August 2016.
+public typealias ProtobufGeneratedMessageType = ProtobufGeneratedMessage

+ 80 - 0
Sources/Protobuf/ProtobufMirror.swift

@@ -0,0 +1,80 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufMirror.swift - Mirror generation
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Visitor implementation for constructing custom Swift Mirrors
+/// for generated message types.  This is a pretty straightforward
+/// example of the traversal idiom; the only wrinkle being that
+/// the visitor does not recurse into child messages.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public struct ProtobufMirrorVisitor: ProtobufVisitor {
+    private var mirrorChildren: [Mirror.Child] = []
+    private var message: ProtobufMessageBase
+
+    public mutating func fail() {}
+
+    public var mirror: Mirror {
+        get {
+            return Mirror(message, children: mirrorChildren /* displayStyle: .Struct */)
+        }
+    }
+
+    public init(message: ProtobufMessageBase) {
+        self.message = message
+        withAbstractVisitor {(visitor: inout ProtobufVisitor) in
+            try message.traverse(visitor: &visitor)
+        }
+    }
+
+    public mutating func withAbstractVisitor(clause: (inout ProtobufVisitor) throws -> ()) {
+        var visitor: ProtobufVisitor = self
+        let _ = try? clause(&visitor)
+        mirrorChildren.append(contentsOf: (visitor as! ProtobufMirrorVisitor).mirrorChildren)
+    }
+
+    mutating public func visitUnknown(bytes: [UInt8]) {}
+
+    mutating public func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitRepeatedMessageField<M: ProtobufMessage>(value:[M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+   }
+
+    mutating public func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+
+    mutating public func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws where KeyType.BaseType: Hashable {
+        mirrorChildren.append((label: swiftFieldName, value: value))
+    }
+}

+ 27 - 0
Sources/Protobuf/ProtobufOneof.swift

@@ -0,0 +1,27 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufOneof.swift - Oneof support
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// OneOf fields generate enums that conform to ProtobufOneofEnum
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol ProtobufOneofEnum: Equatable {
+    init()
+    func traverse(visitor: inout ProtobufVisitor, start: Int, end: Int) throws
+    mutating func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool
+    var isEmpty: Bool { get }
+}
+
+// TODO: This is a transition aid, remove this in August 2016.
+public typealias ProtobufOneofEnumType = ProtobufOneofEnum

+ 95 - 0
Sources/Protobuf/ProtobufRawMessage.swift

@@ -0,0 +1,95 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufRawMessage.swift - Raw message decoding
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// A "RawMessage" is a tool for parsing proto binary messages without
+/// using a schema of any sort.  This is slow, inconvenient, and unsafe.
+/// Despite these drawbacks, it is occasionally quite useful...
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+// TODO: This is a tentative sketch; needs tests and plenty of more stuff filled in.
+
+public struct ProtobufRawMessage {
+    public private(set) var fieldWireType = [Int: Int]()
+    public private(set) var fieldData = [Int: Any]()
+
+    public init(protobuf: [UInt8]) throws {
+        try protobuf.withUnsafeBufferPointer { (bp) throws in
+            var protobufDecoder = ProtobufBinaryDecoder(protobufPointer: bp)
+            while let tagType = try protobufDecoder.getTagType() {
+                let protoFieldNumber = tagType / 8
+                let wireType = tagType % 8
+                fieldWireType[protoFieldNumber] = wireType
+                switch wireType {
+                case 0:
+                    if let v = try protobufDecoder.decodeUInt64() {
+                        fieldData[protoFieldNumber] = v
+                    } else {
+                        throw ProtobufDecodingError.malformedProtobuf
+                    }
+                case 1:
+                    if let v = try protobufDecoder.decodeFixed64() {
+                        fieldData[protoFieldNumber] = v
+                    } else {
+                        throw ProtobufDecodingError.malformedProtobuf
+                    }
+                case 2:
+                    if let v = try protobufDecoder.decodeBytes() {
+                        fieldData[protoFieldNumber] = v
+                    } else {
+                        throw ProtobufDecodingError.malformedProtobuf
+                    }
+                case 3:
+                    // TODO: Find a useful way to deal with groups
+                    try protobufDecoder.skip()
+                case 5:
+                    if let v = try protobufDecoder.decodeFixed32() {
+                        fieldData[protoFieldNumber] = v
+                    } else {
+                        throw ProtobufDecodingError.malformedProtobuf
+                    }
+                default:
+                    throw ProtobufDecodingError.malformedProtobuf
+                }
+            }
+        }
+    }
+
+    // TODO: serializeProtobuf()
+
+    /// Get the contents of this field as a UInt64
+    /// Returns nil if the field doesn't exist or it's contents cannot be expressed as a UInt64
+    public func getUInt64(protoFieldNumber: Int) -> UInt64? {
+        return fieldData[protoFieldNumber] as? UInt64
+    }
+
+    public func getString(protoFieldNumber: Int) -> String? {
+        if let bytes = fieldData[protoFieldNumber] as? [UInt8] {
+            return bytes.withUnsafeBufferPointer {(buffer) -> String? in
+                buffer.baseAddress?.withMemoryRebound(to: CChar.self, capacity: buffer.count) { (cp) -> String? in
+                    // cp is not null-terminated!
+                    var chars = [CChar](UnsafeBufferPointer<CChar>(start: cp, count: buffer.count))
+                    chars.append(0)
+                    return String(validatingUTF8: chars)
+                }
+            }
+        } else {
+            return nil
+        }
+    }
+
+    // TODO: More getters...
+
+    // TODO: Setters...
+}

+ 46 - 0
Sources/Protobuf/ProtobufTraversal.swift

@@ -0,0 +1,46 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufTraversal.swift - Basic serialization machinery
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Protocol for traversing the object tree.
+///
+/// This is used by:
+/// = Protobuf serialization
+/// = JSON serialization (with some twists to account for specialty JSON encodings)
+/// = hashValue computation
+/// = mirror generation
+///
+/// Conceptually, serializers create visitor objects that are
+/// then passed recursively to every message and field via generated
+/// 'traverse' methods.  The details get a little involved due to
+/// the need to allow particular messages to override particular
+/// behaviors for specific encodings, but the general idea is quite simple.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public protocol ProtobufTraversable {
+    func traverse(visitor: inout ProtobufVisitor) throws
+}
+
+public protocol ProtobufVisitor {
+    /// For proto2, visitors get to see the raw bytes for any unknown fields
+    mutating func visitUnknown(bytes: [UInt8])
+    mutating func visitSingularField<S: ProtobufTypeProperties>(fieldType: S.Type, value: S.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitRepeatedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitPackedField<S: ProtobufTypeProperties>(fieldType: S.Type, value: [S.BaseType], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitSingularMessageField<M: ProtobufMessage>(value: M, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitRepeatedMessageField<M: ProtobufMessage>(value: [M], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitSingularGroupField<G: ProtobufGroup>(value: G, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitRepeatedGroupField<G: ProtobufGroup>(value: [G], protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws
+    mutating func visitMapField<KeyType: ProtobufMapKeyType, ValueType: ProtobufMapValueType>(fieldType: ProtobufMap<KeyType, ValueType>.Type, value: ProtobufMap<KeyType, ValueType>.BaseType, protoFieldNumber: Int, protoFieldName: String, jsonFieldName: String, swiftFieldName: String) throws where KeyType.BaseType: Hashable
+}

+ 223 - 0
Sources/Protobuf/ProtobufTypes.swift

@@ -0,0 +1,223 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufTypes.swift - Proto data types
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Since proto types do not 1:1 map to Swift types, we need a way to
+/// specify encoding, hash, equality, and other common abilities.
+/// These types are extended in the Binary and JSON portions of the runtime
+/// with additional coding and decoding details.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+///
+/// Core support for each proto data type.
+///
+/// Note that we cannot just extend the standard Int32, etc, types
+/// with serialization information since proto language supports
+/// distinct types (with different codings) that use the same
+/// in-memory representation.  For example, proto "sint32" and
+/// "sfixed32" both are represented in-memory as Int32.
+///
+/// These types are used generically and also passed into
+/// various coding/decoding functions to provide type-specific
+/// information.
+///
+public protocol ProtobufTypePropertiesBase {
+    // Default here is appropriate for enums and messages
+    // Other types will override this
+    associatedtype BaseType = Self
+
+    /// Hash the provided value
+    /// In particular, [UInt8] is not Hashable, so we can't just
+    /// use .hashValue everywhere.
+    static func hash(value: BaseType) -> Int
+
+    /// In Swift 3, [UInt8] isn't Equatable, so I've added this method
+    /// to provide a consistent way to compute equality.
+    static func isEqual(_ lhs: BaseType, _ rhs: BaseType) -> Bool
+}
+
+public extension ProtobufTypePropertiesBase where BaseType: Hashable {
+    public static func hash(value: BaseType) -> Int {return value.hashValue}
+    public static func isEqual(_ lhs: BaseType, _ rhs: BaseType) -> Bool {return lhs == rhs}
+}
+
+
+public protocol ProtobufTypeProperties: ProtobufJSONCodableType, ProtobufBinaryCodableType {
+}
+
+///
+/// Protocol for types that can be used as map keys
+///
+public protocol ProtobufMapKeyType: ProtobufJSONCodableMapKeyType, ProtobufBinaryCodableMapKeyType {
+}
+
+///
+/// Marker protocol for types that can be used as map values.
+///
+public protocol ProtobufMapValueType: ProtobufTypeProperties {
+}
+
+//
+// We have a protocol for every wire type defining the base serialization for that type.
+//
+
+///
+/// Float traits
+///
+public struct ProtobufFloat: ProtobufTypeProperties, ProtobufMapValueType {
+    public typealias BaseType = Float
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// Double
+///
+public struct ProtobufDouble: ProtobufTypeProperties, ProtobufMapValueType {
+    public typealias BaseType = Double
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// Int32
+///
+public struct ProtobufInt32: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int32
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// Int64
+///
+
+public struct ProtobufInt64: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int64
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// UInt32
+///
+public struct ProtobufUInt32: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = UInt32
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// UInt64
+///
+
+public struct ProtobufUInt64: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = UInt64
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// SInt32
+///
+public struct ProtobufSInt32: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int32
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// SInt64
+///
+
+public struct ProtobufSInt64: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int64
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// Fixed32
+///
+public struct ProtobufFixed32: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = UInt32
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// Fixed64
+///
+public struct ProtobufFixed64: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = UInt64
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// SFixed32
+///
+public struct ProtobufSFixed32: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int32
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+///
+/// SFixed64
+///
+public struct ProtobufSFixed64: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Int64
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+//
+// ========= Bool =========
+//
+public struct ProtobufBool: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = Bool
+    public static func describe(value: BaseType) -> String {return value.description}
+}
+
+//
+// ========== String ==========
+//
+public struct ProtobufString: ProtobufTypeProperties, ProtobufMapKeyType, ProtobufMapValueType {
+    public typealias BaseType = String
+    public static func describe(value: BaseType) -> String {return value.debugDescription}
+}
+
+//
+// ========== Bytes ==========
+//
+public struct ProtobufBytes: ProtobufTypeProperties, ProtobufMapValueType {
+    public typealias BaseType = [UInt8]
+
+    public static func hash(value: BaseType) -> Int {return ProtobufHash(bytes: value)}
+    public static func describe(value: BaseType) -> String {return value.debugDescription}
+
+    // Note:  [UInt8] isn't Equatable, so we can't rely on the default implementation above
+    // But there is an == overload, so this same definition works here.
+    public static func isEqual(_ lhs: BaseType, _ rhs: BaseType) -> Bool {return lhs == rhs}
+}
+
+//
+// ========== Enum ==========
+//
+extension ProtobufEnum where RawValue == Int {
+    public static func describe(value: Self) -> String {return String(reflecting: value)}
+}
+
+//
+// ========== Maps ===========
+//
+// Not a full ProtobufTypeProperties, just a generic marker
+// for propagating the key/value types.
+//
+public struct ProtobufMap<MapKeyType: ProtobufMapKeyType, MapValueType: ProtobufMapValueType>
+    where MapKeyType.BaseType: Hashable
+{
+    typealias Key = MapKeyType.BaseType
+    typealias Value = MapValueType.BaseType
+    public typealias BaseType = Dictionary<Key, Value>
+}

+ 45 - 0
Sources/Protobuf/ProtobufUnknown.swift

@@ -0,0 +1,45 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufUnknown.swift - Handling unknown fields
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// Proto2 binary coding requires storing and recoding of unknown fields.
+/// This simple support class handles that requirement.  A property of this type
+/// is compiled into every proto2 message.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public struct ProtobufUnknownStorage: Equatable {
+    fileprivate var data: [UInt8] = []
+    public init() {}
+
+    public mutating func decodeField(setter: inout ProtobufFieldDecoder) throws -> Bool {
+        if let u = try setter.asProtobufUnknown() {
+            data.append(contentsOf: u)
+            return true
+        } else {
+            return false
+        }
+    }
+
+    public func traverse(visitor: inout ProtobufVisitor) {
+        visitor.visitUnknown(bytes: data)
+    }
+
+    public var isEmpty: Bool {
+        get {return data.isEmpty}
+    }
+}
+
+public func ==(lhs: ProtobufUnknownStorage, rhs: ProtobufUnknownStorage) -> Bool {
+    return lhs.data == rhs.data
+}

+ 47 - 0
Sources/Protobuf/ProtobufUtility.swift

@@ -0,0 +1,47 @@
+// ProtobufRuntime/Sources/Protobuf/ProtobufUtility.swift - Utility methods
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+// -----------------------------------------------------------------------------
+///
+/// In Swift 3, the standard library does not include == or != for [UInt8],
+/// so we define these utilities.
+///
+// -----------------------------------------------------------------------------
+
+import Swift
+
+public func ==(lhs: [[UInt8]], rhs: [[UInt8]]) -> Bool {
+    guard lhs.count == rhs.count else {return false}
+    for (l,r) in zip(lhs, rhs) {
+        if l != r {
+            return false
+        }
+    }
+    return true
+}
+
+public func !=(lhs: [[UInt8]], rhs: [[UInt8]]) -> Bool {
+    return !(lhs == rhs)
+}
+
+public func ==<T: Equatable>(lhs: Dictionary<T, [UInt8]>, rhs: Dictionary<T, [UInt8]>) -> Bool {
+    guard lhs.count == rhs.count else {return false}
+    for (k,v) in lhs {
+        let rv = rhs[k]
+        if rv == nil || rv! != v {
+            return false
+        }
+    }
+    return true
+}
+
+public func !=<T: Equatable>(lhs: Dictionary<T, [UInt8]>, rhs: Dictionary<T, [UInt8]>) -> Bool {
+    return !(lhs == rhs)
+}

+ 534 - 0
Sources/Protobuf/api.pb.swift

@@ -0,0 +1,534 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/api.proto
+ *
+ */
+
+
+
+
+///   Api is a light-weight descriptor for a protocol buffer service.
+public struct Google_Protobuf_Api: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Api"}
+  public var protoMessageName: String {return "Api"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "name": 1,
+    "methods": 2,
+    "options": 3,
+    "version": 4,
+    "sourceContext": 5,
+    "mixins": 6,
+    "syntax": 7,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "name": 1,
+    "methods": 2,
+    "options": 3,
+    "version": 4,
+    "source_context": 5,
+    "mixins": 6,
+    "syntax": 7,
+  ]}
+
+  private class _StorageClass {
+    typealias ProtobufExtendedMessage = Google_Protobuf_Api
+    var _name: String = ""
+    var _methods: [Google_Protobuf_Method] = []
+    var _options: [Google_Protobuf_Option] = []
+    var _version: String = ""
+    var _sourceContext: Google_Protobuf_SourceContext? = nil
+    var _mixins: [Google_Protobuf_Mixin] = []
+    var _syntax: Google_Protobuf_Syntax = Google_Protobuf_Syntax.proto2
+
+    init() {}
+
+    func decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+      let handled: Bool
+      switch protoFieldNumber {
+      case 1: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &_name)
+      case 2: handled = try setter.decodeRepeatedMessageField(fieldType: Google_Protobuf_Method.self, value: &_methods)
+      case 3: handled = try setter.decodeRepeatedMessageField(fieldType: Google_Protobuf_Option.self, value: &_options)
+      case 4: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &_version)
+      case 5: handled = try setter.decodeSingularMessageField(fieldType: Google_Protobuf_SourceContext.self, value: &_sourceContext)
+      case 6: handled = try setter.decodeRepeatedMessageField(fieldType: Google_Protobuf_Mixin.self, value: &_mixins)
+      case 7: handled = try setter.decodeSingularField(fieldType: Google_Protobuf_Syntax.self, value: &_syntax)
+      default:
+        handled = false
+      }
+      return handled
+    }
+
+    func traverse(visitor: inout ProtobufVisitor) throws {
+      if _name != "" {
+        try visitor.visitSingularField(fieldType: ProtobufString.self, value: _name, protoFieldNumber: 1, protoFieldName: "name", jsonFieldName: "name", swiftFieldName: "name")
+      }
+      if !_methods.isEmpty {
+        try visitor.visitRepeatedMessageField(value: _methods, protoFieldNumber: 2, protoFieldName: "methods", jsonFieldName: "methods", swiftFieldName: "methods")
+      }
+      if !_options.isEmpty {
+        try visitor.visitRepeatedMessageField(value: _options, protoFieldNumber: 3, protoFieldName: "options", jsonFieldName: "options", swiftFieldName: "options")
+      }
+      if _version != "" {
+        try visitor.visitSingularField(fieldType: ProtobufString.self, value: _version, protoFieldNumber: 4, protoFieldName: "version", jsonFieldName: "version", swiftFieldName: "version")
+      }
+      if let v = _sourceContext {
+        try visitor.visitSingularMessageField(value: v, protoFieldNumber: 5, protoFieldName: "source_context", jsonFieldName: "sourceContext", swiftFieldName: "sourceContext")
+      }
+      if !_mixins.isEmpty {
+        try visitor.visitRepeatedMessageField(value: _mixins, protoFieldNumber: 6, protoFieldName: "mixins", jsonFieldName: "mixins", swiftFieldName: "mixins")
+      }
+      if _syntax != Google_Protobuf_Syntax.proto2 {
+        try visitor.visitSingularField(fieldType: Google_Protobuf_Syntax.self, value: _syntax, protoFieldNumber: 7, protoFieldName: "syntax", jsonFieldName: "syntax", swiftFieldName: "syntax")
+      }
+    }
+
+    var isEmpty: Bool {
+      if _name != "" {return false}
+      if !_methods.isEmpty {return false}
+      if !_options.isEmpty {return false}
+      if _version != "" {return false}
+      if _sourceContext != nil {return false}
+      if !_mixins.isEmpty {return false}
+      if _syntax != Google_Protobuf_Syntax.proto2 {return false}
+      return true
+    }
+
+    func isEqualTo(other: _StorageClass) -> Bool {
+      if _name != other._name {return false}
+      if _methods != other._methods {return false}
+      if _options != other._options {return false}
+      if _version != other._version {return false}
+      if _sourceContext != other._sourceContext {return false}
+      if _mixins != other._mixins {return false}
+      if _syntax != other._syntax {return false}
+      return true
+    }
+
+    func copy() -> _StorageClass {
+      let clone = _StorageClass()
+      clone._name = _name
+      clone._methods = _methods
+      clone._options = _options
+      clone._version = _version
+      clone._sourceContext = _sourceContext
+      clone._mixins = _mixins
+      clone._syntax = _syntax
+      return clone
+    }
+  }
+
+  private var _storage: _StorageClass?
+
+  ///   The fully qualified name of this api, including package name
+  ///   followed by the api's simple name.
+  public var name: String {
+    get {return _storage?._name ?? ""}
+    set {_uniqueStorage()._name = newValue}
+  }
+
+  ///   The methods of this api, in unspecified order.
+  public var methods: [Google_Protobuf_Method] {
+    get {return _storage?._methods ?? []}
+    set {_uniqueStorage()._methods = newValue}
+  }
+
+  ///   Any metadata attached to the API.
+  public var options: [Google_Protobuf_Option] {
+    get {return _storage?._options ?? []}
+    set {_uniqueStorage()._options = newValue}
+  }
+
+  ///   A version string for this api. If specified, must have the form
+  ///   `major-version.minor-version`, as in `1.10`. If the minor version
+  ///   is omitted, it defaults to zero. If the entire version field is
+  ///   empty, the major version is derived from the package name, as
+  ///   outlined below. If the field is not empty, the version in the
+  ///   package name will be verified to be consistent with what is
+  ///   provided here.
+  ///  
+  ///   The versioning schema uses [semantic
+  ///   versioning](http://semver.org) where the major version number
+  ///   indicates a breaking change and the minor version an additive,
+  ///   non-breaking change. Both version numbers are signals to users
+  ///   what to expect from different versions, and should be carefully
+  ///   chosen based on the product plan.
+  ///  
+  ///   The major version is also reflected in the package name of the
+  ///   API, which must end in `v<major-version>`, as in
+  ///   `google.feature.v1`. For major versions 0 and 1, the suffix can
+  ///   be omitted. Zero major versions must only be used for
+  ///   experimental, none-GA apis.
+  public var version: String {
+    get {return _storage?._version ?? ""}
+    set {_uniqueStorage()._version = newValue}
+  }
+
+  ///   Source context for the protocol buffer service represented by this
+  ///   message.
+  public var sourceContext: Google_Protobuf_SourceContext {
+    get {return _storage?._sourceContext ?? Google_Protobuf_SourceContext()}
+    set {_uniqueStorage()._sourceContext = newValue}
+  }
+
+  ///   Included APIs. See [Mixin][].
+  public var mixins: [Google_Protobuf_Mixin] {
+    get {return _storage?._mixins ?? []}
+    set {_uniqueStorage()._mixins = newValue}
+  }
+
+  ///   The source syntax of the service.
+  public var syntax: Google_Protobuf_Syntax {
+    get {return _storage?._syntax ?? Google_Protobuf_Syntax.proto2}
+    set {_uniqueStorage()._syntax = newValue}
+  }
+
+  public init() {}
+
+  public init(name: String? = nil,
+    methods: [Google_Protobuf_Method] = [],
+    options: [Google_Protobuf_Option] = [],
+    version: String? = nil,
+    sourceContext: Google_Protobuf_SourceContext? = nil,
+    mixins: [Google_Protobuf_Mixin] = [],
+    syntax: Google_Protobuf_Syntax? = nil)
+  {
+    let storage = _uniqueStorage()
+    if let v = name {
+      storage._name = v
+    }
+    if !methods.isEmpty {
+      storage._methods = methods
+    }
+    if !options.isEmpty {
+      storage._options = options
+    }
+    if let v = version {
+      storage._version = v
+    }
+    storage._sourceContext = sourceContext
+    if !mixins.isEmpty {
+      storage._mixins = mixins
+    }
+    if let v = syntax {
+      storage._syntax = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    return try _uniqueStorage().decodeField(setter: &setter, protoFieldNumber: protoFieldNumber)
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    try _storage?.traverse(visitor: &visitor)
+  }
+
+  public var _protoc_generated_isEmpty: Bool {return _storage?.isEmpty ?? true}
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Api) -> Bool {
+    if let s = _storage {
+      if let os = other._storage {
+        return s === os || s.isEqualTo(other: os)
+      }
+      return isEmpty // empty storage == nil storage
+    } else if let os = other._storage {
+      return os.isEmpty // nil storage == empty storage
+    }
+    return true // Both nil, both empty
+  }
+
+  private mutating func _uniqueStorage() -> _StorageClass {
+    if _storage == nil {
+      _storage = _StorageClass()
+    } else if !isKnownUniquelyReferenced(&_storage) {
+      _storage = _storage!.copy()
+    }
+    return _storage!
+  }
+}
+
+///   Method represents a method of an api.
+public struct Google_Protobuf_Method: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Method"}
+  public var protoMessageName: String {return "Method"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "name": 1,
+    "requestTypeUrl": 2,
+    "requestStreaming": 3,
+    "responseTypeUrl": 4,
+    "responseStreaming": 5,
+    "options": 6,
+    "syntax": 7,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "name": 1,
+    "request_type_url": 2,
+    "request_streaming": 3,
+    "response_type_url": 4,
+    "response_streaming": 5,
+    "options": 6,
+    "syntax": 7,
+  ]}
+
+  ///   The simple name of this method.
+  public var name: String = ""
+
+  ///   A URL of the input message type.
+  public var requestTypeURL: String = ""
+
+  ///   If true, the request is streamed.
+  public var requestStreaming: Bool = false
+
+  ///   The URL of the output message type.
+  public var responseTypeURL: String = ""
+
+  ///   If true, the response is streamed.
+  public var responseStreaming: Bool = false
+
+  ///   Any metadata attached to the method.
+  public var options: [Google_Protobuf_Option] = []
+
+  ///   The source syntax of this method.
+  public var syntax: Google_Protobuf_Syntax = Google_Protobuf_Syntax.proto2
+
+  public init() {}
+
+  public init(name: String? = nil,
+    requestTypeURL: String? = nil,
+    requestStreaming: Bool? = nil,
+    responseTypeURL: String? = nil,
+    responseStreaming: Bool? = nil,
+    options: [Google_Protobuf_Option] = [],
+    syntax: Google_Protobuf_Syntax? = nil)
+  {
+    if let v = name {
+      self.name = v
+    }
+    if let v = requestTypeURL {
+      self.requestTypeURL = v
+    }
+    if let v = requestStreaming {
+      self.requestStreaming = v
+    }
+    if let v = responseTypeURL {
+      self.responseTypeURL = v
+    }
+    if let v = responseStreaming {
+      self.responseStreaming = v
+    }
+    if !options.isEmpty {
+      self.options = options
+    }
+    if let v = syntax {
+      self.syntax = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &name)
+    case 2: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &requestTypeURL)
+    case 3: handled = try setter.decodeSingularField(fieldType: ProtobufBool.self, value: &requestStreaming)
+    case 4: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &responseTypeURL)
+    case 5: handled = try setter.decodeSingularField(fieldType: ProtobufBool.self, value: &responseStreaming)
+    case 6: handled = try setter.decodeRepeatedMessageField(fieldType: Google_Protobuf_Option.self, value: &options)
+    case 7: handled = try setter.decodeSingularField(fieldType: Google_Protobuf_Syntax.self, value: &syntax)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if name != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: name, protoFieldNumber: 1, protoFieldName: "name", jsonFieldName: "name", swiftFieldName: "name")
+    }
+    if requestTypeURL != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: requestTypeURL, protoFieldNumber: 2, protoFieldName: "request_type_url", jsonFieldName: "requestTypeUrl", swiftFieldName: "requestTypeURL")
+    }
+    if requestStreaming != false {
+      try visitor.visitSingularField(fieldType: ProtobufBool.self, value: requestStreaming, protoFieldNumber: 3, protoFieldName: "request_streaming", jsonFieldName: "requestStreaming", swiftFieldName: "requestStreaming")
+    }
+    if responseTypeURL != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: responseTypeURL, protoFieldNumber: 4, protoFieldName: "response_type_url", jsonFieldName: "responseTypeUrl", swiftFieldName: "responseTypeURL")
+    }
+    if responseStreaming != false {
+      try visitor.visitSingularField(fieldType: ProtobufBool.self, value: responseStreaming, protoFieldNumber: 5, protoFieldName: "response_streaming", jsonFieldName: "responseStreaming", swiftFieldName: "responseStreaming")
+    }
+    if !options.isEmpty {
+      try visitor.visitRepeatedMessageField(value: options, protoFieldNumber: 6, protoFieldName: "options", jsonFieldName: "options", swiftFieldName: "options")
+    }
+    if syntax != Google_Protobuf_Syntax.proto2 {
+      try visitor.visitSingularField(fieldType: Google_Protobuf_Syntax.self, value: syntax, protoFieldNumber: 7, protoFieldName: "syntax", jsonFieldName: "syntax", swiftFieldName: "syntax")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if name != "" {return false}
+    if requestTypeURL != "" {return false}
+    if requestStreaming != false {return false}
+    if responseTypeURL != "" {return false}
+    if responseStreaming != false {return false}
+    if !options.isEmpty {return false}
+    if syntax != Google_Protobuf_Syntax.proto2 {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Method) -> Bool {
+    if name != other.name {return false}
+    if requestTypeURL != other.requestTypeURL {return false}
+    if requestStreaming != other.requestStreaming {return false}
+    if responseTypeURL != other.responseTypeURL {return false}
+    if responseStreaming != other.responseStreaming {return false}
+    if options != other.options {return false}
+    if syntax != other.syntax {return false}
+    return true
+  }
+}
+
+///   Declares an API to be included in this API. The including API must
+///   redeclare all the methods from the included API, but documentation
+///   and options are inherited as follows:
+///  
+///   - If after comment and whitespace stripping, the documentation
+///     string of the redeclared method is empty, it will be inherited
+///     from the original method.
+///  
+///   - Each annotation belonging to the service config (http,
+///     visibility) which is not set in the redeclared method will be
+///     inherited.
+///  
+///   - If an http annotation is inherited, the path pattern will be
+///     modified as follows. Any version prefix will be replaced by the
+///     version of the including API plus the [root][] path if specified.
+///  
+///   Example of a simple mixin:
+///  
+///       package google.acl.v1;
+///       service AccessControl {
+///         // Get the underlying ACL object.
+///         rpc GetAcl(GetAclRequest) returns (Acl) {
+///           option (google.api.http).get = "/v1/{resource=**}:getAcl";
+///         }
+///       }
+///  
+///       package google.storage.v2;
+///       service Storage {
+///         rpc GetAcl(GetAclRequest) returns (Acl);
+///  
+///         // Get a data record.
+///         rpc GetData(GetDataRequest) returns (Data) {
+///           option (google.api.http).get = "/v2/{resource=**}";
+///         }
+///       }
+///  
+///   Example of a mixin configuration:
+///  
+///       apis:
+///       - name: google.storage.v2.Storage
+///         mixins:
+///         - name: google.acl.v1.AccessControl
+///  
+///   The mixin construct implies that all methods in `AccessControl` are
+///   also declared with same name and request/response types in
+///   `Storage`. A documentation generator or annotation processor will
+///   see the effective `Storage.GetAcl` method after inherting
+///   documentation and annotations as follows:
+///  
+///       service Storage {
+///         // Get the underlying ACL object.
+///         rpc GetAcl(GetAclRequest) returns (Acl) {
+///           option (google.api.http).get = "/v2/{resource=**}:getAcl";
+///         }
+///         ...
+///       }
+///  
+///   Note how the version in the path pattern changed from `v1` to `v2`.
+///  
+///   If the `root` field in the mixin is specified, it should be a
+///   relative path under which inherited HTTP paths are placed. Example:
+///  
+///       apis:
+///       - name: google.storage.v2.Storage
+///         mixins:
+///         - name: google.acl.v1.AccessControl
+///           root: acls
+///  
+///   This implies the following inherited HTTP annotation:
+///  
+///       service Storage {
+///         // Get the underlying ACL object.
+///         rpc GetAcl(GetAclRequest) returns (Acl) {
+///           option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
+///         }
+///         ...
+///       }
+public struct Google_Protobuf_Mixin: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Mixin"}
+  public var protoMessageName: String {return "Mixin"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "name": 1,
+    "root": 2,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "name": 1,
+    "root": 2,
+  ]}
+
+  ///   The fully qualified name of the API which is included.
+  public var name: String = ""
+
+  ///   If non-empty specifies a path under which inherited HTTP paths
+  ///   are rooted.
+  public var root: String = ""
+
+  public init() {}
+
+  public init(name: String? = nil,
+    root: String? = nil)
+  {
+    if let v = name {
+      self.name = v
+    }
+    if let v = root {
+      self.root = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &name)
+    case 2: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &root)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if name != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: name, protoFieldNumber: 1, protoFieldName: "name", jsonFieldName: "name", swiftFieldName: "name")
+    }
+    if root != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: root, protoFieldNumber: 2, protoFieldName: "root", jsonFieldName: "root", swiftFieldName: "root")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if name != "" {return false}
+    if root != "" {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Mixin) -> Bool {
+    if name != other.name {return false}
+    if root != other.root {return false}
+    return true
+  }
+}

+ 121 - 0
Sources/Protobuf/duration.pb.swift

@@ -0,0 +1,121 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/duration.proto
+ *
+ */
+
+
+
+
+///   A Duration represents a signed, fixed-length span of time represented
+///   as a count of seconds and fractions of seconds at nanosecond
+///   resolution. It is independent of any calendar and concepts like "day"
+///   or "month". It is related to Timestamp in that the difference between
+///   two Timestamp values is a Duration and it can be added or subtracted
+///   from a Timestamp. Range is approximately +-10,000 years.
+///  
+///   Example 1: Compute Duration from two Timestamps in pseudo code.
+///  
+///       Timestamp start = ...;
+///       Timestamp end = ...;
+///       Duration duration = ...;
+///  
+///       duration.seconds = end.seconds - start.seconds;
+///       duration.nanos = end.nanos - start.nanos;
+///  
+///       if (duration.seconds < 0 && duration.nanos > 0) {
+///         duration.seconds += 1;
+///         duration.nanos -= 1000000000;
+///       } else if (durations.seconds > 0 && duration.nanos < 0) {
+///         duration.seconds -= 1;
+///         duration.nanos += 1000000000;
+///       }
+///  
+///   Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
+///  
+///       Timestamp start = ...;
+///       Duration duration = ...;
+///       Timestamp end = ...;
+///  
+///       end.seconds = start.seconds + duration.seconds;
+///       end.nanos = start.nanos + duration.nanos;
+///  
+///       if (end.nanos < 0) {
+///         end.seconds -= 1;
+///         end.nanos += 1000000000;
+///       } else if (end.nanos >= 1000000000) {
+///         end.seconds += 1;
+///         end.nanos -= 1000000000;
+///       }
+public struct Google_Protobuf_Duration: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Duration"}
+  public var protoMessageName: String {return "Duration"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "seconds": 1,
+    "nanos": 2,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "seconds": 1,
+    "nanos": 2,
+  ]}
+
+  ///   Signed seconds of the span of time. Must be from -315,576,000,000
+  ///   to +315,576,000,000 inclusive.
+  public var seconds: Int64 = 0
+
+  ///   Signed fractions of a second at nanosecond resolution of the span
+  ///   of time. Durations less than one second are represented with a 0
+  ///   `seconds` field and a positive or negative `nanos` field. For durations
+  ///   of one second or more, a non-zero value for the `nanos` field must be
+  ///   of the same sign as the `seconds` field. Must be from -999,999,999
+  ///   to +999,999,999 inclusive.
+  public var nanos: Int32 = 0
+
+  public init() {}
+
+  public init(seconds: Int64? = nil,
+    nanos: Int32? = nil)
+  {
+    if let v = seconds {
+      self.seconds = v
+    }
+    if let v = nanos {
+      self.nanos = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeSingularField(fieldType: ProtobufInt64.self, value: &seconds)
+    case 2: handled = try setter.decodeSingularField(fieldType: ProtobufInt32.self, value: &nanos)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if seconds != 0 {
+      try visitor.visitSingularField(fieldType: ProtobufInt64.self, value: seconds, protoFieldNumber: 1, protoFieldName: "seconds", jsonFieldName: "seconds", swiftFieldName: "seconds")
+    }
+    if nanos != 0 {
+      try visitor.visitSingularField(fieldType: ProtobufInt32.self, value: nanos, protoFieldNumber: 2, protoFieldName: "nanos", jsonFieldName: "nanos", swiftFieldName: "nanos")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if seconds != 0 {return false}
+    if nanos != 0 {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Duration) -> Bool {
+    if seconds != other.seconds {return false}
+    if nanos != other.nanos {return false}
+    return true
+  }
+}

+ 42 - 0
Sources/Protobuf/empty.pb.swift

@@ -0,0 +1,42 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/empty.proto
+ *
+ */
+
+
+
+
+///   A generic empty message that you can re-use to avoid defining duplicated
+///   empty messages in your APIs. A typical example is to use it as the request
+///   or the response type of an API method. For instance:
+///  
+///       service Foo {
+///         rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
+///       }
+///  
+///   The JSON representation for `Empty` is empty JSON object `{}`.
+public struct Google_Protobuf_Empty: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Empty"}
+  public var protoMessageName: String {return "Empty"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [:]}
+  public var protoFieldNames: [String: Int] {return [:]}
+
+  public init() {}
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    return false // Proto3 ignores unknown fields
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+  }
+
+  public let _protoc_generated_isEmpty: Bool = true
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Empty) -> Bool {
+    return true
+  }
+}

+ 261 - 0
Sources/Protobuf/field_mask.pb.swift

@@ -0,0 +1,261 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/field_mask.proto
+ *
+ */
+
+
+
+
+///   `FieldMask` represents a set of symbolic field paths, for example:
+///  
+///       paths: "f.a"
+///       paths: "f.b.d"
+///  
+///   Here `f` represents a field in some root message, `a` and `b`
+///   fields in the message found in `f`, and `d` a field found in the
+///   message in `f.b`.
+///  
+///   Field masks are used to specify a subset of fields that should be
+///   returned by a get operation or modified by an update operation.
+///   Field masks also have a custom JSON encoding (see below).
+///  
+///   # Field Masks in Projections
+///  
+///   When used in the context of a projection, a response message or
+///   sub-message is filtered by the API to only contain those fields as
+///   specified in the mask. For example, if the mask in the previous
+///   example is applied to a response message as follows:
+///  
+///       f {
+///         a : 22
+///         b {
+///           d : 1
+///           x : 2
+///         }
+///         y : 13
+///       }
+///       z: 8
+///  
+///   The result will not contain specific values for fields x,y and z
+///   (their value will be set to the default, and omitted in proto text
+///   output):
+///  
+///  
+///       f {
+///         a : 22
+///         b {
+///           d : 1
+///         }
+///       }
+///  
+///   A repeated field is not allowed except at the last position of a
+///   field mask.
+///  
+///   If a FieldMask object is not present in a get operation, the
+///   operation applies to all fields (as if a FieldMask of all fields
+///   had been specified).
+///  
+///   Note that a field mask does not necessarily apply to the
+///   top-level response message. In case of a REST get operation, the
+///   field mask applies directly to the response, but in case of a REST
+///   list operation, the mask instead applies to each individual message
+///   in the returned resource list. In case of a REST custom method,
+///   other definitions may be used. Where the mask applies will be
+///   clearly documented together with its declaration in the API.  In
+///   any case, the effect on the returned resource/resources is required
+///   behavior for APIs.
+///  
+///   # Field Masks in Update Operations
+///  
+///   A field mask in update operations specifies which fields of the
+///   targeted resource are going to be updated. The API is required
+///   to only change the values of the fields as specified in the mask
+///   and leave the others untouched. If a resource is passed in to
+///   describe the updated values, the API ignores the values of all
+///   fields not covered by the mask.
+///  
+///   If a repeated field is specified for an update operation, the existing
+///   repeated values in the target resource will be overwritten by the new values.
+///   Note that a repeated field is only allowed in the last position of a field
+///   mask.
+///  
+///   If a sub-message is specified in the last position of the field mask for an
+///   update operation, then the existing sub-message in the target resource is
+///   overwritten. Given the target message:
+///  
+///       f {
+///         b {
+///           d : 1
+///           x : 2
+///         }
+///         c : 1
+///       }
+///  
+///   And an update message:
+///  
+///       f {
+///         b {
+///           d : 10
+///         }
+///       }
+///  
+///   then if the field mask is:
+///  
+///    paths: "f.b"
+///  
+///   then the result will be:
+///  
+///       f {
+///         b {
+///           d : 10
+///         }
+///         c : 1
+///       }
+///  
+///   However, if the update mask was:
+///  
+///    paths: "f.b.d"
+///  
+///   then the result would be:
+///  
+///       f {
+///         b {
+///           d : 10
+///           x : 2
+///         }
+///         c : 1
+///       }
+///  
+///   In order to reset a field's value to the default, the field must
+///   be in the mask and set to the default value in the provided resource.
+///   Hence, in order to reset all fields of a resource, provide a default
+///   instance of the resource and set all fields in the mask, or do
+///   not provide a mask as described below.
+///  
+///   If a field mask is not present on update, the operation applies to
+///   all fields (as if a field mask of all fields has been specified).
+///   Note that in the presence of schema evolution, this may mean that
+///   fields the client does not know and has therefore not filled into
+///   the request will be reset to their default. If this is unwanted
+///   behavior, a specific service may require a client to always specify
+///   a field mask, producing an error if not.
+///  
+///   As with get operations, the location of the resource which
+///   describes the updated values in the request message depends on the
+///   operation kind. In any case, the effect of the field mask is
+///   required to be honored by the API.
+///  
+///   ## Considerations for HTTP REST
+///  
+///   The HTTP kind of an update operation which uses a field mask must
+///   be set to PATCH instead of PUT in order to satisfy HTTP semantics
+///   (PUT must only be used for full updates).
+///  
+///   # JSON Encoding of Field Masks
+///  
+///   In JSON, a field mask is encoded as a single string where paths are
+///   separated by a comma. Fields name in each path are converted
+///   to/from lower-camel naming conventions.
+///  
+///   As an example, consider the following message declarations:
+///  
+///       message Profile {
+///         User user = 1;
+///         Photo photo = 2;
+///       }
+///       message User {
+///         string display_name = 1;
+///         string address = 2;
+///       }
+///  
+///   In proto a field mask for `Profile` may look as such:
+///  
+///       mask {
+///         paths: "user.display_name"
+///         paths: "photo"
+///       }
+///  
+///   In JSON, the same mask is represented as below:
+///  
+///       {
+///         mask: "user.displayName,photo"
+///       }
+///  
+///   # Field Masks and Oneof Fields
+///  
+///   Field masks treat fields in oneofs just as regular fields. Consider the
+///   following message:
+///  
+///       message SampleMessage {
+///         oneof test_oneof {
+///           string name = 4;
+///           SubMessage sub_message = 9;
+///         }
+///       }
+///  
+///   The field mask can be:
+///  
+///       mask {
+///         paths: "name"
+///       }
+///  
+///   Or:
+///  
+///       mask {
+///         paths: "sub_message"
+///       }
+///  
+///   Note that oneof type names ("test_oneof" in this case) cannot be used in
+///   paths.
+public struct Google_Protobuf_FieldMask: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_FieldMask"}
+  public var protoMessageName: String {return "FieldMask"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "paths": 1,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "paths": 1,
+  ]}
+
+  ///   The set of field mask paths.
+  public var paths: [String] = []
+
+  public init() {}
+
+  public init(paths: [String] = [])
+  {
+    if !paths.isEmpty {
+      self.paths = paths
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeRepeatedField(fieldType: ProtobufString.self, value: &paths)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if !paths.isEmpty {
+      try visitor.visitRepeatedField(fieldType: ProtobufString.self, value: paths, protoFieldNumber: 1, protoFieldName: "paths", jsonFieldName: "paths", swiftFieldName: "paths")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if !paths.isEmpty {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_FieldMask) -> Bool {
+    if paths != other.paths {return false}
+    return true
+  }
+}

+ 63 - 0
Sources/Protobuf/source_context.pb.swift

@@ -0,0 +1,63 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/source_context.proto
+ *
+ */
+
+
+
+
+///   `SourceContext` represents information about the source of a
+///   protobuf element, like the file in which it is defined.
+public struct Google_Protobuf_SourceContext: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_SourceContext"}
+  public var protoMessageName: String {return "SourceContext"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "fileName": 1,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "file_name": 1,
+  ]}
+
+  ///   The path-qualified name of the .proto file that contained the associated
+  ///   protobuf element.  For example: `"google/protobuf/source_context.proto"`.
+  public var fileName: String = ""
+
+  public init() {}
+
+  public init(fileName: String? = nil)
+  {
+    if let v = fileName {
+      self.fileName = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeSingularField(fieldType: ProtobufString.self, value: &fileName)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if fileName != "" {
+      try visitor.visitSingularField(fieldType: ProtobufString.self, value: fileName, protoFieldNumber: 1, protoFieldName: "file_name", jsonFieldName: "fileName", swiftFieldName: "fileName")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if fileName != "" {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_SourceContext) -> Bool {
+    if fileName != other.fileName {return false}
+    return true
+  }
+}

+ 133 - 0
Sources/Protobuf/timestamp.pb.swift

@@ -0,0 +1,133 @@
+/*
+ * DO NOT EDIT.
+ *
+ * Generated by the protocol buffer compiler.
+ * Source: google/protobuf/timestamp.proto
+ *
+ */
+
+
+
+
+///   A Timestamp represents a point in time independent of any time zone
+///   or calendar, represented as seconds and fractions of seconds at
+///   nanosecond resolution in UTC Epoch time. It is encoded using the
+///   Proleptic Gregorian Calendar which extends the Gregorian calendar
+///   backwards to year one. It is encoded assuming all minutes are 60
+///   seconds long, i.e. leap seconds are "smeared" so that no leap second
+///   table is needed for interpretation. Range is from
+///   0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
+///   By restricting to that range, we ensure that we can convert to
+///   and from  RFC 3339 date strings.
+///   See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
+///  
+///   Example 1: Compute Timestamp from POSIX `time()`.
+///  
+///       Timestamp timestamp;
+///       timestamp.set_seconds(time(NULL));
+///       timestamp.set_nanos(0);
+///  
+///   Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+///  
+///       struct timeval tv;
+///       gettimeofday(&tv, NULL);
+///  
+///       Timestamp timestamp;
+///       timestamp.set_seconds(tv.tv_sec);
+///       timestamp.set_nanos(tv.tv_usec * 1000);
+///  
+///   Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+///  
+///       FILETIME ft;
+///       GetSystemTimeAsFileTime(&ft);
+///       UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+///  
+///       // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+///       // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+///       Timestamp timestamp;
+///       timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+///       timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+///  
+///   Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+///  
+///       long millis = System.currentTimeMillis();
+///  
+///       Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+///           .setNanos((int) ((millis % 1000) * 1000000)).build();
+///  
+///  
+///   Example 5: Compute Timestamp from current time in Python.
+///  
+///       now = time.time()
+///       seconds = int(now)
+///       nanos = int((now - seconds) * 10**9)
+///       timestamp = Timestamp(seconds=seconds, nanos=nanos)
+public struct Google_Protobuf_Timestamp: ProtobufGeneratedMessage {
+  public var swiftClassName: String {return "Google_Protobuf_Timestamp"}
+  public var protoMessageName: String {return "Timestamp"}
+  public var protoPackageName: String {return "google.protobuf"}
+  public var jsonFieldNames: [String: Int] {return [
+    "seconds": 1,
+    "nanos": 2,
+  ]}
+  public var protoFieldNames: [String: Int] {return [
+    "seconds": 1,
+    "nanos": 2,
+  ]}
+
+  ///   Represents seconds of UTC time since Unix epoch
+  ///   1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
+  ///   9999-12-31T23:59:59Z inclusive.
+  public var seconds: Int64 = 0
+
+  ///   Non-negative fractions of a second at nanosecond resolution. Negative
+  ///   second values with fractions must still have non-negative nanos values
+  ///   that count forward in time. Must be from 0 to 999,999,999
+  ///   inclusive.
+  public var nanos: Int32 = 0
+
+  public init() {}
+
+  public init(seconds: Int64? = nil,
+    nanos: Int32? = nil)
+  {
+    if let v = seconds {
+      self.seconds = v
+    }
+    if let v = nanos {
+      self.nanos = v
+    }
+  }
+
+  public mutating func _protoc_generated_decodeField(setter: inout ProtobufFieldDecoder, protoFieldNumber: Int) throws -> Bool {
+    let handled: Bool
+    switch protoFieldNumber {
+    case 1: handled = try setter.decodeSingularField(fieldType: ProtobufInt64.self, value: &seconds)
+    case 2: handled = try setter.decodeSingularField(fieldType: ProtobufInt32.self, value: &nanos)
+    default:
+      handled = false
+    }
+    return handled
+  }
+
+  public func _protoc_generated_traverse(visitor: inout ProtobufVisitor) throws {
+    if seconds != 0 {
+      try visitor.visitSingularField(fieldType: ProtobufInt64.self, value: seconds, protoFieldNumber: 1, protoFieldName: "seconds", jsonFieldName: "seconds", swiftFieldName: "seconds")
+    }
+    if nanos != 0 {
+      try visitor.visitSingularField(fieldType: ProtobufInt32.self, value: nanos, protoFieldNumber: 2, protoFieldName: "nanos", jsonFieldName: "nanos", swiftFieldName: "nanos")
+    }
+  }
+
+  public var _protoc_generated_isEmpty: Bool {
+    if seconds != 0 {return false}
+    if nanos != 0 {return false}
+    return true
+  }
+
+  public func _protoc_generated_isEqualTo(other: Google_Protobuf_Timestamp) -> Bool {
+    if seconds != other.seconds {return false}
+    if nanos != other.nanos {return false}
+    return true
+  }
+}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.