aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--protoc-artifacts/pom.xml2
-rw-r--r--python/google/protobuf/internal/json_format_test.py16
-rw-r--r--python/google/protobuf/json_format.py7
-rwxr-xr-xpython/setup.py1
-rwxr-xr-xsrc/google/protobuf/compiler/js/js_generator.cc3
-rw-r--r--src/google/protobuf/text_format_unittest.cc2
6 files changed, 27 insertions, 4 deletions
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index e9728a06..50866041 100644
--- a/protoc-artifacts/pom.xml
+++ b/protoc-artifacts/pom.xml
@@ -10,7 +10,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
- <version>3.0.0-beta-2</version>
+ <version>3.0.0-beta-3</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
index bdc9f49a..eec1f56f 100644
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -458,6 +458,22 @@ class JsonFormatTest(JsonFormatBase):
'}\n'))
parsed_message = json_format_proto3_pb2.TestAny()
self.CheckParseBack(message, parsed_message)
+ # Must print @type first
+ test_message = json_format_proto3_pb2.TestMessage(
+ bool_value=True,
+ int32_value=20,
+ int64_value=-20,
+ uint32_value=20,
+ uint64_value=20,
+ double_value=3.14,
+ string_value='foo')
+ message.Clear()
+ message.value.Pack(test_message)
+ self.assertEqual(
+ json_format.MessageToJson(message, False)[0:68],
+ '{\n'
+ ' "value": {\n'
+ ' "@type": "type.googleapis.com/proto3.TestMessage"')
def testWellKnownInAnyMessage(self):
message = any_pb2.Any()
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index 7921556e..57aa4077 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -42,6 +42,10 @@ Simple usage example:
__author__ = 'jieluo@google.com (Jie Luo)'
+try:
+ from collections import OrderedDict
+except ImportError:
+ from ordereddict import OrderedDict #PY26
import base64
import json
import math
@@ -208,7 +212,8 @@ def _AnyMessageToJsonObject(message, including_default):
"""Converts Any message according to Proto3 JSON Specification."""
if not message.ListFields():
return {}
- js = {}
+ # Must print @type first, use OrderedDict instead of {}
+ js = OrderedDict()
type_url = message.type_url
js['@type'] = type_url
sub_message = _CreateMessageFromTypeUrl(type_url)
diff --git a/python/setup.py b/python/setup.py
index 0f4b53c4..76f0cbc8 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -219,6 +219,7 @@ if __name__ == '__main__':
name='protobuf',
version=GetVersion(),
description='Protocol Buffers',
+ download_url='https://github.com/google/protobuf/releases',
long_description="Protocol Buffers are Google's data interchange format",
url='https://developers.google.com/protocol-buffers/',
maintainer='protobuf@googlegroups.com',
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index 3de61e80..a72cf6a3 100755
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "google/protobuf/compiler/js/js_generator.h"
+#include <google/protobuf/compiler/js/js_generator.h>
#include <assert.h>
#include <algorithm>
@@ -489,6 +489,7 @@ string JSByteGetterSuffix(BytesMode bytes_mode) {
default:
assert(false);
}
+ return "";
}
// Returns the field name as a capitalized portion of a getter/setter method
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index 58aa3f8d..410e5480 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -53,11 +53,11 @@
#include <google/protobuf/unittest_mset_wire_format.pb.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/stubs/mathlimits.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-#include <google/protobuf/stubs/mathlimits.h>
namespace google {