|
|
|
@ -9,12 +9,15 @@ |
|
|
|
|
// |
|
|
|
|
// This is like unittest.proto but with optimize_for = LITE_RUNTIME. |
|
|
|
|
|
|
|
|
|
syntax = "proto2"; |
|
|
|
|
edition = "2023"; |
|
|
|
|
|
|
|
|
|
package protobuf_unittest; |
|
|
|
|
|
|
|
|
|
import "google/protobuf/unittest_import_lite.proto"; |
|
|
|
|
|
|
|
|
|
option features.enum_type = CLOSED; |
|
|
|
|
option features.repeated_field_encoding = EXPANDED; |
|
|
|
|
option features.utf8_validation = NONE; |
|
|
|
|
option cc_enable_arenas = true; |
|
|
|
|
option optimize_for = LITE_RUNTIME; |
|
|
|
|
option java_package = "com.google.protobuf"; |
|
|
|
@ -22,13 +25,13 @@ 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; |
|
|
|
|
repeated int32 dd = 3 [packed = true]; |
|
|
|
|
int32 bb = 1; |
|
|
|
|
int64 cc = 2; |
|
|
|
|
repeated int32 dd = 3 [features.repeated_field_encoding = PACKED]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message NestedMessage2 { |
|
|
|
|
optional int32 dd = 1; |
|
|
|
|
int32 dd = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum NestedEnum { |
|
|
|
@ -38,45 +41,44 @@ message TestAllTypesLite { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 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; |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
message OptionalGroup { |
|
|
|
|
int32 a = 17; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
optional NestedMessage optional_nested_message = 18; |
|
|
|
|
optional ForeignMessageLite optional_foreign_message = 19; |
|
|
|
|
optional protobuf_unittest_import.ImportMessageLite optional_import_message = |
|
|
|
|
20; |
|
|
|
|
OptionalGroup optionalgroup = 16 [features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
optional NestedEnum optional_nested_enum = 21; |
|
|
|
|
optional ForeignEnumLite optional_foreign_enum = 22; |
|
|
|
|
optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; |
|
|
|
|
NestedMessage optional_nested_message = 18; |
|
|
|
|
ForeignMessageLite optional_foreign_message = 19; |
|
|
|
|
protobuf_unittest_import.ImportMessageLite optional_import_message = 20; |
|
|
|
|
NestedEnum optional_nested_enum = 21; |
|
|
|
|
ForeignEnumLite optional_foreign_enum = 22; |
|
|
|
|
protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; |
|
|
|
|
string optional_string_piece = 24 [ctype = STRING_PIECE]; |
|
|
|
|
|
|
|
|
|
optional string optional_string_piece = 24 [ctype = STRING_PIECE]; |
|
|
|
|
optional string optional_cord = 25 [ctype = CORD]; |
|
|
|
|
string optional_cord = 25 [ctype = CORD]; |
|
|
|
|
|
|
|
|
|
// Defined in unittest_import_public.proto |
|
|
|
|
optional protobuf_unittest_import.PublicImportMessageLite |
|
|
|
|
protobuf_unittest_import.PublicImportMessageLite |
|
|
|
|
optional_public_import_message = 26; |
|
|
|
|
NestedMessage optional_lazy_message = 27 [lazy = true]; |
|
|
|
|
|
|
|
|
|
optional NestedMessage optional_lazy_message = 27 [lazy = true]; |
|
|
|
|
optional NestedMessage optional_unverified_lazy_message = 28 |
|
|
|
|
[unverified_lazy = true]; |
|
|
|
|
NestedMessage optional_unverified_lazy_message = 28 [unverified_lazy = true]; |
|
|
|
|
|
|
|
|
|
// Repeated |
|
|
|
|
repeated int32 repeated_int32 = 31; |
|
|
|
@ -95,50 +97,67 @@ message TestAllTypesLite { |
|
|
|
|
repeated string repeated_string = 44; |
|
|
|
|
repeated bytes repeated_bytes = 45; |
|
|
|
|
|
|
|
|
|
repeated group RepeatedGroup = 46 { |
|
|
|
|
optional int32 a = 47; |
|
|
|
|
message RepeatedGroup { |
|
|
|
|
int32 a = 47; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
repeated RepeatedGroup repeatedgroup = 46 |
|
|
|
|
[features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
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 ; |
|
|
|
|
repeated NestedMessage repeated_lazy_message = 57; |
|
|
|
|
|
|
|
|
|
// 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 |
|
|
|
|
int32 default_int32 = 61 [default = 41]; |
|
|
|
|
|
|
|
|
|
int64 default_int64 = 62 [default = 42]; |
|
|
|
|
|
|
|
|
|
uint32 default_uint32 = 63 [default = 43]; |
|
|
|
|
|
|
|
|
|
uint64 default_uint64 = 64 [default = 44]; |
|
|
|
|
|
|
|
|
|
sint32 default_sint32 = 65 [default = -45]; |
|
|
|
|
|
|
|
|
|
sint64 default_sint64 = 66 [default = 46]; |
|
|
|
|
|
|
|
|
|
fixed32 default_fixed32 = 67 [default = 47]; |
|
|
|
|
|
|
|
|
|
fixed64 default_fixed64 = 68 [default = 48]; |
|
|
|
|
|
|
|
|
|
sfixed32 default_sfixed32 = 69 [default = 49]; |
|
|
|
|
|
|
|
|
|
sfixed64 default_sfixed64 = 70 [default = -50]; |
|
|
|
|
|
|
|
|
|
float default_float = 71 [default = 51.5]; |
|
|
|
|
|
|
|
|
|
double default_double = 72 [default = 5.2e4]; |
|
|
|
|
|
|
|
|
|
bool default_bool = 73 [default = true]; |
|
|
|
|
|
|
|
|
|
string default_string = 74 [default = "hello"]; |
|
|
|
|
|
|
|
|
|
bytes default_bytes = 75 [default = "world"]; |
|
|
|
|
|
|
|
|
|
NestedEnum default_nested_enum = 81 [default = BAR]; |
|
|
|
|
|
|
|
|
|
ForeignEnumLite default_foreign_enum = 82 [default = FOREIGN_LITE_BAR]; |
|
|
|
|
|
|
|
|
|
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"]; |
|
|
|
|
string default_string_piece = 84 [ctype = STRING_PIECE, default = "abc"]; |
|
|
|
|
|
|
|
|
|
string default_cord = 85 [ctype = CORD, default = "123"]; |
|
|
|
|
|
|
|
|
|
// For oneof test |
|
|
|
|
oneof oneof_field { |
|
|
|
@ -147,15 +166,16 @@ message TestAllTypesLite { |
|
|
|
|
string oneof_string = 113; |
|
|
|
|
bytes oneof_bytes = 114; |
|
|
|
|
NestedMessage oneof_lazy_nested_message = 115 [lazy = true]; |
|
|
|
|
|
|
|
|
|
NestedMessage2 oneof_nested_message2 = 117; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests toString for non-repeated fields with a list suffix |
|
|
|
|
optional int32 deceptively_named_list = 116; |
|
|
|
|
int32 deceptively_named_list = 116; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message ForeignMessageLite { |
|
|
|
|
optional int32 c = 1; |
|
|
|
|
int32 c = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum ForeignEnumLite { |
|
|
|
@ -165,20 +185,43 @@ enum ForeignEnumLite { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
repeated int32 packed_int32 = 90 [features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated int64 packed_int64 = 91 [features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated uint32 packed_uint32 = 92 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated uint64 packed_uint64 = 93 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sint32 packed_sint32 = 94 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sint64 packed_sint64 = 95 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated fixed32 packed_fixed32 = 96 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated fixed64 packed_fixed64 = 97 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sfixed32 packed_sfixed32 = 98 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sfixed64 packed_sfixed64 = 99 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated float packed_float = 100 [features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated double packed_double = 101 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated bool packed_bool = 102 [features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated ForeignEnumLite packed_enum = 103 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message TestAllExtensionsLite { |
|
|
|
@ -187,49 +230,43 @@ message TestAllExtensionsLite { |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
int32 optional_int32_extension_lite = 1; |
|
|
|
|
int64 optional_int64_extension_lite = 2; |
|
|
|
|
uint32 optional_uint32_extension_lite = 3; |
|
|
|
|
uint64 optional_uint64_extension_lite = 4; |
|
|
|
|
sint32 optional_sint32_extension_lite = 5; |
|
|
|
|
sint64 optional_sint64_extension_lite = 6; |
|
|
|
|
fixed32 optional_fixed32_extension_lite = 7; |
|
|
|
|
fixed64 optional_fixed64_extension_lite = 8; |
|
|
|
|
sfixed32 optional_sfixed32_extension_lite = 9; |
|
|
|
|
sfixed64 optional_sfixed64_extension_lite = 10; |
|
|
|
|
float optional_float_extension_lite = 11; |
|
|
|
|
double optional_double_extension_lite = 12; |
|
|
|
|
bool optional_bool_extension_lite = 13; |
|
|
|
|
string optional_string_extension_lite = 14; |
|
|
|
|
bytes optional_bytes_extension_lite = 15; |
|
|
|
|
OptionalGroup_extension_lite optionalgroup_extension_lite = 16 |
|
|
|
|
[features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
TestAllTypesLite.NestedMessage optional_nested_message_extension_lite = 18; |
|
|
|
|
ForeignMessageLite optional_foreign_message_extension_lite = 19; |
|
|
|
|
protobuf_unittest_import.ImportMessageLite |
|
|
|
|
optional_import_message_extension_lite = 20; |
|
|
|
|
TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; |
|
|
|
|
ForeignEnumLite optional_foreign_enum_extension_lite = 22; |
|
|
|
|
protobuf_unittest_import.ImportEnumLite optional_import_enum_extension_lite = |
|
|
|
|
23; |
|
|
|
|
string optional_string_piece_extension_lite = 24 [ctype = STRING_PIECE]; |
|
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
// TODO: ctype=CORD is not supported for extension. Add |
|
|
|
|
// ctype=CORD option back after it is supported. |
|
|
|
|
optional string optional_cord_extension_lite = 25; |
|
|
|
|
|
|
|
|
|
optional protobuf_unittest_import.PublicImportMessageLite |
|
|
|
|
string optional_cord_extension_lite = 25; |
|
|
|
|
protobuf_unittest_import.PublicImportMessageLite |
|
|
|
|
optional_public_import_message_extension_lite = 26; |
|
|
|
|
TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite = 27 |
|
|
|
|
[lazy = true]; |
|
|
|
|
|
|
|
|
|
optional TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite = |
|
|
|
|
27 [lazy = true]; |
|
|
|
|
optional TestAllTypesLite.NestedMessage |
|
|
|
|
TestAllTypesLite.NestedMessage |
|
|
|
|
optional_unverified_lazy_message_extension_lite = 28 |
|
|
|
|
[unverified_lazy = true]; |
|
|
|
|
|
|
|
|
@ -249,67 +286,87 @@ extend TestAllExtensionsLite { |
|
|
|
|
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 RepeatedGroup_extension_lite repeatedgroup_extension_lite = 46 |
|
|
|
|
[features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
|
|
|
|
|
// TODO: ctype=CORD is not supported for extension. Add |
|
|
|
|
// ctype=CORD option back after it is supported. |
|
|
|
|
repeated string repeated_cord_extension_lite = 55; |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
int32 default_int32_extension_lite = 61 [default = 41]; |
|
|
|
|
|
|
|
|
|
int64 default_int64_extension_lite = 62 [default = 42]; |
|
|
|
|
|
|
|
|
|
uint32 default_uint32_extension_lite = 63 [default = 43]; |
|
|
|
|
|
|
|
|
|
uint64 default_uint64_extension_lite = 64 [default = 44]; |
|
|
|
|
|
|
|
|
|
sint32 default_sint32_extension_lite = 65 [default = -45]; |
|
|
|
|
|
|
|
|
|
sint64 default_sint64_extension_lite = 66 [default = 46]; |
|
|
|
|
|
|
|
|
|
fixed32 default_fixed32_extension_lite = 67 [default = 47]; |
|
|
|
|
|
|
|
|
|
fixed64 default_fixed64_extension_lite = 68 [default = 48]; |
|
|
|
|
|
|
|
|
|
sfixed32 default_sfixed32_extension_lite = 69 [default = 49]; |
|
|
|
|
|
|
|
|
|
sfixed64 default_sfixed64_extension_lite = 70 [default = -50]; |
|
|
|
|
|
|
|
|
|
float default_float_extension_lite = 71 [default = 51.5]; |
|
|
|
|
|
|
|
|
|
double default_double_extension_lite = 72 [default = 5.2e4]; |
|
|
|
|
|
|
|
|
|
bool default_bool_extension_lite = 73 [default = true]; |
|
|
|
|
|
|
|
|
|
string default_string_extension_lite = 74 [default = "hello"]; |
|
|
|
|
|
|
|
|
|
bytes default_bytes_extension_lite = 75 [default = "world"]; |
|
|
|
|
|
|
|
|
|
TestAllTypesLite.NestedEnum default_nested_enum_extension_lite = 81 |
|
|
|
|
[default = BAR]; |
|
|
|
|
optional ForeignEnumLite default_foreign_enum_extension_lite = 82 |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
protobuf_unittest_import.ImportEnumLite default_import_enum_extension_lite = 83 |
|
|
|
|
[default = IMPORT_LITE_BAR]; |
|
|
|
|
|
|
|
|
|
string default_string_piece_extension_lite = 84 |
|
|
|
|
[ctype = STRING_PIECE, default = "abc"]; |
|
|
|
|
|
|
|
|
|
// TODO: ctype=CORD is not supported for extension. Add |
|
|
|
|
// ctype=CORD option back after it is supported. |
|
|
|
|
optional string default_cord_extension_lite = 85 [default = "123"]; |
|
|
|
|
string default_cord_extension_lite = 85 [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; |
|
|
|
|
uint32 oneof_uint32_extension_lite = 111; |
|
|
|
|
TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite = 112; |
|
|
|
|
string oneof_string_extension_lite = 113; |
|
|
|
|
bytes oneof_bytes_extension_lite = 114; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message OptionalGroup_extension_lite { |
|
|
|
|
int32 a = 17; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message RepeatedGroup_extension_lite { |
|
|
|
|
int32 a = 47; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message TestPackedExtensionsLite { |
|
|
|
@ -317,35 +374,66 @@ message TestPackedExtensionsLite { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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]; |
|
|
|
|
repeated int32 packed_int32_extension_lite = 90 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated int64 packed_int64_extension_lite = 91 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated uint32 packed_uint32_extension_lite = 92 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated uint64 packed_uint64_extension_lite = 93 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sint32 packed_sint32_extension_lite = 94 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sint64 packed_sint64_extension_lite = 95 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated fixed32 packed_fixed32_extension_lite = 96 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated fixed64 packed_fixed64_extension_lite = 97 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sfixed32 packed_sfixed32_extension_lite = 98 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated sfixed64 packed_sfixed64_extension_lite = 99 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated float packed_float_extension_lite = 100 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated double packed_double_extension_lite = 101 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated bool packed_bool_extension_lite = 102 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
repeated ForeignEnumLite packed_enum_extension_lite = 103 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message TestNestedExtensionLite { |
|
|
|
|
extend TestAllExtensionsLite { |
|
|
|
|
optional int32 nested_extension = 12345; |
|
|
|
|
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]; |
|
|
|
|
required int32 deprecated_field2 = 2 [deprecated = true]; |
|
|
|
|
optional string deprecated_field3 = 3 [deprecated = true]; |
|
|
|
|
optional TestDeprecatedLite deprecated_field4 = 4 [deprecated = true]; |
|
|
|
|
int32 deprecated_field = 1 [deprecated = true]; |
|
|
|
|
|
|
|
|
|
int32 deprecated_field2 = 2 |
|
|
|
|
[features.field_presence = LEGACY_REQUIRED, deprecated = true]; |
|
|
|
|
|
|
|
|
|
string deprecated_field3 = 3 [deprecated = true]; |
|
|
|
|
|
|
|
|
|
TestDeprecatedLite deprecated_field4 = 4 [deprecated = true]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// See the comments of the same type in unittest.proto. |
|
|
|
@ -354,27 +442,46 @@ message TestParsingMergeLite { |
|
|
|
|
repeated TestAllTypesLite field1 = 1; |
|
|
|
|
repeated TestAllTypesLite field2 = 2; |
|
|
|
|
repeated TestAllTypesLite field3 = 3; |
|
|
|
|
repeated group Group1 = 10 { |
|
|
|
|
optional TestAllTypesLite field1 = 11; |
|
|
|
|
|
|
|
|
|
message Group1 { |
|
|
|
|
TestAllTypesLite field1 = 11; |
|
|
|
|
} |
|
|
|
|
repeated group Group2 = 20 { |
|
|
|
|
optional TestAllTypesLite field1 = 21; |
|
|
|
|
|
|
|
|
|
repeated Group1 group1 = 10 [features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
message Group2 { |
|
|
|
|
TestAllTypesLite field1 = 21; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
repeated Group2 group2 = 20 [features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
repeated TestAllTypesLite ext1 = 1000; |
|
|
|
|
repeated TestAllTypesLite ext2 = 1001; |
|
|
|
|
} |
|
|
|
|
required TestAllTypesLite required_all_types = 1; |
|
|
|
|
optional TestAllTypesLite optional_all_types = 2; |
|
|
|
|
|
|
|
|
|
TestAllTypesLite required_all_types = 1 |
|
|
|
|
[features.field_presence = LEGACY_REQUIRED]; |
|
|
|
|
|
|
|
|
|
TestAllTypesLite optional_all_types = 2; |
|
|
|
|
repeated TestAllTypesLite repeated_all_types = 3; |
|
|
|
|
optional group OptionalGroup = 10 { |
|
|
|
|
optional TestAllTypesLite optional_group_all_types = 11; |
|
|
|
|
|
|
|
|
|
message OptionalGroup { |
|
|
|
|
TestAllTypesLite optional_group_all_types = 11; |
|
|
|
|
} |
|
|
|
|
repeated group RepeatedGroup = 20 { |
|
|
|
|
optional TestAllTypesLite repeated_group_all_types = 21; |
|
|
|
|
|
|
|
|
|
OptionalGroup optionalgroup = 10 [features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
message RepeatedGroup { |
|
|
|
|
TestAllTypesLite repeated_group_all_types = 21; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
repeated RepeatedGroup repeatedgroup = 20 |
|
|
|
|
[features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
extensions 1000 to max; |
|
|
|
|
|
|
|
|
|
extend TestParsingMergeLite { |
|
|
|
|
optional TestAllTypesLite optional_ext = 1000; |
|
|
|
|
TestAllTypesLite optional_ext = 1000; |
|
|
|
|
repeated TestAllTypesLite repeated_ext = 1001; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -382,7 +489,7 @@ message TestParsingMergeLite { |
|
|
|
|
// Test that the correct exception is thrown by parseFrom in a corner case |
|
|
|
|
// involving merging, extensions, and required fields. |
|
|
|
|
message TestMergeExceptionLite { |
|
|
|
|
optional TestAllExtensionsLite all_extensions = 1; |
|
|
|
|
TestAllExtensionsLite all_extensions = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TestEmptyMessageLite is used to test unknown fields support in lite mode. |
|
|
|
@ -404,30 +511,36 @@ enum V2EnumLite { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message V1MessageLite { |
|
|
|
|
required int32 int_field = 1; |
|
|
|
|
optional V1EnumLite enum_field = 2 [default = V1_FIRST]; |
|
|
|
|
int32 int_field = 1 [features.field_presence = LEGACY_REQUIRED]; |
|
|
|
|
|
|
|
|
|
V1EnumLite enum_field = 2 [default = V1_FIRST]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message V2MessageLite { |
|
|
|
|
required int32 int_field = 1; |
|
|
|
|
optional V2EnumLite enum_field = 2 [default = V2_FIRST]; |
|
|
|
|
int32 int_field = 1 [features.field_presence = LEGACY_REQUIRED]; |
|
|
|
|
|
|
|
|
|
V2EnumLite enum_field = 2 [default = V2_FIRST]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message TestHugeFieldNumbersLite { |
|
|
|
|
optional int32 optional_int32 = 536870000; |
|
|
|
|
optional int32 fixed_32 = 536870001; |
|
|
|
|
repeated int32 repeated_int32 = 536870002 [packed = false]; |
|
|
|
|
repeated int32 packed_int32 = 536870003 [packed = true]; |
|
|
|
|
|
|
|
|
|
optional ForeignEnumLite optional_enum = 536870004; |
|
|
|
|
optional string optional_string = 536870005; |
|
|
|
|
optional bytes optional_bytes = 536870006; |
|
|
|
|
optional ForeignMessageLite optional_message = 536870007; |
|
|
|
|
|
|
|
|
|
optional group OptionalGroup = 536870008 { |
|
|
|
|
optional int32 group_a = 536870009; |
|
|
|
|
int32 optional_int32 = 536870000; |
|
|
|
|
int32 fixed_32 = 536870001; |
|
|
|
|
repeated int32 repeated_int32 = 536870002; |
|
|
|
|
repeated int32 packed_int32 = 536870003 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
|
|
|
|
|
ForeignEnumLite optional_enum = 536870004; |
|
|
|
|
string optional_string = 536870005; |
|
|
|
|
bytes optional_bytes = 536870006; |
|
|
|
|
ForeignMessageLite optional_message = 536870007; |
|
|
|
|
|
|
|
|
|
message OptionalGroup { |
|
|
|
|
int32 group_a = 536870009; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
OptionalGroup optionalgroup = 536870008 |
|
|
|
|
[features.message_encoding = DELIMITED]; |
|
|
|
|
|
|
|
|
|
map<string, string> string_string_map = 536870010; |
|
|
|
|
|
|
|
|
|
oneof oneof_field { |
|
|
|
@ -445,7 +558,7 @@ message TestHugeFieldNumbersLite { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
extend TestHugeFieldNumbersLite { |
|
|
|
|
optional TestAllTypesLite test_all_types_lite = 536860000; |
|
|
|
|
TestAllTypesLite test_all_types_lite = 536860000; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message TestOneofParsingLite { |
|
|
|
@ -454,11 +567,16 @@ message TestOneofParsingLite { |
|
|
|
|
TestAllTypesLite oneof_submessage = 2; |
|
|
|
|
string oneof_string = 3; |
|
|
|
|
bytes oneof_bytes = 4 [default = "default bytes"]; |
|
|
|
|
|
|
|
|
|
string oneof_string_cord = 5 [ctype = CORD, default = "default Cord"]; |
|
|
|
|
|
|
|
|
|
bytes oneof_bytes_cord = 6 [ctype = CORD]; |
|
|
|
|
|
|
|
|
|
string oneof_string_string_piece = 7 [ctype = STRING_PIECE]; |
|
|
|
|
|
|
|
|
|
bytes oneof_bytes_string_piece = 8 |
|
|
|
|
[ctype = STRING_PIECE, default = "default StringPiece"]; |
|
|
|
|
|
|
|
|
|
V2EnumLite oneof_enum = 9; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -473,7 +591,8 @@ message TestMessageSetLite { |
|
|
|
|
// packed and non-packed repeated fields. We use the field number 2048, because |
|
|
|
|
// that is large enough to require a 3-byte varint for the tag. |
|
|
|
|
message PackedInt32 { |
|
|
|
|
repeated int32 repeated_int32 = 2048 [packed = true]; |
|
|
|
|
repeated int32 repeated_int32 = 2048 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message NonPackedInt32 { |
|
|
|
@ -481,7 +600,8 @@ message NonPackedInt32 { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message PackedFixed32 { |
|
|
|
|
repeated fixed32 repeated_fixed32 = 2048 [packed = true]; |
|
|
|
|
repeated fixed32 repeated_fixed32 = 2048 |
|
|
|
|
[features.repeated_field_encoding = PACKED]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message NonPackedFixed32 { |
|
|
|
@ -502,6 +622,6 @@ message DupEnum { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
message RecursiveMessage { |
|
|
|
|
optional RecursiveMessage recurse = 1; |
|
|
|
|
optional bytes payload = 2; |
|
|
|
|
RecursiveMessage recurse = 1; |
|
|
|
|
bytes payload = 2; |
|
|
|
|
} |
|
|
|
|