|
|
|
// Protocol Buffers - Google's data interchange format
|
|
|
|
// Copyright 2023 Google LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
syntax = "proto2";
|
|
|
|
|
|
|
|
package protos_generator.test;
|
|
|
|
|
|
|
|
import "protos_generator/tests/child_model.proto";
|
|
|
|
|
|
|
|
message TestModelContainer {
|
|
|
|
repeated TestModel models = 1;
|
|
|
|
optional ChildModel3 proto_3_child = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TestModel {
|
|
|
|
optional int32 value = 1;
|
|
|
|
repeated int32 value_array = 2; // _UPB_MODE_ARRAY
|
|
|
|
repeated int32 value_packed_array = 3
|
|
|
|
[packed = true]; // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED
|
|
|
|
repeated int32 value_deprec = 4 [deprecated = true];
|
|
|
|
optional string str1 = 115;
|
|
|
|
optional bool b1 = 9;
|
|
|
|
optional bool b2 = 10;
|
|
|
|
optional string str2 = 50;
|
|
|
|
optional string str3 = 11;
|
|
|
|
optional float optional_float = 14;
|
|
|
|
optional double optional_double = 15;
|
|
|
|
optional int64 optional_int64 = 16;
|
|
|
|
optional uint32 optional_uint32 = 17;
|
|
|
|
optional uint64 optional_uint64 = 18;
|
|
|
|
optional sint32 optional_sint32 = 19;
|
|
|
|
optional sint64 optional_sint64 = 20;
|
|
|
|
optional fixed32 optional_fixed32 = 21;
|
|
|
|
optional fixed64 optional_fixed64 = 22;
|
|
|
|
optional sfixed32 optional_sfixed32 = 23;
|
|
|
|
optional sfixed64 optional_sfixed64 = 24;
|
|
|
|
repeated int64 repeated_int64 = 25;
|
|
|
|
repeated uint64 repeated_uint64 = 26;
|
|
|
|
repeated fixed64 repeated_fixed64 = 27;
|
|
|
|
repeated sfixed64 repeated_sfixed64 = 28;
|
|
|
|
repeated bool repeated_bool = 29;
|
|
|
|
repeated string repeated_string = 35;
|
|
|
|
optional bytes optional_bytes = 36;
|
|
|
|
message NestedChild {
|
|
|
|
optional string nested_child_name = 211;
|
|
|
|
}
|
|
|
|
optional NestedChild nested_child_1 = 212;
|
|
|
|
optional ChildModel1 child_model_1 = 222;
|
|
|
|
repeated ChildModel1 child_models = 223;
|
|
|
|
optional ChildModel1 bar = 224;
|
|
|
|
oneof child_oneof1 {
|
|
|
|
string oneof_member1 = 98;
|
|
|
|
bool oneof_member2 = 99;
|
|
|
|
}
|
|
|
|
optional int32 int_value_with_default = 31
|
|
|
|
[default = 65]; // Not supported yet
|
|
|
|
optional string string_value_with_default = 32
|
|
|
|
[default = "hello"]; // Not supported yet
|
|
|
|
optional float float_value_with_default = 33 [default = inf];
|
|
|
|
optional float double_value_with_default = 34 [default = -inf];
|
|
|
|
|
|
|
|
map<int32, ChildModel1> child_map = 225;
|
|
|
|
optional TestModel recursive_child = 226;
|
|
|
|
map<string, ChildModel1> child_str_map = 227;
|
|
|
|
map<string, int32> str_to_int_map = 228;
|
|
|
|
map<string, string> str_to_str_map = 229;
|
|
|
|
|
|
|
|
extend TestAnnotation {
|
|
|
|
optional OtherExtension in_message_ext = 15000;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Category {
|
|
|
|
IMAGES = 5;
|
|
|
|
NEWS = 6;
|
|
|
|
VIDEO = 7;
|
|
|
|
RADIO = 8 [deprecated = true];
|
|
|
|
}
|
|
|
|
optional Category category = 37;
|
|
|
|
|
|
|
|
// keyword collisions (double, template, ...)
|
|
|
|
oneof type {
|
|
|
|
string string = 230;
|
|
|
|
int64 int64 = 231;
|
|
|
|
double double = 232;
|
|
|
|
}
|
|
|
|
optional string template = 233;
|
|
|
|
optional string msg = 234;
|
|
|
|
optional string arena = 235;
|
|
|
|
|
|
|
|
// Tests publicly imported enum.
|
|
|
|
optional TestEnum imported_enum = 238;
|
|
|
|
|
|
|
|
optional string phase = 239;
|
|
|
|
optional bool clear_phase = 240;
|
|
|
|
|
|
|
|
optional string doc_id = 241;
|
|
|
|
optional bool set_doc_id = 242;
|
|
|
|
|
|
|
|
extensions 10000 to max;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Old version with fewer fields to test backward/forward compatibility.
|
|
|
|
message TestModelContainerV1 {
|
|
|
|
repeated TestModelV1 models = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TestModelV1 {
|
|
|
|
optional int32 value = 1;
|
|
|
|
repeated int32 value2 = 2;
|
|
|
|
repeated int32 value3 = 3 [packed = true];
|
|
|
|
repeated int32 value4 = 4 [deprecated = true];
|
|
|
|
optional bool b1 = 9;
|
|
|
|
optional bool b2 = 10;
|
|
|
|
optional string str2 = 50;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum PrimaryColors {
|
|
|
|
RED = 1;
|
|
|
|
GREEN = 2;
|
|
|
|
BLUE = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TestModel extension.
|
|
|
|
message ThemeExtension {
|
|
|
|
extend TestModel {
|
|
|
|
optional ThemeExtension theme_extension = 12003;
|
|
|
|
}
|
|
|
|
optional string ext_name = 1;
|
|
|
|
optional bool ext_bool = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
extend TestModel {
|
|
|
|
optional ThemeExtension theme = 12001;
|
|
|
|
}
|
|
|
|
|
|
|
|
message OtherExtension {
|
|
|
|
optional string ext2_name = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extend TestModel {
|
|
|
|
optional OtherExtension other_ext = 12002;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TestAnnotation {
|
|
|
|
extensions 10000 to max;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TestMessageHasEnum {
|
|
|
|
optional EnumDeclaredAfterMessage enum_declared_after_message = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum EnumDeclaredAfterMessage {
|
|
|
|
ZERO = 0;
|
|
|
|
ONE = 1;
|
|
|
|
TWO = 2;
|
|
|
|
THREE = 3;
|
|
|
|
}
|