diff options
Diffstat (limited to 'csharp/protos')
-rw-r--r-- | csharp/protos/extest/unittest_extras.proto | 37 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_extras_full.proto | 13 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_extras_lite.proto | 14 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_extras_xmltest.proto | 7 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_generic_services.proto | 35 | ||||
-rw-r--r-- | csharp/protos/extest/unittest_issues.proto | 36 |
6 files changed, 53 insertions, 89 deletions
diff --git a/csharp/protos/extest/unittest_extras.proto b/csharp/protos/extest/unittest_extras.proto deleted file mode 100644 index 91f10fbd..00000000 --- a/csharp/protos/extest/unittest_extras.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Additional options required for C# generation. File from copyright
-// line onwards is as per original distribution.
-import "google/protobuf/csharp_options.proto";
-option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
-option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasProtoFile";
-option (google.protobuf.csharp_file_options).add_serializable = true;
-
-package protobuf_unittest_extra;
-
-option java_package = "com.google.protobuf";
-
-message TestUnpackedExtensions {
- extensions 1 to max;
-}
-
-extend TestUnpackedExtensions {
- repeated int32 unpacked_int32_extension = 90;
- repeated int64 unpacked_int64_extension = 91;
- repeated uint32 unpacked_uint32_extension = 92;
- repeated uint64 unpacked_uint64_extension = 93;
- repeated sint32 unpacked_sint32_extension = 94;
- repeated sint64 unpacked_sint64_extension = 95;
- repeated fixed32 unpacked_fixed32_extension = 96;
- repeated fixed64 unpacked_fixed64_extension = 97;
- repeated sfixed32 unpacked_sfixed32_extension = 98;
- repeated sfixed64 unpacked_sfixed64_extension = 99;
- repeated float unpacked_float_extension = 100;
- repeated double unpacked_double_extension = 101;
- repeated bool unpacked_bool_extension = 102;
- repeated UnpackedExtensionsForeignEnum unpacked_enum_extension = 103;
-}
-
-enum UnpackedExtensionsForeignEnum {
- FOREIGN_FOO = 4;
- FOREIGN_BAR = 5;
- FOREIGN_BAZ = 6;
-}
diff --git a/csharp/protos/extest/unittest_extras_full.proto b/csharp/protos/extest/unittest_extras_full.proto index a334bbf1..1b546053 100644 --- a/csharp/protos/extest/unittest_extras_full.proto +++ b/csharp/protos/extest/unittest_extras_full.proto @@ -1,13 +1,9 @@ -// Additional options required for C# generation. File from copyright -// line onwards is as per original distribution. -import "google/protobuf/csharp_options.proto"; -option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; -option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasFullProtoFile"; +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 { @@ -45,7 +41,10 @@ message TestInteropEmployeeId { } extend TestInteropPerson { - required TestInteropEmployeeId employee_id = 126; + // 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 { diff --git a/csharp/protos/extest/unittest_extras_lite.proto b/csharp/protos/extest/unittest_extras_lite.proto index ea1bcd25..0c242d2f 100644 --- a/csharp/protos/extest/unittest_extras_lite.proto +++ b/csharp/protos/extest/unittest_extras_lite.proto @@ -1,14 +1,9 @@ -// Additional options required for C# generation. File from copyright
-// line onwards is as per original distribution.
-import "google/protobuf/csharp_options.proto";
-option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
-option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile";
-option (google.protobuf.csharp_file_options).add_serializable = true;
+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 {
@@ -58,7 +53,10 @@ message TestInteropEmployeeIdLite { }
extend TestInteropPersonLite {
- required TestInteropEmployeeIdLite employee_id_lite = 126;
+ // 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 */
diff --git a/csharp/protos/extest/unittest_extras_xmltest.proto b/csharp/protos/extest/unittest_extras_xmltest.proto index ab8088a7..fae36165 100644 --- a/csharp/protos/extest/unittest_extras_xmltest.proto +++ b/csharp/protos/extest/unittest_extras_xmltest.proto @@ -1,7 +1,6 @@ -import "google/protobuf/csharp_options.proto";
-option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
-option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestXmlSerializerTestProtoFile";
-option (google.protobuf.csharp_file_options).add_serializable = true;
+syntax = "proto2";
+
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
package protobuf_unittest_extra;
diff --git a/csharp/protos/extest/unittest_generic_services.proto b/csharp/protos/extest/unittest_generic_services.proto index 3fe2e8eb..4e68ff0f 100644 --- a/csharp/protos/extest/unittest_generic_services.proto +++ b/csharp/protos/extest/unittest_generic_services.proto @@ -1,29 +1,30 @@ +syntax = "proto2";
+
// Additional options required for C# generation. File from copyright
// line onwards is as per original distribution.
-import "google/protobuf/csharp_options.proto";
import "google/protobuf/unittest.proto";
import "google/protobuf/unittest_custom_options.proto";
-option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
-option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGenericServices";
-option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
+
+// option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+package protobuf_unittest;
-// We don't put this in a package within proto2 because we need to make sure -// that the generated code doesn't depend on being in the proto2 namespace. -package protobuf_unittest; - option optimize_for = SPEED;
service TestGenericService {
rpc Foo(FooRequest) returns (FooResponse);
rpc Bar(BarRequest) returns (BarResponse);
}
- -service TestGenericServiceWithCustomOptions { - option (service_opt1) = -9876543210; - - rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { - option (method_opt1) = METHODOPT1_VAL2; - } -} - +
+service TestGenericServiceWithCustomOptions {
+ option (service_opt1) = -9876543210;
+
+ rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) {
+ option (method_opt1) = METHODOPT1_VAL2;
+ }
+}
+
diff --git a/csharp/protos/extest/unittest_issues.proto b/csharp/protos/extest/unittest_issues.proto index cb803791..97249dff 100644 --- a/csharp/protos/extest/unittest_issues.proto +++ b/csharp/protos/extest/unittest_issues.proto @@ -1,10 +1,10 @@ +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.
-import "google/protobuf/csharp_options.proto";
// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified
-option (google.protobuf.csharp_file_options).namespace = "UnitTest.Issues.TestProtos";
-option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasIssuesProtoFile";
+option csharp_namespace = "UnitTest.Issues.TestProtos";
package unittest_issues;
option optimize_for = SPEED;
@@ -67,24 +67,28 @@ service TestGenericService { rpc Bar(TestBasicNoFields) returns (TestBasicMessage);
}
*/
-// Issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
+
+// 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 A {
+// optional int32 _A = 1;
+// }
-message B {
- optional int32 B_ = 1;
-}
+// message B {
+// optional int32 B_ = 1;
+// }
-message AB {
- optional int32 a_b = 1;
-}
+//message AB {
+// optional int32 a_b = 1;
+//}
// Similar issue with numeric names
-message NumberField {
- optional int32 _01 = 1;
-}
+// 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
|