Parse nested listvalue in json for ruby (#5867)

* Add conformance test for nested listvalue

* Fix upb for parsing repeated Value/ListValue

* Add failed repeated ListValue conformance test into php failure list
This commit is contained in:
Paul Yang 2019-03-12 10:56:58 -07:00 committed by GitHub
parent 45aba801ed
commit 4b145b1c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 146 additions and 55 deletions

View File

@ -2194,6 +2194,36 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
}
}
)");
RunValidJsonTest(
"RepeatedValue", REQUIRED,
R"({
"repeatedValue": [["a"]]
})",
R"(
repeated_value: [
{
list_value: {
values: [
{ string_value: "a"}
]
}
}
]
)");
RunValidJsonTest(
"RepeatedListValue", REQUIRED,
R"({
"repeatedListValue": [["a"]]
})",
R"(
repeated_list_value: [
{
values: [
{ string_value: "a"}
]
}
]
)");
// Any
RunValidJsonTest(

View File

@ -14,6 +14,8 @@ Required.Proto3.JsonInput.DoubleFieldTooSmall
Required.Proto3.JsonInput.Int32FieldNotInteger
Required.Proto3.JsonInput.Int64FieldNotInteger
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.Proto3.JsonInput.RepeatedListValue.JsonOutput
Required.Proto3.JsonInput.RepeatedListValue.ProtobufOutput
Required.Proto3.JsonInput.StringFieldNotAString
Required.Proto3.JsonInput.Uint32FieldNotInteger
Required.Proto3.JsonInput.Uint64FieldNotInteger

View File

@ -29,7 +29,7 @@ namespace ProtobufTestMessages.Proto3 {
"dWYvYW55LnByb3RvGh5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8a",
"IGdvb2dsZS9wcm90b2J1Zi9maWVsZF9tYXNrLnByb3RvGhxnb29nbGUvcHJv",
"dG9idWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1w",
"LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8i7TwKElRl",
"LnByb3RvGh5nb29nbG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
"ZmllbGRKBgj1AxD/AyIbCg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFKkAK",
"C0ZvcmVpZ25FbnVtEg8KC0ZPUkVJR05fRk9PEAASDwoLRk9SRUlHTl9CQVIQ",
"ARIPCgtGT1JFSUdOX0JBWhACQjgKKGNvbS5nb29nbGUucHJvdG9idWZfdGVz",
"dF9tZXNzYWdlcy5wcm90bzNIAfgBAaICBlByb3RvM2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalAliasedEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "OptionalBoolWrapper", "OptionalInt32Wrapper", "OptionalInt64Wrapper", "OptionalUint32Wrapper", "OptionalUint64Wrapper", "OptionalFloatWrapper", "OptionalDoubleWrapper", "OptionalStringWrapper", "OptionalBytesWrapper", "RepeatedBoolWrapper", "RepeatedInt32Wrapper", "RepeatedInt64Wrapper", "RepeatedUint32Wrapper", "RepeatedUint64Wrapper", "RepeatedFloatWrapper", "RepeatedDoubleWrapper", "RepeatedStringWrapper", "RepeatedBytesWrapper", "OptionalDuration", "OptionalTimestamp", "OptionalFieldMask", "OptionalStruct", "OptionalAny", "OptionalValue", "RepeatedDuration", "RepeatedTimestamp", "RepeatedFieldmask", "RepeatedStruct", "RepeatedAny", "RepeatedValue", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum), typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalAliasedEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "OptionalBoolWrapper", "OptionalInt32Wrapper", "OptionalInt64Wrapper", "OptionalUint32Wrapper", "OptionalUint64Wrapper", "OptionalFloatWrapper", "OptionalDoubleWrapper", "OptionalStringWrapper", "OptionalBytesWrapper", "RepeatedBoolWrapper", "RepeatedInt32Wrapper", "RepeatedInt64Wrapper", "RepeatedUint32Wrapper", "RepeatedUint64Wrapper", "RepeatedFloatWrapper", "RepeatedDoubleWrapper", "RepeatedStringWrapper", "RepeatedBytesWrapper", "OptionalDuration", "OptionalTimestamp", "OptionalFieldMask", "OptionalStruct", "OptionalAny", "OptionalValue", "RepeatedDuration", "RepeatedTimestamp", "RepeatedFieldmask", "RepeatedStruct", "RepeatedAny", "RepeatedValue", "RepeatedListValue", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum), typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null),
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.ForeignMessage), global::ProtobufTestMessages.Proto3.ForeignMessage.Parser, new[]{ "C" }, null, null, null)
}));
@ -355,6 +356,7 @@ namespace ProtobufTestMessages.Proto3 {
repeatedStruct_ = other.repeatedStruct_.Clone();
repeatedAny_ = other.repeatedAny_.Clone();
repeatedValue_ = other.repeatedValue_.Clone();
repeatedListValue_ = other.repeatedListValue_.Clone();
fieldname1_ = other.fieldname1_;
fieldName2_ = other.fieldName2_;
FieldName3_ = other.FieldName3_;
@ -1508,6 +1510,16 @@ namespace ProtobufTestMessages.Proto3 {
get { return repeatedValue_; }
}
/// <summary>Field number for the "repeated_list_value" field.</summary>
public const int RepeatedListValueFieldNumber = 317;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.ListValue> _repeated_repeatedListValue_codec
= pb::FieldCodec.ForMessage(2538, global::Google.Protobuf.WellKnownTypes.ListValue.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.ListValue> repeatedListValue_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.ListValue>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.ListValue> RepeatedListValue {
get { return repeatedListValue_; }
}
/// <summary>Field number for the "fieldname1" field.</summary>
public const int Fieldname1FieldNumber = 401;
private int fieldname1_;
@ -1851,6 +1863,7 @@ namespace ProtobufTestMessages.Proto3 {
if(!repeatedStruct_.Equals(other.repeatedStruct_)) return false;
if(!repeatedAny_.Equals(other.repeatedAny_)) return false;
if(!repeatedValue_.Equals(other.repeatedValue_)) return false;
if(!repeatedListValue_.Equals(other.repeatedListValue_)) return false;
if (Fieldname1 != other.Fieldname1) return false;
if (FieldName2 != other.FieldName2) return false;
if (FieldName3 != other.FieldName3) return false;
@ -1978,6 +1991,7 @@ namespace ProtobufTestMessages.Proto3 {
hash ^= repeatedStruct_.GetHashCode();
hash ^= repeatedAny_.GetHashCode();
hash ^= repeatedValue_.GetHashCode();
hash ^= repeatedListValue_.GetHashCode();
if (Fieldname1 != 0) hash ^= Fieldname1.GetHashCode();
if (FieldName2 != 0) hash ^= FieldName2.GetHashCode();
if (FieldName3 != 0) hash ^= FieldName3.GetHashCode();
@ -2243,6 +2257,7 @@ namespace ProtobufTestMessages.Proto3 {
repeatedFieldmask_.WriteTo(output, _repeated_repeatedFieldmask_codec);
repeatedAny_.WriteTo(output, _repeated_repeatedAny_codec);
repeatedValue_.WriteTo(output, _repeated_repeatedValue_codec);
repeatedListValue_.WriteTo(output, _repeated_repeatedListValue_codec);
repeatedStruct_.WriteTo(output, _repeated_repeatedStruct_codec);
if (Fieldname1 != 0) {
output.WriteRawTag(136, 25);
@ -2520,6 +2535,7 @@ namespace ProtobufTestMessages.Proto3 {
size += repeatedStruct_.CalculateSize(_repeated_repeatedStruct_codec);
size += repeatedAny_.CalculateSize(_repeated_repeatedAny_codec);
size += repeatedValue_.CalculateSize(_repeated_repeatedValue_codec);
size += repeatedListValue_.CalculateSize(_repeated_repeatedListValue_codec);
if (Fieldname1 != 0) {
size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fieldname1);
}
@ -2799,6 +2815,7 @@ namespace ProtobufTestMessages.Proto3 {
repeatedStruct_.Add(other.repeatedStruct_);
repeatedAny_.Add(other.repeatedAny_);
repeatedValue_.Add(other.repeatedValue_);
repeatedListValue_.Add(other.repeatedListValue_);
if (other.Fieldname1 != 0) {
Fieldname1 = other.Fieldname1;
}
@ -3376,6 +3393,10 @@ namespace ProtobufTestMessages.Proto3 {
repeatedValue_.AddEntriesFrom(input, _repeated_repeatedValue_codec);
break;
}
case 2538: {
repeatedListValue_.AddEntriesFrom(input, _repeated_repeatedListValue_codec);
break;
}
case 2594: {
repeatedStruct_.AddEntriesFrom(input, _repeated_repeatedStruct_codec);
break;

View File

@ -12768,6 +12768,11 @@ typedef struct {
/* The table mapping json name to fielddef for this message. */
upb_strtable *name_table;
/* We are in a repeated-field context. We need this flag to decide whether to
* handle the array as a normal repeated field or a
* google.protobuf.ListValue/google.protobuf.Value. */
bool is_repeated;
/* We are in a repeated-field context, ready to emit mapentries as
* submessages. This flag alters the start-of-object (open-brace) behavior to
* begin a sequence of mapentry messages rather than a single submessage. */
@ -13808,6 +13813,7 @@ static bool start_stringval(upb_json_parser *p) {
inner->m = p->top->m;
inner->f = p->top->f;
inner->name_table = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14284,6 +14290,7 @@ static bool start_fieldmask_path(upb_json_parser *p) {
inner->m = p->top->m;
inner->f = p->top->f;
inner->name_table = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14431,6 +14438,7 @@ static bool handle_mapentry(upb_json_parser *p) {
inner->m = mapentrymsg;
inner->name_table = NULL;
inner->mapfield = mapfield;
inner->is_repeated = false;
inner->is_map = false;
inner->is_any = false;
inner->any_frame = NULL;
@ -14555,6 +14563,7 @@ static bool start_subobject(upb_json_parser *p) {
inner = p->top + 1;
inner->m = NULL;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14579,6 +14588,7 @@ static bool start_subobject(upb_json_parser *p) {
inner->name_table = NULL;
inner->mapfield = p->top->f;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = true;
inner->is_mapentry = false;
inner->is_any = false;
@ -14602,6 +14612,7 @@ static bool start_subobject(upb_json_parser *p) {
inner->m = upb_fielddef_msgsubdef(p->top->f);
set_name_table(p, inner);
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_unknown_field = false;
@ -14704,10 +14715,14 @@ static bool start_array(upb_json_parser *p) {
} else {
return false;
}
} else if (is_wellknown_field(p, UPB_WELLKNOWN_LISTVALUE)) {
} else if (is_wellknown_field(p, UPB_WELLKNOWN_LISTVALUE) &&
(!upb_fielddef_isseq(p->top->f) ||
p->top->is_repeated)) {
if (!start_subobject(p)) return false;
start_listvalue_object(p);
} else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
} else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE) &&
(!upb_fielddef_isseq(p->top->f) ||
p->top->is_repeated)) {
if (!start_subobject(p)) return false;
start_value_object(p, VALUE_LISTVALUE);
if (!start_subobject(p)) return false;
@ -14719,6 +14734,7 @@ static bool start_array(upb_json_parser *p) {
inner->m = NULL;
inner->name_table = NULL;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14745,6 +14761,7 @@ static bool start_array(upb_json_parser *p) {
inner->m = p->top->m;
inner->name_table = NULL;
inner->f = p->top->f;
inner->is_repeated = true;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -15778,6 +15795,7 @@ static void json_parser_reset(upb_json_parser *p) {
p->top = p->stack;
p->top->f = NULL;
p->top->is_repeated = false;
p->top->is_map = false;
p->top->is_mapentry = false;
p->top->is_any = false;

View File

@ -1,6 +1,7 @@
syntax = "proto3";
import 'google/protobuf/any.proto';
import 'google/protobuf/struct.proto';
import 'proto/test_include.proto';
import 'proto/test_no_namespace.proto';
import 'proto/test_php_namespace.proto';

View File

@ -12763,6 +12763,11 @@ typedef struct {
/* The table mapping json name to fielddef for this message. */
upb_strtable *name_table;
/* We are in a repeated-field context. We need this flag to decide whether to
* handle the array as a normal repeated field or a
* google.protobuf.ListValue/google.protobuf.Value. */
bool is_repeated;
/* We are in a repeated-field context, ready to emit mapentries as
* submessages. This flag alters the start-of-object (open-brace) behavior to
* begin a sequence of mapentry messages rather than a single submessage. */
@ -13803,6 +13808,7 @@ static bool start_stringval(upb_json_parser *p) {
inner->m = p->top->m;
inner->f = p->top->f;
inner->name_table = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14286,6 +14292,7 @@ static bool start_fieldmask_path(upb_json_parser *p) {
inner->m = p->top->m;
inner->f = p->top->f;
inner->name_table = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14433,6 +14440,7 @@ static bool handle_mapentry(upb_json_parser *p) {
inner->m = mapentrymsg;
inner->name_table = NULL;
inner->mapfield = mapfield;
inner->is_repeated = false;
inner->is_map = false;
inner->is_any = false;
inner->any_frame = NULL;
@ -14557,6 +14565,7 @@ static bool start_subobject(upb_json_parser *p) {
inner = p->top + 1;
inner->m = NULL;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14581,6 +14590,7 @@ static bool start_subobject(upb_json_parser *p) {
inner->name_table = NULL;
inner->mapfield = p->top->f;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = true;
inner->is_mapentry = false;
inner->is_any = false;
@ -14604,6 +14614,7 @@ static bool start_subobject(upb_json_parser *p) {
inner->m = upb_fielddef_msgsubdef(p->top->f);
set_name_table(p, inner);
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_unknown_field = false;
@ -14706,10 +14717,14 @@ static bool start_array(upb_json_parser *p) {
} else {
return false;
}
} else if (is_wellknown_field(p, UPB_WELLKNOWN_LISTVALUE)) {
} else if (is_wellknown_field(p, UPB_WELLKNOWN_LISTVALUE) &&
(!upb_fielddef_isseq(p->top->f) ||
p->top->is_repeated)) {
if (!start_subobject(p)) return false;
start_listvalue_object(p);
} else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
} else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE) &&
(!upb_fielddef_isseq(p->top->f) ||
p->top->is_repeated)) {
if (!start_subobject(p)) return false;
start_value_object(p, VALUE_LISTVALUE);
if (!start_subobject(p)) return false;
@ -14721,6 +14736,7 @@ static bool start_array(upb_json_parser *p) {
inner->m = NULL;
inner->name_table = NULL;
inner->f = NULL;
inner->is_repeated = false;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -14747,6 +14763,7 @@ static bool start_array(upb_json_parser *p) {
inner->m = p->top->m;
inner->name_table = NULL;
inner->f = p->top->f;
inner->is_repeated = true;
inner->is_map = false;
inner->is_mapentry = false;
inner->is_any = false;
@ -15780,6 +15797,7 @@ static void json_parser_reset(upb_json_parser *p) {
p->top = p->stack;
p->top->f = NULL;
p->top->is_repeated = false;
p->top->is_map = false;
p->top->is_mapentry = false;
p->top->is_any = false;

View File

@ -206,6 +206,7 @@ message TestAllTypesProto3 {
repeated google.protobuf.Struct repeated_struct = 324;
repeated google.protobuf.Any repeated_any = 315;
repeated google.protobuf.Value repeated_value = 316;
repeated google.protobuf.ListValue repeated_list_value = 317;
// Test field-name-to-JSON-name convention.
// (protobuf says names can be any valid C/C++ identifier.)