Brian Silverman | 9c614bc | 2016-02-15 20:20:02 -0500 | [diff] [blame^] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | // These proto descriptors have at one time been reported as an issue or defect. |
| 4 | // They are kept here to replicate the issue, and continue to verify the fix. |
| 5 | |
| 6 | // Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified |
| 7 | option csharp_namespace = "UnitTest.Issues.TestProtos"; |
| 8 | |
| 9 | package unittest_issues; |
| 10 | option optimize_for = SPEED; |
| 11 | |
| 12 | // Issue 307: when generating doubly-nested types, any references |
| 13 | // should be of the form A.Types.B.Types.C. |
| 14 | message Issue307 { |
| 15 | message NestedOnce { |
| 16 | message NestedTwice { |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | // Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 |
| 22 | // New issue 309: https://github.com/google/protobuf/issues/309 |
| 23 | |
| 24 | // message A { |
| 25 | // optional int32 _A = 1; |
| 26 | // } |
| 27 | |
| 28 | // message B { |
| 29 | // optional int32 B_ = 1; |
| 30 | // } |
| 31 | |
| 32 | //message AB { |
| 33 | // optional int32 a_b = 1; |
| 34 | //} |
| 35 | |
| 36 | // Similar issue with numeric names |
| 37 | // Java code failed too, so probably best for this to be a restriction. |
| 38 | // See https://github.com/google/protobuf/issues/308 |
| 39 | // message NumberField { |
| 40 | // optional int32 _01 = 1; |
| 41 | // } |
| 42 | |
| 43 | // issue 19 - negative enum values |
| 44 | |
| 45 | enum NegativeEnum { |
| 46 | NEGATIVE_ENUM_ZERO = 0; |
| 47 | FiveBelow = -5; |
| 48 | MinusOne = -1; |
| 49 | } |
| 50 | |
| 51 | message NegativeEnumMessage { |
| 52 | NegativeEnum value = 1; |
| 53 | repeated NegativeEnum values = 2 [packed = false]; |
| 54 | repeated NegativeEnum packed_values = 3 [packed=true]; |
| 55 | } |
| 56 | |
| 57 | // Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 |
| 58 | // Decorate fields with [deprecated=true] as [System.Obsolete] |
| 59 | |
| 60 | message DeprecatedChild { |
| 61 | } |
| 62 | |
| 63 | enum DeprecatedEnum { |
| 64 | DEPRECATED_ZERO = 0; |
| 65 | one = 1; |
| 66 | } |
| 67 | |
| 68 | message DeprecatedFieldsMessage { |
| 69 | int32 PrimitiveValue = 1 [deprecated = true]; |
| 70 | repeated int32 PrimitiveArray = 2 [deprecated = true]; |
| 71 | |
| 72 | DeprecatedChild MessageValue = 3 [deprecated = true]; |
| 73 | repeated DeprecatedChild MessageArray = 4 [deprecated = true]; |
| 74 | |
| 75 | DeprecatedEnum EnumValue = 5 [deprecated = true]; |
| 76 | repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; |
| 77 | } |
| 78 | |
| 79 | // Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 |
| 80 | message ItemField { |
| 81 | int32 item = 1; |
| 82 | } |
| 83 | |
| 84 | message ReservedNames { |
| 85 | // Force a nested type called Types |
| 86 | message SomeNestedType { |
| 87 | } |
| 88 | |
| 89 | int32 types = 1; |
| 90 | int32 descriptor = 2; |
| 91 | } |
| 92 | |
| 93 | message TestJsonFieldOrdering { |
| 94 | // These fields are deliberately not declared in numeric |
| 95 | // order, and the oneof fields aren't contiguous either. |
| 96 | // This allows for reasonably robust tests of JSON output |
| 97 | // ordering. |
| 98 | // TestFieldOrderings in unittest_proto3.proto is similar, |
| 99 | // but doesn't include oneofs. |
| 100 | // TODO: Consider adding oneofs to TestFieldOrderings, although |
| 101 | // that will require fixing other tests in multiple platforms. |
| 102 | // Alternatively, consider just adding this to |
| 103 | // unittest_proto3.proto if multiple platforms want it. |
| 104 | |
| 105 | int32 plain_int32 = 4; |
| 106 | |
| 107 | oneof o1 { |
| 108 | string o1_string = 2; |
| 109 | int32 o1_int32 = 5; |
| 110 | } |
| 111 | |
| 112 | string plain_string = 1; |
| 113 | |
| 114 | oneof o2 { |
| 115 | int32 o2_int32 = 6; |
| 116 | string o2_string = 3; |
| 117 | } |
| 118 | |
| 119 | } |