From 5c0b251d540ee42106100212ed9621254abb7300 Mon Sep 17 00:00:00 2001 From: Benoit Quenaudon Date: Thu, 5 Oct 2023 10:05:51 +0100 Subject: [PATCH] Update google protobuf files --- .../google/protobuf/descriptor.proto | 86 +++++++++---------- 1 file changed, 41 insertions(+), 45 deletions(-) diff --git a/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto b/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto index bf97c70709..8976ed6897 100644 --- a/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto +++ b/wire-schema/src/jvmMain/resources/google/protobuf/descriptor.proto @@ -62,6 +62,13 @@ enum Edition { // A placeholder for an unknown edition value. EDITION_UNKNOWN = 0; + // Legacy syntax "editions". These pre-date editions, but behave much like + // distinct editions. These can't be used to specify the edition of proto + // files, but feature definitions must supply proto2/proto3 defaults for + // backwards compatibility. + EDITION_PROTO2 = 998; + EDITION_PROTO3 = 999; + // Editions that have been released. The specific values are arbitrary and // should not be depended on, but they will always be time-ordered for easy // comparison. @@ -109,9 +116,8 @@ message FileDescriptorProto { // If `edition` is present, this value must be "editions". optional string syntax = 12; - // The edition of the proto file, which is an opaque string. - // TODO(b/297898292) Deprecate and remove this field in favor of enums. - optional string edition = 13; + // The edition of the proto file. + optional Edition edition = 14; } // Describes a message type. @@ -194,7 +200,7 @@ message ExtensionRangeOptions { } // The verification state of the range. - // TODO(b/278783756): flip the default to DECLARATION once all empty ranges + // TODO: flip the default to DECLARATION once all empty ranges // are marked as UNVERIFIED. optional VerificationState verification = 3 [default = UNVERIFIED]; @@ -594,7 +600,7 @@ message MessageOptions { // This should only be used as a temporary measure against broken builds due // to the change in behavior for JSON field name conflicts. // - // TODO(b/261750190) This is legacy behavior we plan to remove once downstream + // TODO This is legacy behavior we plan to remove once downstream // teams have had time to migrate. optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; @@ -741,9 +747,7 @@ message FieldOptions { repeated OptionTargetType targets = 19; message EditionDefault { - // TODO(b/297898292) Deprecate and remove this field in favor of enums. - optional string edition = 1; - optional Edition edition_enum = 3; + optional Edition edition = 3; optional string value = 2; // Textproto value. } repeated EditionDefault edition_defaults = 20; @@ -790,7 +794,7 @@ message EnumOptions { // and strips underscored from the fields before comparison in proto3 only. // The new behavior takes `json_name` into account and applies to proto2 as // well. - // TODO(b/261750190) Remove this legacy behavior once downstream teams have + // TODO Remove this legacy behavior once downstream teams have // had time to migrate. optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; @@ -914,7 +918,7 @@ message UninterpretedOption { // =================================================================== // Features -// TODO(b/274655146) Enums in C++ gencode (and potentially other languages) are +// TODO Enums in C++ gencode (and potentially other languages) are // not well scoped. This means that each of the feature enums below can clash // with each other. The short names we've chosen maximize call-site // readability, but leave us very open to this scenario. A future feature will @@ -931,11 +935,9 @@ message FeatureSet { retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, - edition_defaults = { - edition: "2023", - edition_enum: EDITION_2023, - value: "EXPLICIT" - } + edition_defaults = { edition: EDITION_PROTO2, value: "EXPLICIT" }, + edition_defaults = { edition: EDITION_PROTO3, value: "IMPLICIT" }, + edition_defaults = { edition: EDITION_2023, value: "EXPLICIT" } ]; enum EnumType { @@ -947,11 +949,8 @@ message FeatureSet { retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, - edition_defaults = { - edition: "2023", - edition_enum: EDITION_2023, - value: "OPEN" - } + edition_defaults = { edition: EDITION_PROTO2, value: "CLOSED" }, + edition_defaults = { edition: EDITION_PROTO3, value: "OPEN" } ]; enum RepeatedFieldEncoding { @@ -963,11 +962,21 @@ message FeatureSet { retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, - edition_defaults = { - edition: "2023", - edition_enum: EDITION_2023, - value: "PACKED" - } + edition_defaults = { edition: EDITION_PROTO2, value: "EXPANDED" }, + edition_defaults = { edition: EDITION_PROTO3, value: "PACKED" } + ]; + + enum Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0; + UNVERIFIED = 1; + VERIFY = 2; + } + optional Utf8Validation utf8_validation = 4 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: EDITION_PROTO2, value: "UNVERIFIED" }, + edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" } ]; enum MessageEncoding { @@ -979,11 +988,7 @@ message FeatureSet { retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, - edition_defaults = { - edition: "2023", - edition_enum: EDITION_2023, - value: "LENGTH_PREFIXED" - } + edition_defaults = { edition: EDITION_PROTO2, value: "LENGTH_PREFIXED" } ]; enum JsonFormat { @@ -996,14 +1001,11 @@ message FeatureSet { targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, - edition_defaults = { - edition: "2023", - edition_enum: EDITION_2023, - value: "ALLOW" - } + edition_defaults = { edition: EDITION_PROTO2, value: "LEGACY_BEST_EFFORT" }, + edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" } ]; - reserved 4, 999; + reserved 999; extensions 1000; // for Protobuf C++ extensions 1001; // for Protobuf Java @@ -1021,24 +1023,18 @@ message FeatureSetDefaults { // the defaults at the closest matching edition ordered at or before it should // be used. This field must be in strict ascending order by edition. message FeatureSetEditionDefault { - // TODO(b/297898292) Deprecate and remove this field in favor of enums. - optional string edition = 1; - optional Edition edition_enum = 3; + optional Edition edition = 3; optional FeatureSet features = 2; } repeated FeatureSetEditionDefault defaults = 1; - // TODO(b/297898292) Deprecate and remove these fields in favor of enums. - optional string minimum_edition = 2; - optional string maximum_edition = 3; - // The minimum supported edition (inclusive) when this was constructed. // Editions before this will not have defaults. - optional Edition minimum_edition_enum = 4; + optional Edition minimum_edition = 4; // The maximum known edition (inclusive) when this was constructed. Editions // after this will not have reliable defaults. - optional Edition maximum_edition_enum = 5; + optional Edition maximum_edition = 5; } // ===================================================================