...
1// Copyright 2020 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5syntax = "proto2";
6
7package testretention;
8
9import "cmd/protoc-gen-go/testdata/retention/options_message.proto";
10import "google/protobuf/descriptor.proto";
11
12option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/retention";
13option (imported_plain_option) = 1;
14option (imported_runtime_retention_option) = 2;
15option (imported_source_retention_option) = 3;
16
17// Retention attributes set directly on custom options
18extend google.protobuf.FileOptions {
19 optional int32 plain_option = 505092806;
20 optional int32 runtime_retention_option = 505039132
21 [retention = RETENTION_RUNTIME];
22 optional int32 source_retention_option = 504878676
23 [retention = RETENTION_SOURCE];
24}
25
26option (plain_option) = 1;
27option (runtime_retention_option) = 2;
28option (source_retention_option) = 3;
29
30option (file_option) = {
31 plain_field: 1
32 runtime_retention_field: 2
33 source_retention_field: 3
34};
35
36// Retention attribute nested inside a repeated message field
37extend google.protobuf.FileOptions {
38 repeated OptionsMessage repeated_options = 504823570;
39}
40
41option (repeated_options) = {
42 plain_field: 1
43 runtime_retention_field: 2
44 source_retention_field: 3
45};
46
47extend google.protobuf.ExtensionRangeOptions {
48 optional OptionsMessage extension_range_option = 504822148;
49}
50
51extend google.protobuf.MessageOptions {
52 optional OptionsMessage message_option = 504820819;
53}
54
55extend google.protobuf.FieldOptions {
56 optional OptionsMessage field_option = 504589219;
57}
58
59extend google.protobuf.OneofOptions {
60 optional OptionsMessage oneof_option = 504479153;
61}
62
63extend google.protobuf.EnumOptions {
64 optional OptionsMessage enum_option = 504451567;
65}
66
67extend google.protobuf.EnumValueOptions {
68 optional OptionsMessage enum_entry_option = 504450522;
69}
70
71extend google.protobuf.ServiceOptions {
72 optional OptionsMessage service_option = 504387709;
73}
74
75extend google.protobuf.MethodOptions {
76 optional OptionsMessage method_option = 504349420;
77}
78
79message Extendee {
80 extensions 1, 2;
81}
82
83extend Extendee {
84 optional int32 i = 1 [(field_option) = {
85 plain_field: 1
86 runtime_retention_field: 2
87 source_retention_field: 3
88 }];
89}
90
91message TopLevelMessage {
92 option (message_option) = {
93 plain_field: 1
94 runtime_retention_field: 2
95 source_retention_field: 3
96 };
97
98 message NestedMessage {
99 option (message_option) = {
100 plain_field: 1
101 runtime_retention_field: 2
102 source_retention_field: 3
103 };
104 }
105
106 enum NestedEnum {
107 option (enum_option) = {
108 plain_field: 1
109 runtime_retention_field: 2
110 source_retention_field: 3
111 };
112
113 NESTED_UNKNOWN = 0;
114 }
115
116 optional float f = 1 [(field_option) = {
117 plain_field: 1
118 runtime_retention_field: 2
119 source_retention_field: 3
120 }];
121
122 oneof o {
123 option (oneof_option) = {
124 plain_field: 1
125 runtime_retention_field: 2
126 source_retention_field: 3
127 };
128
129 int64 i = 2;
130 }
131
132 extensions 10 to 100 [(extension_range_option) = {
133 plain_field: 1
134 runtime_retention_field: 2
135 source_retention_field: 3
136 }];
137
138 extend Extendee {
139 optional string s = 2 [(field_option) = {
140 plain_field: 1
141 runtime_retention_field: 2
142 source_retention_field: 3
143 }];
144 }
145}
146
147enum TopLevelEnum {
148 option (enum_option) = {
149 plain_field: 1
150 runtime_retention_field: 2
151 source_retention_field: 3
152 };
153
154 TOP_LEVEL_UNKNOWN = 0 [(enum_entry_option) = {
155 plain_field: 1
156 runtime_retention_field: 2
157 source_retention_field: 3
158 }];
159}
160
161service Service {
162 option (service_option) = {
163 plain_field: 1
164 runtime_retention_field: 2
165 source_retention_field: 3
166 };
167
168 rpc DoStuff(TopLevelMessage) returns (TopLevelMessage) {
169 option (method_option) = {
170 plain_field: 1
171 runtime_retention_field: 2
172 source_retention_field: 3
173 };
174 }
175}
View as plain text