unittest_issues.proto 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // These proto descriptors have at one time been reported as an issue or defect.
  2. // They are kept here to replicate the issue, and continue to verify the fix.
  3. import "google/protobuf/csharp_options.proto";
  4. // Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified
  5. option (google.protobuf.csharp_file_options).namespace = "UnitTest.Issues.TestProtos";
  6. option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasIssuesProtoFile";
  7. package unittest_issues;
  8. option optimize_for = SPEED;
  9. // The following is a representative set of features
  10. /*
  11. enum EnumOptions {
  12. ONE = 0;
  13. TWO = 1;
  14. THREE = 2;
  15. }
  16. message TestBasicChild
  17. {
  18. repeated EnumOptions options = 3;
  19. optional bytes binary = 4;
  20. }
  21. message TestBasicNoFields {
  22. }
  23. message TestBasicRescursive {
  24. optional TestBasicRescursive child = 1;
  25. }
  26. message TestBasicMessage {
  27. optional int64 number = 6;
  28. repeated int32 numbers = 2;
  29. optional string text = 3;
  30. repeated string textlines = 700;
  31. optional bool valid = 5;
  32. optional TestBasicChild child = 1;
  33. repeated group Children = 401
  34. {
  35. repeated EnumOptions options = 3;
  36. optional bytes binary = 4;
  37. }
  38. extensions 100 to 199;
  39. }
  40. message TestBasicExtension {
  41. required int32 number = 1;
  42. }
  43. extend TestBasicMessage {
  44. optional EnumOptions extension_enum = 101;
  45. optional string extension_text = 102;
  46. repeated int32 extension_number = 103 [packed = true];
  47. optional TestBasicExtension extension_message = 199;
  48. }
  49. // Issue for non-qualified type reference in new services generation
  50. option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
  51. service TestGenericService {
  52. rpc Foo(TestBasicNoFields) returns (TestBasicMessage);
  53. rpc Bar(TestBasicNoFields) returns (TestBasicMessage);
  54. }
  55. */
  56. // Issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
  57. message A {
  58. optional int32 _A = 1;
  59. }
  60. message B {
  61. optional int32 B_ = 1;
  62. }
  63. message AB {
  64. optional int32 a_b = 1;
  65. }
  66. // Similar issue with numeric names
  67. message NumberField {
  68. optional int32 _01 = 1;
  69. }
  70. // Issue 28: Circular message dependencies result in null defaults for DefaultInstance
  71. message MyMessageAReferenceB {
  72. required MyMessageBReferenceA value = 1;
  73. }
  74. message MyMessageBReferenceA {
  75. required MyMessageAReferenceB value = 1;
  76. }
  77. // issue 19 - negative enum values
  78. enum NegativeEnum {
  79. FiveBelow = -5;
  80. MinusOne = -1;
  81. Zero = 0;
  82. }
  83. message NegativeEnumMessage {
  84. optional NegativeEnum value = 1;
  85. repeated NegativeEnum values = 2;
  86. repeated NegativeEnum packed_values = 3 [packed=true];
  87. }
  88. // Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21
  89. // Decorate fields with [deprecated=true] as [System.Obsolete]
  90. message DeprecatedChild {
  91. }
  92. enum DeprecatedEnum {
  93. one = 1;
  94. }
  95. message DeprecatedFieldsMessage {
  96. optional int32 PrimitiveValue = 1 [deprecated = true];
  97. repeated int32 PrimitiveArray = 2 [deprecated = true];
  98. optional DeprecatedChild MessageValue = 3 [deprecated = true];
  99. repeated DeprecatedChild MessageArray = 4 [deprecated = true];
  100. optional DeprecatedEnum EnumValue = 5 [deprecated = true];
  101. repeated DeprecatedEnum EnumArray = 6 [deprecated = true];
  102. }
  103. // Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
  104. message ItemField {
  105. optional int32 item = 1;
  106. }