• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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";
13
14option (imported_plain_option) = 1;
15option (imported_runtime_retention_option) = 2;
16option (imported_source_retention_option) = 3;
17
18// Retention attributes set directly on custom options
19extend google.protobuf.FileOptions {
20  optional int32 plain_option = 505092806;
21  optional int32 runtime_retention_option = 505039132
22      [retention = RETENTION_RUNTIME];
23  optional int32 source_retention_option = 504878676
24      [retention = RETENTION_SOURCE];
25}
26
27option (plain_option) = 1;
28option (runtime_retention_option) = 2;
29option (source_retention_option) = 3;
30
31option (file_option) = {
32  plain_field: 1
33  runtime_retention_field: 2
34  source_retention_field: 3
35};
36
37// Retention attribute nested inside a repeated message field
38extend google.protobuf.FileOptions {
39  repeated OptionsMessage repeated_options = 504823570;
40}
41
42option (repeated_options) = {
43  plain_field: 1
44  runtime_retention_field: 2
45  source_retention_field: 3
46};
47
48extend google.protobuf.ExtensionRangeOptions {
49  optional OptionsMessage extension_range_option = 504822148;
50}
51
52extend google.protobuf.MessageOptions {
53  optional OptionsMessage message_option = 504820819;
54}
55
56extend google.protobuf.FieldOptions {
57  optional OptionsMessage field_option = 504589219;
58}
59
60extend google.protobuf.OneofOptions {
61  optional OptionsMessage oneof_option = 504479153;
62}
63
64extend google.protobuf.EnumOptions {
65  optional OptionsMessage enum_option = 504451567;
66}
67
68extend google.protobuf.EnumValueOptions {
69  optional OptionsMessage enum_entry_option = 504450522;
70}
71
72extend google.protobuf.ServiceOptions {
73  optional OptionsMessage service_option = 504387709;
74}
75
76extend google.protobuf.MethodOptions {
77  optional OptionsMessage method_option = 504349420;
78}
79
80message Extendee {
81  extensions 1, 2;
82}
83
84extend Extendee {
85  optional int32 i = 1 [(field_option) = {
86    plain_field: 1
87    runtime_retention_field: 2
88    source_retention_field: 3
89  }];
90}
91
92message TopLevelMessage {
93  option (message_option) = {
94    plain_field: 1
95    runtime_retention_field: 2
96    source_retention_field: 3
97  };
98
99  message NestedMessage {
100    option (message_option) = {
101      plain_field: 1
102      runtime_retention_field: 2
103      source_retention_field: 3
104    };
105  }
106
107  enum NestedEnum {
108    option (enum_option) = {
109      plain_field: 1
110      runtime_retention_field: 2
111      source_retention_field: 3
112    };
113
114    NESTED_UNKNOWN = 0;
115  }
116
117  optional float f = 1 [(field_option) = {
118    plain_field: 1
119    runtime_retention_field: 2
120    source_retention_field: 3
121  }];
122
123  oneof o {
124    option (oneof_option) = {
125      plain_field: 1
126      runtime_retention_field: 2
127      source_retention_field: 3
128    };
129
130    int64 i = 2;
131  }
132
133  extensions 10 to 100 [(extension_range_option) = {
134    plain_field: 1
135    runtime_retention_field: 2
136    source_retention_field: 3
137  }];
138
139  extend Extendee {
140    optional string s = 2 [(field_option) = {
141      plain_field: 1
142      runtime_retention_field: 2
143      source_retention_field: 3
144    }];
145  }
146}
147
148enum TopLevelEnum {
149  option (enum_option) = {
150    plain_field: 1
151    runtime_retention_field: 2
152    source_retention_field: 3
153  };
154
155  TOP_LEVEL_UNKNOWN = 0 [(enum_entry_option) = {
156    plain_field: 1
157    runtime_retention_field: 2
158    source_retention_field: 3
159  }];
160}
161
162service Service {
163  option (service_option) = {
164    plain_field: 1
165    runtime_retention_field: 2
166    source_retention_field: 3
167  };
168
169  rpc DoStuff(TopLevelMessage) returns (TopLevelMessage) {
170    option (method_option) = {
171      plain_field: 1
172      runtime_retention_field: 2
173      source_retention_field: 3
174    };
175  }
176}