@@ -113,6 +113,10 @@ message FileDescriptorProto {
113113 // For Google-internal migration only. Do not use.
114114 repeated int32 weak_dependency = 11 ;
115115
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+
116120 // All top-level definitions in this file.
117121 repeated DescriptorProto message_type = 4 ;
118122 repeated EnumDescriptorProto enum_type = 5 ;
@@ -176,6 +180,9 @@ message DescriptorProto {
176180 // Reserved field names, which may not be used by fields in the same message.
177181 // A given name may only be reserved once.
178182 repeated string reserved_name = 10 ;
183+
184+ // Support for `export` and `local` keywords on enums.
185+ optional SymbolVisibility visibility = 11 ;
179186}
180187
181188message ExtensionRangeOptions {
@@ -372,6 +379,9 @@ message EnumDescriptorProto {
372379 // Reserved enum value names, which may not be reused. A given name may only
373380 // be reserved once.
374381 repeated string reserved_name = 5 ;
382+
383+ // Support for `export` and `local` keywords on enums.
384+ optional SymbolVisibility visibility = 6 ;
375385}
376386
377387// Describes a value within an enum.
@@ -1121,6 +1131,37 @@ message FeatureSet {
11211131 edition_defaults = { edition : EDITION_2024, value : "STYLE2024" }
11221132 ];
11231133
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+
11241165 reserved 999;
11251166
11261167 extensions 1000 to 9994 [
@@ -1135,6 +1176,11 @@ message FeatureSet {
11351176 type: ".pb.JavaFeatures"
11361177 },
11371178 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+ },
11381184 declaration = {
11391185 number: 9990,
11401186 full_name: ".pb.proto1",
@@ -1358,3 +1404,14 @@ message GeneratedCodeInfo {
13581404 optional Semantic semantic = 5 ;
13591405 }
13601406}
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