diff --git a/google/protobuf/descriptor.proto b/google/protobuf/descriptor.proto index 8f90a956cf92f..801d85e44624f 100644 --- a/google/protobuf/descriptor.proto +++ b/google/protobuf/descriptor.proto @@ -191,6 +191,12 @@ message FieldDescriptorProto { // 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; } diff --git a/google/protobuf/map_proto2_unittest.proto b/google/protobuf/map_proto2_unittest.proto index 6f9d6165c6fbe..916cc54637538 100644 --- a/google/protobuf/map_proto2_unittest.proto +++ b/google/protobuf/map_proto2_unittest.proto @@ -31,6 +31,8 @@ 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". @@ -58,3 +60,7 @@ message TestEnumMapPlusExtra { map known_map_field = 101; map unknown_map_field = 102; } + +message TestImportEnumMap { + map import_enum_amp = 1; +} diff --git a/google/protobuf/unittest_import.proto b/google/protobuf/unittest_import.proto index 7e165220334f5..8d03e3888bc92 100644 --- a/google/protobuf/unittest_import.proto +++ b/google/protobuf/unittest_import.proto @@ -64,3 +64,10 @@ enum ImportEnum { 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; +} diff --git a/google/protobuf/util/json_format_proto3.proto b/google/protobuf/util/json_format_proto3.proto index 7a2828681e065..e81376778c177 100644 --- a/google/protobuf/util/json_format_proto3.proto +++ b/google/protobuf/util/json_format_proto3.proto @@ -100,6 +100,16 @@ message TestMap { map string_map = 6; } +message TestNestedMap { + map bool_map = 1; + map int32_map = 2; + map int64_map = 3; + map uint32_map = 4; + map uint64_map = 5; + map string_map = 6; + map map_map = 7; +} + message TestWrapper { google.protobuf.BoolValue bool_value = 1; google.protobuf.Int32Value int32_value = 2;