unittest_issues.proto 3.4 KB

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