Rename NONE enum value to UNVERIFIED

PiperOrigin-RevId: 568927357
pull/14146/head
Mike Kruskal 1 year ago committed by Copybara-Service
parent c32a2f9965
commit 1c07062f5a
  1. 2
      src/google/protobuf/descriptor.cc
  2. 78
      src/google/protobuf/descriptor.pb.cc
  3. 4
      src/google/protobuf/descriptor.pb.h
  4. 2
      src/google/protobuf/descriptor.proto
  5. 22
      src/google/protobuf/descriptor_unittest.cc
  6. 2
      src/google/protobuf/editions/golden/editions_transform_proto2.proto
  7. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto
  8. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto
  9. 4
      src/google/protobuf/editions/golden/editions_transform_proto3.proto
  10. 2
      src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto
  11. 2
      src/google/protobuf/editions/golden/test_messages_proto2.proto
  12. 4
      src/google/protobuf/editions/transform.awk
  13. 2
      upb/reflection/stage0/google/protobuf/descriptor.upb.h

@ -1110,7 +1110,7 @@ FeatureSet* CreateProto2DefaultFeatures() {
features->set_repeated_field_encoding(FeatureSet::EXPANDED);
features->set_message_encoding(FeatureSet::LENGTH_PREFIXED);
features->set_json_format(FeatureSet::LEGACY_BEST_EFFORT);
features->set_utf8_validation(FeatureSet::NONE);
features->set_utf8_validation(FeatureSet::UNVERIFIED);
features->MutableExtension(pb::cpp)->set_legacy_closed_enum(true);
return features;

@ -1838,7 +1838,7 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR
"e\030\005 \001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_"
"value\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010"
"NamePart\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extens"
"ion\030\002 \002(\010\"\271\010\n\nFeatureSet\022\\\n\016field_presen"
"ion\030\002 \002(\010\"\277\010\n\nFeatureSet\022\\\n\016field_presen"
"ce\030\001 \001(\0162).google.protobuf.FeatureSet.Fi"
"eldPresenceB\031\210\001\001\230\001\004\230\001\001\242\001\r\022\010EXPLICIT\030\350\007\022N"
"\n\tenum_type\030\002 \001(\0162$.google.protobuf.Feat"
@ -1858,49 +1858,49 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR
"QUIRED\020\003\"7\n\010EnumType\022\025\n\021ENUM_TYPE_UNKNOW"
"N\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED\020\002\"V\n\025RepeatedFie"
"ldEncoding\022#\n\037REPEATED_FIELD_ENCODING_UN"
"KNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010EXPANDED\020\002\"C\n\016Utf"
"KNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010EXPANDED\020\002\"I\n\016Utf"
"8Validation\022\033\n\027UTF8_VALIDATION_UNKNOWN\020\000"
"\022\010\n\004NONE\020\001\022\n\n\006VERIFY\020\002\"S\n\017MessageEncodin"
"g\022\034\n\030MESSAGE_ENCODING_UNKNOWN\020\000\022\023\n\017LENGT"
"H_PREFIXED\020\001\022\r\n\tDELIMITED\020\002\"H\n\nJsonForma"
"t\022\027\n\023JSON_FORMAT_UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n"
"\022LEGACY_BEST_EFFORT\020\002*\006\010\350\007\020\351\007*\006\010\351\007\020\352\007*\006\010"
"\213N\020\220NJ\006\010\347\007\020\350\007\"\300\002\n\022FeatureSetDefaults\022N\n\010"
"defaults\030\001 \003(\0132<.google.protobuf.Feature"
"SetDefaults.FeatureSetEditionDefault\0221\n\017"
"minimum_edition\030\004 \001(\0162\030.google.protobuf."
"Edition\0221\n\017maximum_edition\030\005 \001(\0162\030.googl"
"e.protobuf.Edition\032t\n\030FeatureSetEditionD"
"efault\022)\n\007edition\030\003 \001(\0162\030.google.protobu"
"f.Edition\022-\n\010features\030\002 \001(\0132\033.google.pro"
"tobuf.FeatureSet\"\325\001\n\016SourceCodeInfo\022:\n\010l"
"ocation\030\001 \003(\0132(.google.protobuf.SourceCo"
"deInfo.Location\032\206\001\n\010Location\022\020\n\004path\030\001 \003"
"(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comm"
"ents\030\003 \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n"
"\031leading_detached_comments\030\006 \003(\t\"\234\002\n\021Gen"
"eratedCodeInfo\022A\n\nannotation\030\001 \003(\0132-.goo"
"gle.protobuf.GeneratedCodeInfo.Annotatio"
"n\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013so"
"urce_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 "
"\001(\005\022H\n\010semantic\030\005 \001(\01626.google.protobuf."
"GeneratedCodeInfo.Annotation.Semantic\"(\n"
"\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002*"
"\300\001\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022\021\n\014EDIT"
"ION_2023\020\350\007\022\027\n\023EDITION_1_TEST_ONLY\020\001\022\027\n\023"
"EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITION_99997_T"
"EST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_TEST_ONLY\020"
"\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020\237\215\006B~\n\023co"
"m.google.protobufB\020DescriptorProtosH\001Z-g"
"oogle.golang.org/protobuf/types/descript"
"orpb\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Reflecti"
"on"
"\022\016\n\nUNVERIFIED\020\001\022\n\n\006VERIFY\020\002\"S\n\017MessageE"
"ncoding\022\034\n\030MESSAGE_ENCODING_UNKNOWN\020\000\022\023\n"
"\017LENGTH_PREFIXED\020\001\022\r\n\tDELIMITED\020\002\"H\n\nJso"
"nFormat\022\027\n\023JSON_FORMAT_UNKNOWN\020\000\022\t\n\005ALLO"
"W\020\001\022\026\n\022LEGACY_BEST_EFFORT\020\002*\006\010\350\007\020\351\007*\006\010\351\007"
"\020\352\007*\006\010\213N\020\220NJ\006\010\347\007\020\350\007\"\300\002\n\022FeatureSetDefaul"
"ts\022N\n\010defaults\030\001 \003(\0132<.google.protobuf.F"
"eatureSetDefaults.FeatureSetEditionDefau"
"lt\0221\n\017minimum_edition\030\004 \001(\0162\030.google.pro"
"tobuf.Edition\0221\n\017maximum_edition\030\005 \001(\0162\030"
".google.protobuf.Edition\032t\n\030FeatureSetEd"
"itionDefault\022)\n\007edition\030\003 \001(\0162\030.google.p"
"rotobuf.Edition\022-\n\010features\030\002 \001(\0132\033.goog"
"le.protobuf.FeatureSet\"\325\001\n\016SourceCodeInf"
"o\022:\n\010location\030\001 \003(\0132(.google.protobuf.So"
"urceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004pa"
"th\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leadin"
"g_comments\030\003 \001(\t\022\031\n\021trailing_comments\030\004 "
"\001(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"\234"
"\002\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\013"
"2-.google.protobuf.GeneratedCodeInfo.Ann"
"otation\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001"
"\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003"
"end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.pro"
"tobuf.GeneratedCodeInfo.Annotation.Seman"
"tic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005AL"
"IAS\020\002*\300\001\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022\021"
"\n\014EDITION_2023\020\350\007\022\027\n\023EDITION_1_TEST_ONLY"
"\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITION_9"
"9997_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_TEST"
"_ONLY\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020\237\215\006"
"B~\n\023com.google.protobufB\020DescriptorProto"
"sH\001Z-google.golang.org/protobuf/types/de"
"scriptorpb\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Re"
"flection"
};
static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = {
false,
false,
9402,
9408,
descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto,
"google/protobuf/descriptor.proto",
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
@ -2263,7 +2263,7 @@ bool FeatureSet_Utf8Validation_IsValid(int value) {
(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr FeatureSet_Utf8Validation FeatureSet::UTF8_VALIDATION_UNKNOWN;
constexpr FeatureSet_Utf8Validation FeatureSet::NONE;
constexpr FeatureSet_Utf8Validation FeatureSet::UNVERIFIED;
constexpr FeatureSet_Utf8Validation FeatureSet::VERIFY;
constexpr FeatureSet_Utf8Validation FeatureSet::Utf8Validation_MIN;
constexpr FeatureSet_Utf8Validation FeatureSet::Utf8Validation_MAX;

@ -548,7 +548,7 @@ inline bool FeatureSet_RepeatedFieldEncoding_Parse(absl::string_view name, Featu
}
enum FeatureSet_Utf8Validation : int {
FeatureSet_Utf8Validation_UTF8_VALIDATION_UNKNOWN = 0,
FeatureSet_Utf8Validation_NONE = 1,
FeatureSet_Utf8Validation_UNVERIFIED = 1,
FeatureSet_Utf8Validation_VERIFY = 2,
};
@ -1825,7 +1825,7 @@ class PROTOBUF_EXPORT FeatureSet final :
using Utf8Validation = FeatureSet_Utf8Validation;
static constexpr Utf8Validation UTF8_VALIDATION_UNKNOWN = FeatureSet_Utf8Validation_UTF8_VALIDATION_UNKNOWN;
static constexpr Utf8Validation NONE = FeatureSet_Utf8Validation_NONE;
static constexpr Utf8Validation UNVERIFIED = FeatureSet_Utf8Validation_UNVERIFIED;
static constexpr Utf8Validation VERIFY = FeatureSet_Utf8Validation_VERIFY;
static inline bool Utf8Validation_IsValid(int value) {
return FeatureSet_Utf8Validation_IsValid(value);

@ -957,7 +957,7 @@ message FeatureSet {
enum Utf8Validation {
UTF8_VALIDATION_UNKNOWN = 0;
NONE = 1;
UNVERIFIED = 1;
VERIFY = 2;
}
optional Utf8Validation utf8_validation = 4 [

@ -7316,7 +7316,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: NONE
utf8_validation: UNVERIFIED
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -7324,7 +7324,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: NONE
utf8_validation: UNVERIFIED
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -7332,7 +7332,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: NONE
utf8_validation: UNVERIFIED
message_encoding: DELIMITED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -8295,13 +8295,13 @@ TEST_F(FeaturesTest, MapFieldFeaturesStringValidation) {
message Foo {
map<string, string> map_field = 1 [
features.utf8_validation = NONE
features.utf8_validation = UNVERIFIED
];
map<int32, string> map_field_value = 2 [
features.utf8_validation = NONE
features.utf8_validation = UNVERIFIED
];
map<string, int32> map_field_key = 3 [
features.utf8_validation = NONE
features.utf8_validation = UNVERIFIED
];
}
)schema";
@ -9010,7 +9010,7 @@ TEST_F(FeaturesTest, FieldFeatureHelpers) {
number: 7
label: LABEL_REPEATED
type: TYPE_STRING
options { features { utf8_validation: NONE } }
options { features { utf8_validation: UNVERIFIED } }
}
}
)pb");
@ -9428,7 +9428,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringWithStringValidation) {
number: 1
label: LABEL_OPTIONAL
type: TYPE_INT64
options { features { utf8_validation: NONE } }
options { features { utf8_validation: UNVERIFIED } }
}
}
)pb",
@ -9456,7 +9456,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "NONE"
identifier_value: "UNVERIFIED"
}
}
}
@ -9469,7 +9469,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "NONE"
identifier_value: "UNVERIFIED"
}
}
}
@ -9484,7 +9484,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "NONE"
identifier_value: "UNVERIFIED"
}
}
}

