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 <dneil@google.com>
Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Stapelberg 2024-12-13 15:05:32 +01:00
parent 8edf9401bb
commit 4cf3399ed2
2 changed files with 2 additions and 0 deletions

View File

@ -19,6 +19,7 @@ extend google.protobuf.FeatureSet {
message GoFeatures { message GoFeatures {
// Whether or not to generate the deprecated UnmarshalJSON method for enums. // 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 [ optional bool legacy_unmarshal_json_enum = 1 [
retention = RETENTION_RUNTIME, retention = RETENTION_RUNTIME,
targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM,

View File

@ -148,6 +148,7 @@ func (GoFeatures_StripEnumPrefix) EnumDescriptor() ([]byte, []int) {
type GoFeatures struct { type GoFeatures struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// Whether or not to generate the deprecated UnmarshalJSON method for enums. // 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"` 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. // 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"` ApiLevel *GoFeatures_APILevel `protobuf:"varint,2,opt,name=api_level,json=apiLevel,enum=pb.GoFeatures_APILevel" json:"api_level,omitempty"`