@@ -113,6 +113,10 @@ message FileDescriptorProto {
113
113
// For Google-internal migration only. Do not use.
114
114
repeated int32 weak_dependency = 11 ;
115
115
116
+ // Names of files imported by this file purely for the purpose of providing
117
+ // option extensions. These are excluded from the dependency list above.
118
+ repeated string option_dependency = 15 ;
119
+
116
120
// All top-level definitions in this file.
117
121
repeated DescriptorProto message_type = 4 ;
118
122
repeated EnumDescriptorProto enum_type = 5 ;
@@ -176,6 +180,9 @@ message DescriptorProto {
176
180
// Reserved field names, which may not be used by fields in the same message.
177
181
// A given name may only be reserved once.
178
182
repeated string reserved_name = 10 ;
183
+
184
+ // Support for `export` and `local` keywords on enums.
185
+ optional SymbolVisibility visibility = 11 ;
179
186
}
180
187
181
188
message ExtensionRangeOptions {
@@ -372,6 +379,9 @@ message EnumDescriptorProto {
372
379
// Reserved enum value names, which may not be reused. A given name may only
373
380
// be reserved once.
374
381
repeated string reserved_name = 5 ;
382
+
383
+ // Support for `export` and `local` keywords on enums.
384
+ optional SymbolVisibility visibility = 6 ;
375
385
}
376
386
377
387
// Describes a value within an enum.
@@ -1121,6 +1131,37 @@ message FeatureSet {
1121
1131
edition_defaults = { edition : EDITION_2024, value : "STYLE2024" }
1122
1132
];
1123
1133
1134
+ message VisibilityFeature {
1135
+ enum DefaultSymbolVisibility {
1136
+ DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0 ;
1137
+
1138
+ // Default pre-EDITION_2024, all UNSET visibility are export.
1139
+ EXPORT_ALL = 1 ;
1140
+
1141
+ // All top-level symbols default to export, nested default to local.
1142
+ EXPORT_TOP_LEVEL = 2 ;
1143
+
1144
+ // All symbols default to local.
1145
+ LOCAL_ALL = 3 ;
1146
+
1147
+ // All symbols local by default. Nested types cannot be exported.
1148
+ // With special case caveat for message { enum {} reserved 1 to max; }
1149
+ // This is the recommended setting for new protos.
1150
+ STRICT = 4 ;
1151
+ }
1152
+ reserved 1 to max;
1153
+ }
1154
+ optional VisibilityFeature.DefaultSymbolVisibility default_symbol_visibility =
1155
+ 8 [
1156
+ retention = RETENTION_SOURCE,
1157
+ targets = TARGET_TYPE_FILE,
1158
+ feature_support = {
1159
+ edition_introduced: EDITION_2024,
1160
+ },
1161
+ edition_defaults = { edition: EDITION_LEGACY, value: "EXPORT_ALL" },
1162
+ edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" }
1163
+ ];
1164
+
1124
1165
reserved 999;
1125
1166
1126
1167
extensions 1000 to 9994 [
@@ -1135,6 +1176,11 @@ message FeatureSet {
1135
1176
type: ".pb.JavaFeatures"
1136
1177
},
1137
1178
declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" },
1179
+ declaration = {
1180
+ number: 1003,
1181
+ full_name: ".pb.python",
1182
+ type: ".pb.PythonFeatures"
1183
+ },
1138
1184
declaration = {
1139
1185
number: 9990,
1140
1186
full_name: ".pb.proto1",
@@ -1358,3 +1404,14 @@ message GeneratedCodeInfo {
1358
1404
optional Semantic semantic = 5 ;
1359
1405
}
1360
1406
}
1407
+
1408
+ // Describes the 'visibility' of a symbol with respect to the proto import
1409
+ // system. Symbols can only be imported when the visibility rules do not prevent
1410
+ // it (ex: local symbols cannot be imported). Visibility modifiers can only set
1411
+ // on `message` and `enum` as they are the only types available to be referenced
1412
+ // from other files.
1413
+ enum SymbolVisibility {
1414
+ VISIBILITY_UNSET = 0 ;
1415
+ VISIBILITY_LOCAL = 1 ;
1416
+ VISIBILITY_EXPORT = 2 ;
1417
+ }
0 commit comments