From 4cf3399ed24c96e518653649c27079d68651e2d5 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 13 Dec 2024 15:05:32 +0100 Subject: [PATCH] src/google/protobuf: document UnmarshalJSON / API level behavior For golang/protobuf#1657 Change-Id: Icdf7254bced1c0987ff2e969fd096d6eef3918f7 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/635139 Reviewed-by: Damien Neil Reviewed-by: Cassondra Foesch LUCI-TryBot-Result: Go LUCI --- src/google/protobuf/go_features.proto | 1 + types/gofeaturespb/go_features.pb.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/google/protobuf/go_features.proto b/src/google/protobuf/go_features.proto index a7e14f85..a9cc7923 100644 --- a/src/google/protobuf/go_features.proto +++ b/src/google/protobuf/go_features.proto @@ -19,6 +19,7 @@ extend google.protobuf.FeatureSet { message GoFeatures { // Whether or not to generate the deprecated UnmarshalJSON method for enums. + // Can only be true for proto using the Open Struct api. optional bool legacy_unmarshal_json_enum = 1 [ retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, diff --git a/types/gofeaturespb/go_features.pb.go b/types/gofeaturespb/go_features.pb.go index 61e3f766..e0b72eaf 100644 --- a/types/gofeaturespb/go_features.pb.go +++ b/types/gofeaturespb/go_features.pb.go @@ -148,6 +148,7 @@ func (GoFeatures_StripEnumPrefix) EnumDescriptor() ([]byte, []int) { type GoFeatures struct { state protoimpl.MessageState `protogen:"open.v1"` // Whether or not to generate the deprecated UnmarshalJSON method for enums. + // Can only be true for proto using the Open Struct api. LegacyUnmarshalJsonEnum *bool `protobuf:"varint,1,opt,name=legacy_unmarshal_json_enum,json=legacyUnmarshalJsonEnum" json:"legacy_unmarshal_json_enum,omitempty"` // One of OPEN, HYBRID or OPAQUE. ApiLevel *GoFeatures_APILevel `protobuf:"varint,2,opt,name=api_level,json=apiLevel,enum=pb.GoFeatures_APILevel" json:"api_level,omitempty"`