Rename UNVERIFIED utf8 validation option to NONE

PiperOrigin-RevId: 573375994
pull/14398/head
Mike Kruskal 1 year ago committed by Copybara-Service
parent c863cfcaf7
commit 512f19d406
  1. 2
      src/google/protobuf/compiler/code_generator_unittest.cc
  2. 6
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  3. 108
      src/google/protobuf/descriptor.pb.cc
  4. 4
      src/google/protobuf/descriptor.pb.h
  5. 4
      src/google/protobuf/descriptor.proto
  6. 22
      src/google/protobuf/descriptor_unittest.cc
  7. 2
      src/google/protobuf/editions/golden/editions_transform_proto2.proto
  8. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto
  9. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto
  10. 2
      src/google/protobuf/editions/golden/test_messages_proto2.proto
  11. 2
      src/google/protobuf/feature_resolver_test.cc
  12. 2
      upb/reflection/stage0/google/protobuf/descriptor.upb.h

@ -269,7 +269,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
}

@ -1753,7 +1753,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
}
@ -1802,7 +1802,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
}
@ -1852,7 +1852,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
}

@ -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\"\251\t\n\nFeatureSet\022|\n\016field_presen"
"ion\030\002 \002(\010\"\235\t\n\nFeatureSet\022|\n\016field_presen"
"ce\030\001 \001(\0162).google.protobuf.FeatureSet.Fi"
"eldPresenceB9\210\001\001\230\001\004\230\001\001\242\001\r\022\010EXPLICIT\030\346\007\242\001"
"\r\022\010IMPLICIT\030\347\007\242\001\r\022\010EXPLICIT\030\350\007\022\\\n\tenum_t"
@ -1847,63 +1847,63 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR
"N\030\347\007\022{\n\027repeated_field_encoding\030\003 \001(\01621."
"google.protobuf.FeatureSet.RepeatedField"
"EncodingB\'\210\001\001\230\001\004\230\001\001\242\001\r\022\010EXPANDED\030\346\007\242\001\013\022\006"
"PACKED\030\347\007\022n\n\017utf8_validation\030\004 \001(\0162*.goo"
"gle.protobuf.FeatureSet.Utf8ValidationB)"
"\210\001\001\230\001\004\230\001\001\242\001\017\022\nUNVERIFIED\030\346\007\242\001\013\022\006VERIFY\030\347"
"\007\022g\n\020message_encoding\030\005 \001(\0162+.google.pro"
"tobuf.FeatureSet.MessageEncodingB \210\001\001\230\001\004"
"\230\001\001\242\001\024\022\017LENGTH_PREFIXED\030\346\007\022p\n\013json_forma"
"t\030\006 \001(\0162&.google.protobuf.FeatureSet.Jso"
"nFormatB3\210\001\001\230\001\003\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EF"
"FORT\030\346\007\242\001\n\022\005ALLOW\030\347\007\"\\\n\rFieldPresence\022\032\n"
"\026FIELD_PRESENCE_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022"
"\014\n\010IMPLICIT\020\002\022\023\n\017LEGACY_REQUIRED\020\003\"7\n\010En"
"umType\022\025\n\021ENUM_TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022"
"\n\n\006CLOSED\020\002\"V\n\025RepeatedFieldEncoding\022#\n\037"
"REPEATED_FIELD_ENCODING_UNKNOWN\020\000\022\n\n\006PAC"
"KED\020\001\022\014\n\010EXPANDED\020\002\"I\n\016Utf8Validation\022\033\n"
"\027UTF8_VALIDATION_UNKNOWN\020\000\022\016\n\nUNVERIFIED"
"\020\001\022\n\n\006VERIFY\020\002\"S\n\017MessageEncoding\022\034\n\030MES"
"SAGE_ENCODING_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIX"
"ED\020\001\022\r\n\tDELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSO"
"N_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\010defaults"
"\030\001 \003(\0132<.google.protobuf.FeatureSetDefau"
"lts.FeatureSetEditionDefault\0221\n\017minimum_"
"edition\030\004 \001(\0162\030.google.protobuf.Edition\022"
"1\n\017maximum_edition\030\005 \001(\0162\030.google.protob"
"uf.Edition\032t\n\030FeatureSetEditionDefault\022)"
"\n\007edition\030\003 \001(\0162\030.google.protobuf.Editio"
"n\022-\n\010features\030\002 \001(\0132\033.google.protobuf.Fe"
"atureSet\"\325\001\n\016SourceCodeInfo\022:\n\010location\030"
"\001 \003(\0132(.google.protobuf.SourceCodeInfo.L"
"ocation\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_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\021GeneratedCo"
"deInfo\022A\n\nannotation\030\001 \003(\0132-.google.prot"
"obuf.GeneratedCodeInfo.Annotation\032\303\001\n\nAn"
"notation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_fil"
"e\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010s"
"emantic\030\005 \001(\01626.google.protobuf.Generate"
"dCodeInfo.Annotation.Semantic\"(\n\010Semanti"
"c\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002*\352\001\n\007Edit"
"ion\022\023\n\017EDITION_UNKNOWN\020\000\022\023\n\016EDITION_PROT"
"O2\020\346\007\022\023\n\016EDITION_PROTO3\020\347\007\022\021\n\014EDITION_20"
"23\020\350\007\022\027\n\023EDITION_1_TEST_ONLY\020\001\022\027\n\023EDITIO"
"N_2_TEST_ONLY\020\002\022\035\n\027EDITION_99997_TEST_ON"
"LY\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\023com.goog"
"le.protobufB\020DescriptorProtosH\001Z-google."
"golang.org/protobuf/types/descriptorpb\370\001"
"\001\242\002\003GPB\252\002\032Google.Protobuf.Reflection"
"PACKED\030\347\007\022h\n\017utf8_validation\030\004 \001(\0162*.goo"
"gle.protobuf.FeatureSet.Utf8ValidationB#"
"\210\001\001\230\001\004\230\001\001\242\001\t\022\004NONE\030\346\007\242\001\013\022\006VERIFY\030\347\007\022g\n\020m"
"essage_encoding\030\005 \001(\0162+.google.protobuf."
"FeatureSet.MessageEncodingB \210\001\001\230\001\004\230\001\001\242\001\024"
"\022\017LENGTH_PREFIXED\030\346\007\022p\n\013json_format\030\006 \001("
"\0162&.google.protobuf.FeatureSet.JsonForma"
"tB3\210\001\001\230\001\003\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EFFORT\030\346"
"\007\242\001\n\022\005ALLOW\030\347\007\"\\\n\rFieldPresence\022\032\n\026FIELD"
"_PRESENCE_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n\010IMP"
"LICIT\020\002\022\023\n\017LEGACY_REQUIRED\020\003\"7\n\010EnumType"
"\022\025\n\021ENUM_TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLO"
"SED\020\002\"V\n\025RepeatedFieldEncoding\022#\n\037REPEAT"
"ED_FIELD_ENCODING_UNKNOWN\020\000\022\n\n\006PACKED\020\001\022"
"\014\n\010EXPANDED\020\002\"C\n\016Utf8Validation\022\033\n\027UTF8_"
"VALIDATION_UNKNOWN\020\000\022\010\n\004NONE\020\001\022\n\n\006VERIFY"
"\020\002\"S\n\017MessageEncoding\022\034\n\030MESSAGE_ENCODIN"
"G_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tDELI"
"MITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_FORMAT_UNK"
"NOWN\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\022Fe"
"atureSetDefaults\022N\n\010defaults\030\001 \003(\0132<.goo"
"gle.protobuf.FeatureSetDefaults.FeatureS"
"etEditionDefault\0221\n\017minimum_edition\030\004 \001("
"\0162\030.google.protobuf.Edition\0221\n\017maximum_e"
"dition\030\005 \001(\0162\030.google.protobuf.Edition\032t"
"\n\030FeatureSetEditionDefault\022)\n\007edition\030\003 "
"\001(\0162\030.google.protobuf.Edition\022-\n\010feature"
"s\030\002 \001(\0132\033.google.protobuf.FeatureSet\"\325\001\n"
"\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132(.goog"
"le.protobuf.SourceCodeInfo.Location\032\206\001\n\010"
"Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005"
"B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021traili"
"ng_comments\030\004 \001(\t\022!\n\031leading_detached_co"
"mments\030\006 \003(\t\"\234\002\n\021GeneratedCodeInfo\022A\n\nan"
"notation\030\001 \003(\0132-.google.protobuf.Generat"
"edCodeInfo.Annotation\032\303\001\n\nAnnotation\022\020\n\004"
"path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005b"
"egin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001("
"\01626.google.protobuf.GeneratedCodeInfo.An"
"notation.Semantic\"(\n\010Semantic\022\010\n\004NONE\020\000\022"
"\007\n\003SET\020\001\022\t\n\005ALIAS\020\002*\352\001\n\007Edition\022\023\n\017EDITI"
"ON_UNKNOWN\020\000\022\023\n\016EDITION_PROTO2\020\346\007\022\023\n\016EDI"
"TION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020\350\007\022\027\n\023EDI"
"TION_1_TEST_ONLY\020\001\022\027\n\023EDITION_2_TEST_ONL"
"Y\020\002\022\035\n\027EDITION_99997_TEST_ONLY\020\235\215\006\022\035\n\027ED"
"ITION_99998_TEST_ONLY\020\236\215\006\022\035\n\027EDITION_999"
"99_TEST_ONLY\020\237\215\006B~\n\023com.google.protobufB"
"\020DescriptorProtosH\001Z-google.golang.org/p"
"rotobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032Go"
"ogle.Protobuf.Reflection"
};
static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = {
false,
false,
9556,
9544,
descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto,
"google/protobuf/descriptor.proto",
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
@ -2266,7 +2266,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::UNVERIFIED;
constexpr FeatureSet_Utf8Validation FeatureSet::NONE;
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_UNVERIFIED = 1,
FeatureSet_Utf8Validation_NONE = 1,
FeatureSet_Utf8Validation_VERIFY = 2,
};
@ -1827,7 +1827,7 @@ class PROTOBUF_EXPORT FeatureSet final :
using Utf8Validation = FeatureSet_Utf8Validation;
static constexpr Utf8Validation UTF8_VALIDATION_UNKNOWN = FeatureSet_Utf8Validation_UTF8_VALIDATION_UNKNOWN;
static constexpr Utf8Validation UNVERIFIED = FeatureSet_Utf8Validation_UNVERIFIED;
static constexpr Utf8Validation NONE = FeatureSet_Utf8Validation_NONE;
static constexpr Utf8Validation VERIFY = FeatureSet_Utf8Validation_VERIFY;
static inline bool Utf8Validation_IsValid(int value) {
return FeatureSet_Utf8Validation_IsValid(value);

@ -974,14 +974,14 @@ message FeatureSet {
enum Utf8Validation {
UTF8_VALIDATION_UNKNOWN = 0;
UNVERIFIED = 1;
NONE = 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_PROTO2, value: "NONE" },
edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" }
];

@ -7317,7 +7317,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -7325,7 +7325,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -7333,7 +7333,7 @@ TEST_F(FeaturesTest, Proto2Features) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: DELIMITED
json_format: LEGACY_BEST_EFFORT
[pb.cpp] { legacy_closed_enum: true })pb"));
@ -8401,13 +8401,13 @@ TEST_F(FeaturesTest, MapFieldFeaturesStringValidation) {
message Foo {
map<string, string> map_field = 1 [
features.utf8_validation = UNVERIFIED
features.utf8_validation = NONE
];
map<int32, string> map_field_value = 2 [
features.utf8_validation = UNVERIFIED
features.utf8_validation = NONE
];
map<string, int32> map_field_key = 3 [
features.utf8_validation = UNVERIFIED
features.utf8_validation = NONE
];
}
)schema";
@ -9116,7 +9116,7 @@ TEST_F(FeaturesTest, FieldFeatureHelpers) {
number: 7
label: LABEL_REPEATED
type: TYPE_STRING
options { features { utf8_validation: UNVERIFIED } }
options { features { utf8_validation: NONE } }
}
}
)pb");
@ -9546,7 +9546,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringWithStringValidation) {
number: 1
label: LABEL_OPTIONAL
type: TYPE_INT64
options { features { utf8_validation: UNVERIFIED } }
options { features { utf8_validation: NONE } }
}
}
)pb",
@ -9574,7 +9574,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "UNVERIFIED"
identifier_value: "NONE"
}
}
}
@ -9587,7 +9587,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "UNVERIFIED"
identifier_value: "NONE"
}
}
}
@ -9602,7 +9602,7 @@ TEST_F(FeaturesTest, InvalidFieldNonStringMapWithStringValidation) {
uninterpreted_option {
name { name_part: "features" is_extension: false }
name { name_part: "utf8_validation" is_extension: false }
identifier_value: "UNVERIFIED"
identifier_value: "NONE"
}
}
}

