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