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