@ -9,7 +9,7 @@ edition = "2023";
import "google/protobuf/cpp_features.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.utf8_validation = UNVERIFIED;
option features.json_format = LEGACY_BEST_EFFORT;
option features.(pb.cpp).legacy_closed_enum = true;

@ -9,7 +9,7 @@ edition = "2023";
import "google/protobuf/cpp_features.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.utf8_validation = UNVERIFIED;
option features.json_format = LEGACY_BEST_EFFORT;
option features.(pb.cpp).legacy_closed_enum = true;

@ -9,7 +9,7 @@ edition = "2023";
import "google/protobuf/cpp_features.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.utf8_validation = UNVERIFIED;
option features.json_format = LEGACY_BEST_EFFORT;
option features.(pb.cpp).legacy_closed_enum = true;

@ -13,11 +13,11 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3 [features.utf8_validation = NONE];
string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED];
map<string, string> string_map_field = 4;
map<string, string> string_map_field_utf = 5;
map<string, string> string_map_field_noutf = 6 [features.utf8_validation = NONE];
map<string, string> string_map_field_noutf = 6 [features.utf8_validation = UNVERIFIED];
repeated int32 int_field = 7;
repeated int32 int_field_packed = 8;

@ -14,7 +14,7 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3 [features.utf8_validation = NONE];
string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED];
map<string, string> string_map_field = 4;

