unittest_features.proto 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2023 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. edition = "2023";
  8. package pb;
  9. import "google/protobuf/descriptor.proto";
  10. extend google.protobuf.FeatureSet {
  11. TestFeatures test = 9999;
  12. }
  13. message TestMessage {
  14. extend google.protobuf.FeatureSet {
  15. TestFeatures test_message = 9998;
  16. }
  17. message Nested {
  18. extend google.protobuf.FeatureSet {
  19. TestFeatures test_nested = 9997;
  20. }
  21. }
  22. }
  23. enum EnumFeature {
  24. TEST_ENUM_FEATURE_UNKNOWN = 0;
  25. VALUE1 = 1;
  26. VALUE2 = 2;
  27. VALUE3 = 3;
  28. VALUE4 = 4;
  29. VALUE5 = 5;
  30. VALUE6 = 6;
  31. VALUE7 = 7;
  32. VALUE8 = 8;
  33. VALUE9 = 9;
  34. VALUE10 = 10;
  35. VALUE11 = 11;
  36. VALUE12 = 12;
  37. VALUE13 = 13;
  38. VALUE14 = 14;
  39. VALUE15 = 15;
  40. }
  41. enum ValueLifetimeFeature {
  42. TEST_VALUE_LIFETIME_UNKNOWN = 0;
  43. VALUE_LIFETIME_INHERITED = 1;
  44. VALUE_LIFETIME_SUPPORT = 2 [feature_support = {
  45. edition_introduced: EDITION_99997_TEST_ONLY
  46. edition_deprecated: EDITION_99998_TEST_ONLY
  47. deprecation_warning: "Custom feature deprecation warning"
  48. edition_removed: EDITION_99999_TEST_ONLY
  49. }];
  50. VALUE_LIFETIME_EMPTY_SUPPORT = 3 [feature_support = {}];
  51. VALUE_LIFETIME_FUTURE = 4
  52. [feature_support.edition_introduced = EDITION_99997_TEST_ONLY];
  53. VALUE_LIFETIME_DEPRECATED = 5 [feature_support = {
  54. edition_deprecated: EDITION_99997_TEST_ONLY
  55. deprecation_warning: "Custom feature deprecation warning"
  56. }];
  57. VALUE_LIFETIME_REMOVED = 6 [feature_support = {
  58. edition_deprecated: EDITION_2023
  59. edition_removed: EDITION_99997_TEST_ONLY
  60. }];
  61. }
  62. message TestFeatures {
  63. EnumFeature file_feature = 1 [
  64. retention = RETENTION_RUNTIME,
  65. targets = TARGET_TYPE_FILE,
  66. feature_support.edition_introduced = EDITION_2023,
  67. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" },
  68. edition_defaults = { edition: EDITION_PROTO3, value: "VALUE2" },
  69. edition_defaults = { edition: EDITION_2023, value: "VALUE3" },
  70. edition_defaults = { edition: EDITION_99997_TEST_ONLY, value: "VALUE4" },
  71. edition_defaults = { edition: EDITION_99998_TEST_ONLY, value: "VALUE5" }
  72. ];
  73. EnumFeature extension_range_feature = 2 [
  74. retention = RETENTION_RUNTIME,
  75. targets = TARGET_TYPE_EXTENSION_RANGE,
  76. feature_support.edition_introduced = EDITION_2023,
  77. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  78. ];
  79. EnumFeature message_feature = 3 [
  80. retention = RETENTION_RUNTIME,
  81. targets = TARGET_TYPE_MESSAGE,
  82. feature_support.edition_introduced = EDITION_2023,
  83. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  84. ];
  85. EnumFeature field_feature = 4 [
  86. retention = RETENTION_RUNTIME,
  87. targets = TARGET_TYPE_FIELD,
  88. feature_support.edition_introduced = EDITION_2023,
  89. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  90. ];
  91. EnumFeature oneof_feature = 5 [
  92. retention = RETENTION_RUNTIME,
  93. targets = TARGET_TYPE_ONEOF,
  94. feature_support.edition_introduced = EDITION_2023,
  95. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  96. ];
  97. EnumFeature enum_feature = 6 [
  98. retention = RETENTION_RUNTIME,
  99. targets = TARGET_TYPE_ENUM,
  100. feature_support.edition_introduced = EDITION_2023,
  101. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  102. ];
  103. EnumFeature enum_entry_feature = 7 [
  104. retention = RETENTION_RUNTIME,
  105. targets = TARGET_TYPE_ENUM_ENTRY,
  106. feature_support.edition_introduced = EDITION_2023,
  107. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  108. ];
  109. EnumFeature service_feature = 8 [
  110. retention = RETENTION_RUNTIME,
  111. targets = TARGET_TYPE_SERVICE,
  112. feature_support.edition_introduced = EDITION_2023,
  113. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  114. ];
  115. EnumFeature method_feature = 9 [
  116. retention = RETENTION_RUNTIME,
  117. targets = TARGET_TYPE_METHOD,
  118. feature_support.edition_introduced = EDITION_2023,
  119. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  120. ];
  121. EnumFeature multiple_feature = 10 [
  122. retention = RETENTION_RUNTIME,
  123. targets = TARGET_TYPE_FILE,
  124. targets = TARGET_TYPE_FIELD,
  125. targets = TARGET_TYPE_MESSAGE,
  126. targets = TARGET_TYPE_ENUM,
  127. targets = TARGET_TYPE_ENUM_ENTRY,
  128. targets = TARGET_TYPE_SERVICE,
  129. targets = TARGET_TYPE_METHOD,
  130. targets = TARGET_TYPE_ONEOF,
  131. targets = TARGET_TYPE_EXTENSION_RANGE,
  132. feature_support.edition_introduced = EDITION_2023,
  133. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  134. ];
  135. bool bool_field_feature = 11 [
  136. retention = RETENTION_RUNTIME,
  137. targets = TARGET_TYPE_FIELD,
  138. feature_support.edition_introduced = EDITION_2023,
  139. edition_defaults = { edition: EDITION_LEGACY, value: "false" },
  140. edition_defaults = { edition: EDITION_99997_TEST_ONLY, value: "true" }
  141. ];
  142. EnumFeature source_feature = 15 [
  143. retention = RETENTION_SOURCE,
  144. targets = TARGET_TYPE_FILE,
  145. targets = TARGET_TYPE_FIELD,
  146. targets = TARGET_TYPE_MESSAGE,
  147. targets = TARGET_TYPE_ENUM,
  148. targets = TARGET_TYPE_ENUM_ENTRY,
  149. targets = TARGET_TYPE_SERVICE,
  150. targets = TARGET_TYPE_METHOD,
  151. targets = TARGET_TYPE_ONEOF,
  152. targets = TARGET_TYPE_EXTENSION_RANGE,
  153. feature_support.edition_introduced = EDITION_2023,
  154. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  155. ];
  156. EnumFeature source_feature2 = 16 [
  157. retention = RETENTION_SOURCE,
  158. targets = TARGET_TYPE_FILE,
  159. targets = TARGET_TYPE_FIELD,
  160. targets = TARGET_TYPE_MESSAGE,
  161. targets = TARGET_TYPE_ENUM,
  162. targets = TARGET_TYPE_ENUM_ENTRY,
  163. targets = TARGET_TYPE_SERVICE,
  164. targets = TARGET_TYPE_METHOD,
  165. targets = TARGET_TYPE_ONEOF,
  166. targets = TARGET_TYPE_EXTENSION_RANGE,
  167. feature_support.edition_introduced = EDITION_2023,
  168. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" }
  169. ];
  170. EnumFeature removed_feature = 17 [
  171. retention = RETENTION_RUNTIME,
  172. targets = TARGET_TYPE_FILE,
  173. targets = TARGET_TYPE_FIELD,
  174. feature_support = {
  175. edition_introduced: EDITION_2023
  176. edition_deprecated: EDITION_2023
  177. deprecation_warning: "Custom feature deprecation warning"
  178. edition_removed: EDITION_2024
  179. },
  180. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" },
  181. edition_defaults = { edition: EDITION_2023, value: "VALUE2" },
  182. edition_defaults = { edition: EDITION_2024, value: "VALUE3" }
  183. ];
  184. EnumFeature future_feature = 18 [
  185. retention = RETENTION_RUNTIME,
  186. targets = TARGET_TYPE_FILE,
  187. targets = TARGET_TYPE_FIELD,
  188. feature_support = { edition_introduced: EDITION_2024 },
  189. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" },
  190. edition_defaults = { edition: EDITION_2024, value: "VALUE2" }
  191. ];
  192. EnumFeature legacy_feature = 19 [
  193. retention = RETENTION_RUNTIME,
  194. targets = TARGET_TYPE_FILE,
  195. targets = TARGET_TYPE_FIELD,
  196. feature_support = {
  197. edition_introduced: EDITION_PROTO3
  198. edition_removed: EDITION_2023
  199. },
  200. edition_defaults = { edition: EDITION_LEGACY, value: "VALUE1" },
  201. edition_defaults = { edition: EDITION_2023, value: "VALUE2" }
  202. ];
  203. ValueLifetimeFeature value_lifetime_feature = 20 [
  204. retention = RETENTION_RUNTIME,
  205. targets = TARGET_TYPE_FILE,
  206. feature_support = {
  207. edition_introduced: EDITION_2023
  208. edition_deprecated: EDITION_99998_TEST_ONLY
  209. deprecation_warning: "Custom feature deprecation warning"
  210. edition_removed: EDITION_99999_TEST_ONLY
  211. },
  212. edition_defaults = {
  213. edition: EDITION_LEGACY,
  214. value: "VALUE_LIFETIME_INHERITED"
  215. },
  216. // Verify edition defaults can use future values.
  217. edition_defaults = {
  218. edition: EDITION_2023,
  219. value: "VALUE_LIFETIME_FUTURE"
  220. },
  221. // Verify edition defaults can use removed values.
  222. edition_defaults = {
  223. edition: EDITION_99999_TEST_ONLY,
  224. value: "VALUE_LIFETIME_FUTURE"
  225. }
  226. ];
  227. }