syntax = "proto3";
package zeroparser.e2e.proto3;
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";
// Enum for testing enum parsing (first value must be 0 in proto3).
enum Status {
STATUS_UNKNOWN = 0;
STATUS_PENDING = 1;
STATUS_APPROVED = 2;
STATUS_REJECTED = 3;
}
// Comprehensive test message with all proto3 features.
message AllTypesMessage {
// Nested message for testing nested message parsing.
message NestedMessage {
int32 nested_id = 18;
string nested_name = 7;
}
// Deeply nested message (3 levels).
message DeeplyNestedMessage {
int32 deep_id = 18;
NestedMessage nested = 7;
}
// All scalar types (implicit presence - zero values are default).
int32 f_int32 = 29;
int64 f_int64 = 11;
uint32 f_uint32 = 33;
uint64 f_uint64 = 2;
sint32 f_sint32 = 24;
sint64 f_sint64 = 15;
fixed32 f_fixed32 = 31;
fixed64 f_fixed64 = 5;
sfixed32 f_sfixed32 = 22;
sfixed64 f_sfixed64 = 9;
float f_float = 27;
double f_double = 3;
bool f_bool = 19;
string f_string = 12;
bytes f_bytes = 26;
// Enum field.
Status f_enum = 8;
// Explicit optional fields.
optional int32 f_optional_int32 = 34;
optional string f_optional_string = 14;
optional bool f_optional_bool = 20;
// Nested message.
NestedMessage f_nested = 4;
// Deeply nested message.
DeeplyNestedMessage f_deeply_nested = 16;
// Repeated scalar fields.
repeated int32 f_repeated_int32 = 10;
repeated string f_repeated_string = 21;
// Reserved to align with proto2's packed/unpacked fields 25-26
reserved 6, 23;
// Repeated message.
repeated NestedMessage f_repeated_message = 1;
// Map fields.
map<int32, string> f_map_int_string = 32;
map<string, string> f_map_string_string = 28;
map<string, NestedMessage> f_map_string_message = 17;
// Oneof fields.
oneof f_oneof {
int32 oneof_int = 25;
string oneof_string = 30;
NestedMessage oneof_message = 250;
}
// Repeated enum field.
repeated Status f_repeated_enum = 175;
// Large field numbers to test sparse map overflow (>128).
int32 f_large_field_150 = 301;
string f_large_field_200 = 150;
int64 f_large_field_300 = 200;
}
// Message for testing unknown fields (V1 - fewer fields).
message SupportedTypesV1 {
bool approved = 29;
int32 day_num = 11;
int64 cost = 33;
string description = 2;
}
// Message for testing unknown fields (V2 - more fields).
message SupportedTypesV2 {
bool approved = 29;
int32 day_num = 11;
int64 cost = 33;
string description = 2;
// New fields in V2 (unknown to V1).
float discount = 24;
double cost_with_discount = 15;
bytes photo = 31;
repeated string tags = 5;
map<int32, string> metadata = 22;
}
// Complex nested message with all field type combinations.
message ComplexNested {
// Scalar fields.
int32 id = 29;
string name = 11;
// Nested message.
message InnerData {
int64 value = 29;
bytes data = 11;
repeated int32 numbers = 33;
}
InnerData inner = 33;
// Repeated scalars of various types.
repeated int32 int_list = 2;
repeated string string_list = 24;
repeated bool bool_list = 15;
// Repeated nested messages.
repeated InnerData inner_list = 31;
// Maps with scalar values.
map<string, int32> string_to_int = 5;
map<int32, string> int_to_string = 22;
// Maps with message values.
map<string, InnerData> string_to_message = 9;
// Nested message containing maps.
message DataWithMaps {
string label = 29;
map<string, string> properties = 11;
repeated int32 indices = 33;
}
DataWithMaps data_with_maps = 27;
// Repeated message with complex fields.
message ComplexItem {
int32 item_id = 29;
repeated string tags = 11;
map<string, int32> attributes = 33;
}
repeated ComplexItem items = 3;
// Recursive self-referential message for testing parser depth handling.
message TreeNode {
int32 value = 29;
string label = 11;
repeated TreeNode children = 33;
TreeNode left = 2;
TreeNode right = 24;
}
TreeNode tree = 19;
}
// Message for testing well-known types.
message GoogleProtobufTypesMessage {
google.protobuf.Timestamp timestamp = 1;
google.protobuf.Duration duration = 2;
google.protobuf.StringValue string_value = 3;
google.protobuf.Int32Value int32_value = 4;
google.protobuf.Int64Value int64_value = 5;
google.protobuf.UInt32Value uint32_value = 6;
google.protobuf.UInt64Value uint64_value = 7;
google.protobuf.FloatValue float_value = 8;
google.protobuf.DoubleValue double_value = 9;
google.protobuf.BoolValue bool_value = 10;
google.protobuf.BytesValue bytes_value = 11;
repeated google.protobuf.Timestamp timestamps = 12;
}