@ -16,7 +16,7 @@ edition = "2023";
import "google/protobuf/cpp_features.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.utf8_validation = UNVERIFIED;
option features.json_format = LEGACY_BEST_EFFORT;
option features.(pb.cpp).legacy_closed_enum = true;

@ -80,7 +80,7 @@ function transform_field(field)
}
if(syntax == 3) {
sub(/\<enforce_utf8 = false\>/, "features.utf8_validation = NONE", existing_options)
sub(/\<enforce_utf8 = false\>/, "features.utf8_validation = UNVERIFIED", existing_options)
sub(/\<packed = false\>/, "features.repeated_field_encoding = EXPANDED", existing_options)
existing_options = strip_option("packed = true", existing_options)
existing_options = strip_option("enforce_utf8 = (true|false)", existing_options)
@ -114,7 +114,7 @@ function transform_field(field)
print "import \"third_party/protobuf/cpp_features.proto\";"
print "option features.enum_type = CLOSED;"
print "option features.repeated_field_encoding = EXPANDED;"
print "option features.utf8_validation = NONE;"
print "option features.utf8_validation = UNVERIFIED;"
print "option features.json_format = LEGACY_BEST_EFFORT;"
print "option features.(pb.cpp).legacy_closed_enum = true;"
syntax = 2

@ -149,7 +149,7 @@ typedef enum {
typedef enum {
google_protobuf_FeatureSet_UTF8_VALIDATION_UNKNOWN = 0,
google_protobuf_FeatureSet_NONE = 1,
google_protobuf_FeatureSet_UNVERIFIED = 1,
google_protobuf_FeatureSet_VERIFY = 2
} google_protobuf_FeatureSet_Utf8Validation;

Loading…
Cancel
Save