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 = "proto3"; 9 10// These proto descriptors have at one time been reported as an issue or defect. 11// They are kept here to replicate the issue, and continue to verify the fix. 12 13// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer 14// library types are qualified 15package unittest_issues; 16 17import "google/protobuf/struct.proto"; 18 19option csharp_namespace = "UnitTest.Issues.TestProtos"; 20 21// Issue 307: when generating doubly-nested types, any references 22// should be of the form A.Types.B.Types.C. 23message Issue307 { 24 message NestedOnce { 25 message NestedTwice {} 26 } 27} 28 29// Old issue 13: 30// http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 New issue 31// 309: https://github.com/protocolbuffers/protobuf/issues/309 32 33// message A { 34// optional int32 _A = 1; 35// } 36 37// message B { 38// optional int32 B_ = 1; 39// } 40 41// message AB { 42// optional int32 a_b = 1; 43// } 44 45// Similar issue with numeric names 46// Java code failed too, so probably best for this to be a restriction. 47// See https://github.com/protocolbuffers/protobuf/issues/308 48// message NumberField { 49// optional int32 _01 = 1; 50// } 51 52// issue 19 - negative enum values 53 54enum NegativeEnum { 55 NEGATIVE_ENUM_ZERO = 0; 56 FiveBelow = -5; 57 MinusOne = -1; 58} 59 60message NegativeEnumMessage { 61 NegativeEnum value = 1; 62 repeated NegativeEnum values = 2 [packed = false]; 63 repeated NegativeEnum packed_values = 3 [packed = true]; 64} 65 66// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 67// Decorate fields with [deprecated=true] as [System.Obsolete] 68 69message DeprecatedChild { 70 option deprecated = true; 71} 72 73enum DeprecatedEnum { 74 option deprecated = true; 75 76 DEPRECATED_ZERO = 0 [deprecated = true]; 77 one = 1; 78} 79 80message DeprecatedFieldsMessage { 81 int32 PrimitiveValue = 1 [deprecated = true]; 82 repeated int32 PrimitiveArray = 2 [deprecated = true]; 83 84 DeprecatedChild MessageValue = 3 [deprecated = true]; 85 repeated DeprecatedChild MessageArray = 4 [deprecated = true]; 86 87 DeprecatedEnum EnumValue = 5 [deprecated = true]; 88 repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; 89} 90 91// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 92message ItemField { 93 int32 item = 1; 94} 95 96message ReservedNames { 97 // Force a nested type called Types 98 message SomeNestedType {} 99 100 int32 types = 1; 101 int32 descriptor = 2; 102} 103 104message TestJsonFieldOrdering { 105 // These fields are deliberately not declared in numeric 106 // order, and the oneof fields aren't contiguous either. 107 // This allows for reasonably robust tests of JSON output 108 // ordering. 109 // TestFieldOrderings in unittest_proto3.proto is similar, 110 // but doesn't include oneofs. 111 // TODO: Consider adding oneofs to TestFieldOrderings, although 112 // that will require fixing other tests in multiple platforms. 113 // Alternatively, consider just adding this to 114 // unittest_proto3.proto if multiple platforms want it. 115 116 int32 plain_int32 = 4; 117 118 oneof o1 { 119 string o1_string = 2; 120 int32 o1_int32 = 5; 121 } 122 123 string plain_string = 1; 124 125 oneof o2 { 126 int32 o2_int32 = 6; 127 string o2_string = 3; 128 } 129} 130 131message TestJsonName { 132 // Message for testing the effects for of the json_name option 133 string name = 1; 134 string description = 2 [json_name = "desc"]; 135 string guid = 3 [json_name = "exid"]; 136} 137 138// Issue 3200: When merging two messages which use the same 139// oneof case, which is itself a message type, the submessages should 140// be merged. 141message OneofMerging { 142 message Nested { 143 int32 x = 1; 144 int32 y = 2; 145 } 146 147 oneof value { 148 string text = 1; 149 Nested nested = 2; 150 } 151} 152 153message NullValueOutsideStruct { 154 oneof value { 155 string string_value = 1; 156 google.protobuf.NullValue null_value = 2; 157 } 158} 159 160message NullValueNotInOneof { 161 google.protobuf.NullValue null_value = 2; 162} 163 164message MixedRegularAndOptional { 165 string regular_field = 1; 166 optional string optional_field = 2; 167} 168 169message OneofWithNoneField { 170 oneof test { 171 string x = 1; 172 string none = 2; 173 } 174} 175 176message OneofWithNoneName { 177 oneof none { 178 string x = 1; 179 string y = 2; 180 } 181} 182 183// Issue 8810 184message DisambiguateCommonMembers { 185 int32 disambiguate_common_members = 1; 186 int32 types = 2; 187 int32 descriptor = 3; 188 int32 equals = 4; 189 int32 to_string = 5; 190 int32 get_hash_code = 6; 191 int32 write_to = 7; 192 int32 clone = 8; 193 int32 calculate_size = 9; 194 int32 merge_from = 10; 195 int32 on_construction = 11; 196 int32 parser = 12; 197} 198 199message Issue11987Message { 200 int32 a = 1 [json_name = 'b']; 201 int32 b = 2 [json_name = 'a']; 202 int32 c = 3 [json_name = 'd']; 203} 204