@ -20,7 +20,7 @@ import "google/protobuf/editions/proto/editions_transform_proto3.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = UNVERIFIED;
option features.utf8_validation = NONE;
option features.json_format = LEGACY_BEST_EFFORT;
option java_multiple_files = true;
option cc_enable_arenas = true;

@ -11,7 +11,7 @@ package protobuf_editions_test;
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = UNVERIFIED;
option features.utf8_validation = NONE;
option features.json_format = LEGACY_BEST_EFFORT;
option optimize_for = LITE_RUNTIME;

@ -11,7 +11,7 @@ package protobuf_editions_test;
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = UNVERIFIED;
option features.utf8_validation = NONE;
option features.json_format = LEGACY_BEST_EFFORT;
message TestMessageUtf8Disabled {

@ -17,7 +17,7 @@ package protobuf_test_messages.proto2;
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = UNVERIFIED;
option features.utf8_validation = NONE;
option features.json_format = LEGACY_BEST_EFFORT;
option java_package = "com.google.protobuf_test_messages.proto2";
option objc_class_prefix = "Proto2";

@ -989,7 +989,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) {
field_presence: EXPLICIT
enum_type: CLOSED
repeated_field_encoding: EXPANDED
utf8_validation: UNVERIFIED
utf8_validation: NONE
message_encoding: LENGTH_PREFIXED
json_format: LEGACY_BEST_EFFORT
[pb.test] { int_file_feature: 0 }

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

Loading…
Cancel
Save