unittest_issues.proto 3.6 KB

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