proto: add warning to *Options.features fields
These fields are exempt from backwards-compatibility guarantee and are potential footguns when used outside special use cases like protocompile or proto plugins.
PiperOrigin-RevId: 697510064
diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
deleted file mode 100644
index 208ce1f..0000000
--- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file or at
-// https://developers.google.com/open-source/licenses/bsd
-#endregion
-
-namespace Google.Protobuf.Reflection;
-
-internal sealed partial class FeatureSetDescriptor
-{
- // Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
- private const string DefaultsBase64 =
- "ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
-}
diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto
index 6011f72..dd2d0fb 100644
--- a/src/google/protobuf/descriptor.proto
+++ b/src/google/protobuf/descriptor.proto
@@ -131,9 +131,15 @@
// The supported values are "proto2", "proto3", and "editions".
//
// If `edition` is present, this value must be "editions".
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional string syntax = 12;
// The edition of the proto file.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional Edition edition = 14;
}
@@ -546,6 +552,9 @@
optional string ruby_package = 45;
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 50;
// The parser stores options it doesn't recognize here.
@@ -632,6 +641,9 @@
optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 12;
// The parser stores options it doesn't recognize here. See above.
@@ -772,6 +784,9 @@
repeated EditionDefault edition_defaults = 20;
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 21;
// Information about the support window of a feature.
@@ -808,6 +823,9 @@
message OneofOptions {
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 1;
// The parser stores options it doesn't recognize here. See above.
@@ -840,6 +858,9 @@
optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 7;
// The parser stores options it doesn't recognize here. See above.
@@ -857,6 +878,9 @@
optional bool deprecated = 1 [default = false];
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 2;
// Indicate that fields annotated with this enum value should not be printed
@@ -877,6 +901,9 @@
message ServiceOptions {
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 34;
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
@@ -922,6 +949,9 @@
[default = IDEMPOTENCY_UNKNOWN];
// Any features defined in the specific edition.
+ // WARNING: This field should only be used by protobuf plugins or special
+ // cases like the proto compiler. Other uses are discouraged and
+ // developers should rely on the protoreflect APIs for their client language.
optional FeatureSet features = 35;
// The parser stores options it doesn't recognize here. See above.