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