diff options
Diffstat (limited to 'csharp/protos')
-rw-r--r-- | csharp/protos/extest/unittest_extras_full.proto | 71 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_extras_lite.proto | 115 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_extras_xmltest.proto | 53 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_issues.proto | 141 |
4 files changed, 380 insertions, 0 deletions
diff --git a/csharp/protos/extest/unittest_extras_full.proto b/csharp/protos/extest/unittest_extras_full.proto new file mode 100644 index 00000000..1b546053 --- /dev/null +++ b/csharp/protos/extest/unittest_extras_full.proto @@ -0,0 +1,71 @@ +syntax = "proto2"; + +package protobuf_unittest_extra; + +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; +option optimize_for = CODE_SIZE; +option java_package = "com.google.protobuf"; + +message TestInteropPerson { + required string name = 1; + required int32 id = 2; + optional string email = 3; + repeated int32 codes = 10 [packed=true]; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; + + repeated group Addresses = 5 { + required string address = 1; + optional string address2 = 2; + required string city = 3; + required string state = 4; + required fixed32 zip = 5; + } + + extensions 100 to 199; +} + +message TestInteropEmployeeId { + required string number = 1; +} + +extend TestInteropPerson { + // Note: changed from required to optional, as required fields are not + // permitted in extensions. (The fact that this was allowed in protogen + // before was almost certainly a bug.) + optional TestInteropEmployeeId employee_id = 126; +} + +message TestMissingFieldsA { + required string name = 1; + required int32 id = 2; + optional string email = 3; + + message SubA { + required int32 count = 5; + repeated string values = 6; + } + optional SubA testA = 11; +} + +message TestMissingFieldsB { + required string name = 1; + required int32 id = 2; + optional string website = 4; + + message SubB { + repeated string values = 7; + } + optional SubB testB = 12; +} diff --git a/csharp/protos/extest/unittest_extras_lite.proto b/csharp/protos/extest/unittest_extras_lite.proto new file mode 100644 index 00000000..0c242d2f --- /dev/null +++ b/csharp/protos/extest/unittest_extras_lite.proto @@ -0,0 +1,115 @@ +syntax = "proto2";
+
+package protobuf_unittest_extra;
+
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+option optimize_for = LITE_RUNTIME;
+option java_package = "com.google.protobuf";
+
+message TestRequiredLite {
+ required int32 d = 1;
+ required ExtraEnum en = 2 [default = DEFAULT];
+}
+
+enum ExtraEnum {
+ DEFAULT = 10;
+ EXLITE_FOO = 7;
+ EXLITE_BAR = 8;
+ EXLITE_BAZ = 9;
+}
+
+message TestInteropPersonLite {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+ repeated int32 codes = 10 [packed=true];
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+
+ repeated group Addresses = 5 {
+ required string address = 1;
+ optional string address2 = 2;
+ required string city = 3;
+ required string state = 4;
+ required fixed32 zip = 5;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestInteropEmployeeIdLite {
+ required string number = 1;
+}
+
+extend TestInteropPersonLite {
+ // Note: changed from required to optional, as required fields are not
+ // permitted in extensions. (The fact that this was allowed in protogen
+ // before was almost certainly a bug.)
+ optional TestInteropEmployeeIdLite employee_id_lite = 126;
+}
+
+/* Removed from unittest_lite.proto and added back here */
+
+message TestUnpackedExtensionsLite {
+ extensions 1 to max;
+}
+
+message TestUnpackedTypesLite {
+ repeated int32 unpacked_int32 = 90;
+ repeated int64 unpacked_int64 = 91;
+ repeated uint32 unpacked_uint32 = 92;
+ repeated uint64 unpacked_uint64 = 93;
+ repeated sint32 unpacked_sint32 = 94;
+ repeated sint64 unpacked_sint64 = 95;
+ repeated fixed32 unpacked_fixed32 = 96;
+ repeated fixed64 unpacked_fixed64 = 97;
+ repeated sfixed32 unpacked_sfixed32 = 98;
+ repeated sfixed64 unpacked_sfixed64 = 99;
+ repeated float unpacked_float = 100;
+ repeated double unpacked_double = 101;
+ repeated bool unpacked_bool = 102;
+ repeated UnpackedTypesForeignEnumLite unpacked_enum = 103;
+}
+
+extend TestUnpackedExtensionsLite {
+ repeated int32 unpacked_int32_extension_lite = 90;
+ repeated int64 unpacked_int64_extension_lite = 91;
+ repeated uint32 unpacked_uint32_extension_lite = 92;
+ repeated uint64 unpacked_uint64_extension_lite = 93;
+ repeated sint32 unpacked_sint32_extension_lite = 94;
+ repeated sint64 unpacked_sint64_extension_lite = 95;
+ repeated fixed32 unpacked_fixed32_extension_lite = 96;
+ repeated fixed64 unpacked_fixed64_extension_lite = 97;
+ repeated sfixed32 unpacked_sfixed32_extension_lite = 98;
+ repeated sfixed64 unpacked_sfixed64_extension_lite = 99;
+ repeated float unpacked_float_extension_lite = 100;
+ repeated double unpacked_double_extension_lite = 101;
+ repeated bool unpacked_bool_extension_lite = 102;
+ repeated UnpackedTypesForeignEnumLite unpacked_enum_extension_lite = 103;
+}
+
+enum UnpackedTypesForeignEnumLite {
+ FOREIGN_LITE_FOO = 4;
+ FOREIGN_LITE_BAR = 5;
+ FOREIGN_LITE_BAZ = 6;
+}
+
+message BucketOfBytes {
+ optional bytes value = 1;
+
+}
+message BucketOfBytesEx {
+ optional bytes value = 1;
+ optional bytes value2 = 255;
+}
\ No newline at end of file diff --git a/csharp/protos/extest/unittest_extras_xmltest.proto b/csharp/protos/extest/unittest_extras_xmltest.proto new file mode 100644 index 00000000..fae36165 --- /dev/null +++ b/csharp/protos/extest/unittest_extras_xmltest.proto @@ -0,0 +1,53 @@ +syntax = "proto2";
+
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
+package protobuf_unittest_extra;
+
+option optimize_for = SPEED;
+
+enum EnumOptions {
+ ONE = 0;
+ TWO = 1;
+ THREE = 2;
+}
+
+message TestXmlChild {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+}
+
+message TestXmlNoFields {
+}
+
+message TestXmlRescursive {
+ optional TestXmlRescursive child = 1;
+}
+
+message TestXmlMessage {
+
+ optional int64 number = 6;
+ repeated int32 numbers = 2;
+ optional string text = 3;
+ repeated string textlines = 700;
+ optional bool valid = 5;
+
+ optional TestXmlChild child = 1;
+ repeated group Children = 401 {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+ }
+
+extensions 100 to 199;
+}
+
+message TestXmlExtension {
+ required int32 number = 1;
+}
+
+extend TestXmlMessage {
+ optional EnumOptions extension_enum = 101;
+ optional string extension_text = 102;
+ repeated int32 extension_number = 103 [packed = true];
+ optional TestXmlExtension extension_message = 199;
+}
diff --git a/csharp/protos/extest/unittest_issues.proto b/csharp/protos/extest/unittest_issues.proto new file mode 100644 index 00000000..97249dff --- /dev/null +++ b/csharp/protos/extest/unittest_issues.proto @@ -0,0 +1,141 @@ +syntax = "proto2";
+
+// These proto descriptors have at one time been reported as an issue or defect.
+// They are kept here to replicate the issue, and continue to verify the fix.
+
+// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified
+option csharp_namespace = "UnitTest.Issues.TestProtos";
+
+package unittest_issues;
+option optimize_for = SPEED;
+
+// The following is a representative set of features
+/*
+enum EnumOptions {
+ ONE = 0;
+ TWO = 1;
+ THREE = 2;
+}
+
+message TestBasicChild
+{
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+}
+
+message TestBasicNoFields {
+}
+
+message TestBasicRescursive {
+ optional TestBasicRescursive child = 1;
+}
+
+message TestBasicMessage {
+
+ optional int64 number = 6;
+ repeated int32 numbers = 2;
+ optional string text = 3;
+ repeated string textlines = 700;
+ optional bool valid = 5;
+
+ optional TestBasicChild child = 1;
+ repeated group Children = 401
+ {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestBasicExtension {
+ required int32 number = 1;
+}
+
+extend TestBasicMessage {
+ optional EnumOptions extension_enum = 101;
+ optional string extension_text = 102;
+ repeated int32 extension_number = 103 [packed = true];
+ optional TestBasicExtension extension_message = 199;
+}
+
+// Issue for non-qualified type reference in new services generation
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+service TestGenericService {
+ rpc Foo(TestBasicNoFields) returns (TestBasicMessage);
+ rpc Bar(TestBasicNoFields) returns (TestBasicMessage);
+}
+*/
+
+// Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
+// New issue 309: https://github.com/google/protobuf/issues/309
+
+// message A {
+// optional int32 _A = 1;
+// }
+
+// message B {
+// optional int32 B_ = 1;
+// }
+
+//message AB {
+// optional int32 a_b = 1;
+//}
+
+// Similar issue with numeric names
+// Java code failed too, so probably best for this to be a restriction.
+// See https://github.com/google/protobuf/issues/308
+// message NumberField {
+// optional int32 _01 = 1;
+// }
+
+// Issue 28: Circular message dependencies result in null defaults for DefaultInstance
+
+message MyMessageAReferenceB {
+ required MyMessageBReferenceA value = 1;
+}
+
+message MyMessageBReferenceA {
+ required MyMessageAReferenceB value = 1;
+}
+
+// issue 19 - negative enum values
+
+enum NegativeEnum {
+ FiveBelow = -5;
+ MinusOne = -1;
+ Zero = 0;
+}
+
+message NegativeEnumMessage {
+ optional NegativeEnum value = 1;
+ repeated NegativeEnum values = 2;
+ repeated NegativeEnum packed_values = 3 [packed=true];
+}
+
+// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21
+// Decorate fields with [deprecated=true] as [System.Obsolete]
+
+message DeprecatedChild {
+}
+
+enum DeprecatedEnum {
+ one = 1;
+}
+
+message DeprecatedFieldsMessage {
+ optional int32 PrimitiveValue = 1 [deprecated = true];
+ repeated int32 PrimitiveArray = 2 [deprecated = true];
+
+ optional DeprecatedChild MessageValue = 3 [deprecated = true];
+ repeated DeprecatedChild MessageArray = 4 [deprecated = true];
+
+ optional DeprecatedEnum EnumValue = 5 [deprecated = true];
+ repeated DeprecatedEnum EnumArray = 6 [deprecated = true];
+}
+
+// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
+message ItemField {
+ optional int32 item = 1;
+}
|