diff --git a/source/common/protobuf/utility.cc b/source/common/protobuf/utility.cc index a5ccc3f0978d4..7e5d60d0752b7 100644 --- a/source/common/protobuf/utility.cc +++ b/source/common/protobuf/utility.cc @@ -382,21 +382,6 @@ class UnexpectedFieldProtoVisitor : public ProtobufMessage::ConstProtoVisitor { // If this field is deprecated, warn or throw an error. if (field.options().deprecated()) { - if (absl::StartsWith(field.name(), "hidden_envoy_deprecated_")) { - // The field was marked as hidden_envoy_deprecated and an error must be thrown, - // unless it is part of an explicit test that needs access to the deprecated field - // when we enable runtime deprecation override to allow point field overrides for tests. - if (!runtime_ || - !runtime_->snapshot().deprecatedFeatureEnabled( - absl::StrCat("envoy.deprecated_features:", field.full_name()), false)) { - const std::string fatal_error = absl::StrCat( - "Illegal use of hidden_envoy_deprecated_ V2 field '", field.full_name(), - "' from file ", filename, - " while using the latest V3 configuration. This field has been removed from the " - "current Envoy API. Please see " ENVOY_DOC_URL_VERSION_HISTORY " for details."); - throw ProtoValidationException(fatal_error, message); - } - } const std::string warning = absl::StrCat("Using {}deprecated option '", field.full_name(), "' from file ", filename, ". This configuration will be removed from " diff --git a/test/common/protobuf/utility_test.cc b/test/common/protobuf/utility_test.cc index 81b0494677518..c89d4f78c5003 100644 --- a/test/common/protobuf/utility_test.cc +++ b/test/common/protobuf/utility_test.cc @@ -1956,51 +1956,6 @@ TEST_F(DeprecatedFieldsTest, DEPRECATED_FEATURE_TEST(FatalEnumGlobalOverride)) { checkForDeprecation(base)); } -// Verify that direct use of a hidden_envoy_deprecated field fails, but upgrade -// succeeds -TEST_F(DeprecatedFieldsTest, DEPRECATED_FEATURE_TEST(ManualDeprecatedFieldAddition)) { - // Create a base message and insert a deprecated field. When upgrading the - // deprecated field should be set as deprecated, and a warning should be logged - envoy::test::deprecation_test::Base base_should_warn = - TestUtility::parseYaml(R"EOF( - not_deprecated: field1 - is_deprecated: hidden_field1 - not_deprecated_message: - inner_not_deprecated: subfield1 - repeated_message: - - inner_not_deprecated: subfield2 - )EOF"); - - // Non-fatal checks for a deprecated field should log rather than throw an exception. - EXPECT_LOG_CONTAINS("warning", - "Using deprecated option 'envoy.test.deprecation_test.Base.is_deprecated'", - checkForDeprecation(base_should_warn)); - EXPECT_EQ(1, runtime_deprecated_feature_use_.value()); - EXPECT_EQ(1, deprecated_feature_seen_since_process_start_.value()); - - // Create an upgraded message and insert a deprecated field. This is a bypass - // of the upgrading procedure validation, and should fail - envoy::test::deprecation_test::UpgradedBase base_should_fail = - TestUtility::parseYaml(R"EOF( - not_deprecated: field1 - hidden_envoy_deprecated_is_deprecated: hidden_field1 - not_deprecated_message: - inner_not_deprecated: subfield1 - repeated_message: - - inner_not_deprecated: subfield2 - )EOF"); - - EXPECT_THROW_WITH_REGEX( - MessageUtil::checkForUnexpectedFields(base_should_fail, - ProtobufMessage::getStrictValidationVisitor()), - ProtoValidationException, - "Illegal use of hidden_envoy_deprecated_ V2 field " - "'envoy.test.deprecation_test.UpgradedBase.hidden_envoy_deprecated_is_deprecated'"); - // The config will be rejected, so the feature will not be used. - EXPECT_EQ(1, runtime_deprecated_feature_use_.value()); - EXPECT_EQ(1, deprecated_feature_seen_since_process_start_.value()); -} - class TimestampUtilTest : public testing::Test, public ::testing::WithParamInterface {}; TEST_P(TimestampUtilTest, SystemClockToTimestampTest) { diff --git a/tools/type_whisperer/api_type_db.cc b/tools/type_whisperer/api_type_db.cc index 198a3ee4a477c..20982870186fb 100644 --- a/tools/type_whisperer/api_type_db.cc +++ b/tools/type_whisperer/api_type_db.cc @@ -83,8 +83,6 @@ absl::optional ApiTypeDb::getLatestTypeInformation(const std::s if (value->options().HasExtension(udpa::annotations::enum_value_migrate)) { result->renames_[value->name()] = value->options().GetExtension(udpa::annotations::enum_value_migrate).rename(); - } else if (value->options().deprecated()) { - result->renames_[value->name()] = "hidden_envoy_deprecated_" + value->name(); } } return result; @@ -98,8 +96,6 @@ absl::optional ApiTypeDb::getLatestTypeInformation(const std::s if (field->options().HasExtension(udpa::annotations::field_migrate)) { result->renames_[field->name()] = field->options().GetExtension(udpa::annotations::field_migrate).rename(); - } else if (field->options().deprecated()) { - result->renames_[field->name()] = "hidden_envoy_deprecated_" + field->name(); } } return result;