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