unittest_retention.proto 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. //
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file or at
  6. // https://developers.google.com/open-source/licenses/bsd
  7. syntax = "proto2";
  8. package protobuf_unittest;
  9. import "google/protobuf/descriptor.proto";
  10. option csharp_namespace = "ProtobufUnittest";
  11. // Retention attributes set directly on custom options
  12. extend google.protobuf.FileOptions {
  13. optional int32 plain_option = 505092806;
  14. optional int32 runtime_retention_option = 505039132
  15. [retention = RETENTION_RUNTIME];
  16. optional int32 source_retention_option = 504878676
  17. [retention = RETENTION_SOURCE];
  18. }
  19. option (plain_option) = 1;
  20. option (runtime_retention_option) = 2;
  21. option (source_retention_option) = 3;
  22. // Retention attributes set on fields nested within a message
  23. message OptionsMessage {
  24. optional int32 plain_field = 1;
  25. optional int32 runtime_retention_field = 2 [retention = RETENTION_RUNTIME];
  26. optional int32 source_retention_field = 3 [retention = RETENTION_SOURCE];
  27. }
  28. extend google.protobuf.FileOptions {
  29. optional OptionsMessage file_option = 504871168;
  30. }
  31. option (file_option) = {
  32. plain_field: 1
  33. runtime_retention_field: 2
  34. source_retention_field: 3
  35. };
  36. // Retention attribute nested inside a repeated message field
  37. extend google.protobuf.FileOptions {
  38. repeated OptionsMessage repeated_options = 504823570;
  39. }
  40. option (repeated_options) = {
  41. plain_field: 1
  42. runtime_retention_field: 2
  43. source_retention_field: 3
  44. };
  45. extend google.protobuf.ExtensionRangeOptions {
  46. optional OptionsMessage extension_range_option = 504822148;
  47. }
  48. extend google.protobuf.MessageOptions {
  49. optional OptionsMessage message_option = 504820819;
  50. }
  51. extend google.protobuf.FieldOptions {
  52. optional OptionsMessage field_option = 504589219;
  53. }
  54. extend google.protobuf.OneofOptions {
  55. optional OptionsMessage oneof_option = 504479153;
  56. }
  57. extend google.protobuf.EnumOptions {
  58. optional OptionsMessage enum_option = 504451567;
  59. }
  60. extend google.protobuf.EnumValueOptions {
  61. optional OptionsMessage enum_entry_option = 504450522;
  62. }
  63. extend google.protobuf.ServiceOptions {
  64. optional OptionsMessage service_option = 504387709;
  65. }
  66. extend google.protobuf.MethodOptions {
  67. optional OptionsMessage method_option = 504349420;
  68. }
  69. message Extendee {
  70. extensions 1, 2;
  71. }
  72. extend Extendee {
  73. optional int32 i = 1 [(field_option) = {
  74. plain_field: 1
  75. runtime_retention_field: 2
  76. source_retention_field: 3
  77. }];
  78. }
  79. message TopLevelMessage {
  80. option (message_option) = {
  81. plain_field: 1
  82. runtime_retention_field: 2
  83. source_retention_field: 3
  84. };
  85. message NestedMessage {
  86. option (message_option) = {
  87. plain_field: 1
  88. runtime_retention_field: 2
  89. source_retention_field: 3
  90. };
  91. }
  92. enum NestedEnum {
  93. option (enum_option) = {
  94. plain_field: 1
  95. runtime_retention_field: 2
  96. source_retention_field: 3
  97. };
  98. NESTED_UNKNOWN = 0;
  99. }
  100. optional float f = 1 [(field_option) = {
  101. plain_field: 1
  102. runtime_retention_field: 2
  103. source_retention_field: 3
  104. }];
  105. oneof o {
  106. option (oneof_option) = {
  107. plain_field: 1
  108. runtime_retention_field: 2
  109. source_retention_field: 3
  110. };
  111. int64 i = 2;
  112. }
  113. extensions 10 to 100 [(extension_range_option) = {
  114. plain_field: 1
  115. runtime_retention_field: 2
  116. source_retention_field: 3
  117. }];
  118. extend Extendee {
  119. optional string s = 2 [(field_option) = {
  120. plain_field: 1
  121. runtime_retention_field: 2
  122. source_retention_field: 3
  123. }];
  124. }
  125. }
  126. enum TopLevelEnum {
  127. option (enum_option) = {
  128. plain_field: 1
  129. runtime_retention_field: 2
  130. source_retention_field: 3
  131. };
  132. TOP_LEVEL_UNKNOWN = 0 [(enum_entry_option) = {
  133. plain_field: 1
  134. runtime_retention_field: 2
  135. source_retention_field: 3
  136. }];
  137. }
  138. service Service {
  139. option (service_option) = {
  140. plain_field: 1
  141. runtime_retention_field: 2
  142. source_retention_field: 3
  143. };
  144. rpc DoStuff(TopLevelMessage) returns (TopLevelMessage) {
  145. option (method_option) = {
  146. plain_field: 1
  147. runtime_retention_field: 2
  148. source_retention_field: 3
  149. };
  150. }
  151. }