File: test_model.proto

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (195 lines) | stat: -rw-r--r-- 4,363 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// 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

edition = "2023";

package hpb_unittest;

import "google/protobuf/compiler/hpb/tests/child_model.proto";

option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;

message TestModelContainer {
  repeated TestModel models = 1;
  ChildModel3 proto_3_child = 2;

  extensions 10000 to max
  [verification = UNVERIFIED];
}

message TestModel {
  int32 value = 1;
  repeated int32 value_array = 2;  // _UPB_MODE_ARRAY
  repeated int32 value_packed_array = 3
      [features.repeated_field_encoding =
           PACKED];  // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED

  repeated int32 value_deprec = 4 [deprecated = true];

  string str1 = 115;
  bool b1 = 9;
  bool b2 = 10;
  string str2 = 50;
  string str3 = 11;
  float optional_float = 14;
  double optional_double = 15;
  int64 optional_int64 = 16;
  uint32 optional_uint32 = 17;
  uint64 optional_uint64 = 18;
  sint32 optional_sint32 = 19;
  sint64 optional_sint64 = 20;
  fixed32 optional_fixed32 = 21;
  fixed64 optional_fixed64 = 22;
  sfixed32 optional_sfixed32 = 23;
  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;
  bytes optional_bytes = 36;

  message NestedChild {
    string nested_child_name = 211;
  }

  NestedChild nested_child_1 = 212;
  ChildModel1 child_model_1 = 222;
  repeated ChildModel1 child_models = 223;
  ChildModel1 bar = 224;

  oneof child_oneof1 {
    string oneof_member1 = 98;
    bool oneof_member2 = 99;
  }

  int32 int_value_with_default = 31 [default = 65];  // Not supported yet

  string string_value_with_default = 32
      [default = "hello"];  // Not supported yet

  float float_value_with_default = 33 [default = inf];

  float double_value_with_default = 34 [default = -inf];

  map<int32, ChildModel1> child_map = 225;
  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 {
    OtherExtension in_message_ext = 15000;
  }

  enum Category {
    IMAGES = 5;
    NEWS = 6;
    VIDEO = 7;
    RADIO = 8 [deprecated = true];
  }

  Category category = 37;

  // keyword collisions (double, template, ...)
  oneof type {
    string string = 230;
    int64 int64 = 231;
    double double = 232;
  }

  string template = 233;
  string msg = 234;
  string arena = 235;

  // Tests publicly imported enum.
  TestEnum imported_enum = 238;

  string phase = 239;
  bool clear_phase = 240;
  string doc_id = 241;
  bool set_doc_id = 242;

  extensions 10000 to max
  [verification = UNVERIFIED];
}

// Old version with fewer fields to test backward/forward compatibility.
message TestModelContainerV1 {
  repeated TestModelV1 models = 1;
}

message TestModelV1 {
  int32 value = 1;
  repeated int32 value2 = 2;
  repeated int32 value3 = 3 [features.repeated_field_encoding = PACKED];

  repeated int32 value4 = 4 [deprecated = true];

  bool b1 = 9;
  bool b2 = 10;
  string str2 = 50;
}

enum PrimaryColors {
  RED = 1;
  GREEN = 2;
  BLUE = 3;
}

// TestModel extension.
message ThemeExtension {
  extend TestModel {
    ThemeExtension theme_extension = 12003;
  }

  string ext_name = 1;
  bool ext_bool = 2;
}

extend TestModel {
  ThemeExtension theme = 12001;
}

message ContainerExtension {
  extend TestModelContainer {
    ContainerExtension container_extension = 12004;
  }

  string ext_container_name = 1;
}

extend TestModelContainer {
  ContainerExtension container_ext = 12005;
}

message OtherExtension {
  string ext2_name = 1;
}

extend TestModel {
  OtherExtension other_ext = 12002;
}

message TestAnnotation {
  extensions 10000 to max
  [verification = UNVERIFIED];
}

message TestMessageHasEnum {
  EnumDeclaredAfterMessage enum_declared_after_message = 1;
}

enum EnumDeclaredAfterMessage {
  ZERO = 0;
  ONE = 1;
  TWO = 2;
  THREE = 3;
}