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