reflect/protoreflect: add HasJSONName, ReservedRanges, and ReservedNames
These properties of descriptors are currently missing and makes it impossible
to convert a FileDescriptorProto into one of the structured Go representations
and convert it back to a proto message without loss of information.
Furthermore, ReservedRanges and ReservedNames has semantic importance
to text serialization.
Change-Id: Ic33c30020ad51912b143156b95f47a4fb8da3503
Reviewed-on: https://go-review.googlesource.com/c/153019
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go/internal_gengo/reflect.go b/cmd/protoc-gen-go/internal_gengo/reflect.go
index 0b0e03c..9f06602 100644
--- a/cmd/protoc-gen-go/internal_gengo/reflect.go
+++ b/cmd/protoc-gen-go/internal_gengo/reflect.go
@@ -207,6 +207,22 @@
g.P("{Name: ", strconv.Quote(string(value.Desc.Name())), ", Number: ", value.Desc.Number(), "},")
}
g.P("},")
+ if resvNames := enum.Desc.ReservedNames(); resvNames.Len() > 0 {
+ var ss []string
+ for i := 0; i < resvNames.Len(); i++ {
+ s := resvNames.Get(i)
+ ss = append(ss, strconv.Quote(string(s)))
+ }
+ g.P("ReservedNames: []", protoreflectPackage.Ident("Name"), "{", strings.Join(ss, ","), "},")
+ }
+ if resvRanges := enum.Desc.ReservedRanges(); resvRanges.Len() > 0 {
+ var ss []string
+ for i := 0; i < resvRanges.Len(); i++ {
+ r := resvRanges.Get(i)
+ ss = append(ss, fmt.Sprintf("{%d,%d}", r[0], r[1]))
+ }
+ g.P("ReservedRanges: [][2]", protoreflectPackage.Ident("EnumNumber"), "{", strings.Join(ss, ","), "},")
+ }
g.P("},")
}
g.P("}")
@@ -245,8 +261,9 @@
g.P("Number: ", field.Number(), ",")
g.P("Cardinality: ", protoreflectPackage.Ident(field.Cardinality().GoString()), ",")
g.P("Kind: ", protoreflectPackage.Ident(field.Kind().GoString()), ",")
- // TODO: omit JSONName if it can be derived from Name?
- g.P("JSONName: ", strconv.Quote(field.JSONName()), ",")
+ if field.HasJSONName() {
+ g.P("JSONName: ", strconv.Quote(field.JSONName()), ",")
+ }
if field.HasDefault() {
v := field.Default().Interface()
typeName := reflect.TypeOf(v).Name()
@@ -285,6 +302,22 @@
}
g.P("},")
}
+ if resvNames := message.Desc.ReservedNames(); resvNames.Len() > 0 {
+ var ss []string
+ for i := 0; i < resvNames.Len(); i++ {
+ s := resvNames.Get(i)
+ ss = append(ss, strconv.Quote(string(s)))
+ }
+ g.P("ReservedNames: []", protoreflectPackage.Ident("Name"), "{", strings.Join(ss, ","), "},")
+ }
+ if resvRanges := message.Desc.ReservedRanges(); resvRanges.Len() > 0 {
+ var ss []string
+ for i := 0; i < resvRanges.Len(); i++ {
+ r := resvRanges.Get(i)
+ ss = append(ss, fmt.Sprintf("{%d,%d}", r[0], r[1]))
+ }
+ g.P("ReservedRanges: [][2]", protoreflectPackage.Ident("FieldNumber"), "{", strings.Join(ss, ","), "},")
+ }
if extRanges := message.Desc.ExtensionRanges(); extRanges.Len() > 0 {
var ss []string
for i := 0; i < extRanges.Len(); i++ {
diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
index e3a39f2..c1447ec 100644
--- a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
@@ -461,26 +461,27 @@
}
var fileDescriptor_de9f68860d540858 = []byte{
- // 296 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0xd0, 0xc1, 0x4b, 0xfb, 0x30,
- 0x14, 0x07, 0xf0, 0x5f, 0xb6, 0xc3, 0x0f, 0x73, 0x98, 0x59, 0x64, 0x30, 0x06, 0xc2, 0xd8, 0x45,
- 0x19, 0xac, 0x21, 0xef, 0xe8, 0x45, 0x3a, 0xd7, 0x9b, 0x6e, 0xa0, 0x53, 0x41, 0x0f, 0x25, 0x6b,
- 0xb3, 0x58, 0x68, 0x93, 0xb2, 0x26, 0x82, 0xff, 0x84, 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, 0x08, 0x1a, 0x75,
- 0x08, 0x9a, 0xfb, 0x4f, 0x97, 0x2a, 0xb1, 0x2f, 0x6e, 0xe3, 0x45, 0x26, 0x63, 0xca, 0xa4, 0x42,
- 0x2b, 0x56, 0x6e, 0x74, 0xe3, 0xb6, 0xec, 0x15, 0x58, 0x94, 0xc5, 0x55, 0x1f, 0xcd, 0x94, 0xd4,
- 0x33, 0x65, 0x98, 0x95, 0x85, 0x8d, 0x85, 0x15, 0xd5, 0x18, 0x3e, 0x02, 0x00, 0x00, 0xff, 0xff,
- 0x26, 0xf5, 0x57, 0x52, 0x4e, 0x02, 0x00, 0x00,
+ // 317 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0xd0, 0xd1, 0x4b, 0xc2, 0x40,
+ 0x1c, 0x07, 0xf0, 0xb6, 0x09, 0xe9, 0x3d, 0xd8, 0xb9, 0x10, 0x44, 0x08, 0x64, 0x2f, 0x85, 0xe0,
+ 0xc6, 0xfd, 0x1e, 0x7b, 0x89, 0x99, 0xf7, 0x56, 0x4a, 0x6a, 0x06, 0xf5, 0x20, 0xe7, 0x76, 0x5e,
+ 0x03, 0x77, 0x27, 0xee, 0x2e, 0xe8, 0x9f, 0xe8, 0x6f, 0x0e, 0x5d, 0xcc, 0x45, 0x2b, 0xe8, 0x69,
+ 0xdf, 0xdf, 0x6f, 0xdf, 0x7d, 0x60, 0x3f, 0xd4, 0xda, 0xee, 0x94, 0x56, 0x10, 0x70, 0x69, 0x52,
+ 0xff, 0x90, 0xdd, 0xb6, 0x50, 0x87, 0x90, 0x8f, 0x51, 0xfe, 0x00, 0xef, 0xc3, 0x41, 0x6d, 0x2a,
+ 0x4d, 0x7a, 0xab, 0xa4, 0x66, 0x89, 0xe4, 0xbb, 0x7b, 0x9e, 0x65, 0x4c, 0x70, 0xe2, 0xbe, 0x20,
+ 0x37, 0xe6, 0x6b, 0x66, 0x36, 0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0x05, 0x9a, 0x67, 0x3a, 0x66, 0x9a, 0xe5, 0x6b, 0xf8,
+ 0x0c, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xcb, 0xe0, 0x01, 0x70, 0x02, 0x00, 0x00,
}
func init() {
@@ -559,6 +560,8 @@
{Name: "duplicate1", Number: 1},
{Name: "duplicate2", Number: 1},
},
+ ReservedNames: []protoreflect.Name{"RESERVED1", "RESERVED2"},
+ ReservedRanges: [][2]protoreflect.EnumNumber{{2, 2}, {3, 3}},
},
{
Name: "NestedEnumType1A",
diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.proto b/cmd/protoc-gen-go/testdata/proto2/enum.proto
index 849ff6c..87b9005 100644
--- a/cmd/protoc-gen-go/testdata/proto2/enum.proto
+++ b/cmd/protoc-gen-go/testdata/proto2/enum.proto
@@ -20,6 +20,10 @@
option allow_alias = true;
duplicate1 = 1;
duplicate2 = 1;
+
+ reserved "RESERVED1";
+ reserved "RESERVED2";
+ reserved 2, 3;
}
message EnumContainerMessage1 {
diff --git a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
index 4f0cbb8..f5eba16 100644
--- a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
@@ -1445,129 +1445,132 @@
}
var fileDescriptor_fd8a9d72b841fd68 = []byte{
- // 1941 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x98, 0x5b, 0x73, 0x23, 0x47,
- 0x15, 0xc7, 0x3d, 0x23, 0xf9, 0xa2, 0xb6, 0x65, 0xc9, 0xed, 0x2c, 0xd5, 0xec, 0x53, 0xc7, 0x04,
- 0x32, 0x21, 0xbb, 0x76, 0x2c, 0x8f, 0xdb, 0x89, 0x80, 0x02, 0x5c, 0x78, 0x31, 0x55, 0xb0, 0x0b,
- 0xc3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0x9e, 0xc0, 0x19, 0xbb, 0xe1, 0xec,
+ 0xd6, 0x74, 0x03, 0x81, 0xa4, 0xdd, 0x45, 0x52, 0xd1, 0x9b, 0xec, 0xb9, 0xb9, 0x85, 0x97, 0xdb,
+ 0x8d, 0x7b, 0xed, 0xe7, 0xe6, 0x16, 0xee, 0xb5, 0x1b, 0xaf, 0xb4, 0xc3, 0xea, 0xe1, 0x5e, 0xbb,
+ 0x73, 0xb8, 0x7f, 0x70, 0xf4, 0xfc, 0x33, 0xed, 0x67, 0xc3, 0x2b, 0xe6, 0xa7, 0x0e, 0xfc, 0x3b,
+ 0x68, 0xef, 0xed, 0x3e, 0x73, 0xf3, 0xbd, 0xbd, 0x7e, 0x76, 0x6b, 0x72, 0xb2, 0x7e, 0x9a, 0x0e,
+ 0x37, 0x7a, 0xe9, 0x20, 0x4a, 0x7a, 0x1b, 0x62, 0xb6, 0x27, 0x93, 0xee, 0xc6, 0xed, 0xe6, 0xc6,
+ 0xe9, 0xf0, 0x0c, 0x3f, 0x9f, 0xae, 0xf5, 0xe2, 0x64, 0xad, 0x97, 0x6e, 0x64, 0xf1, 0x38, 0x3b,
+ 0x8b, 0xb2, 0x08, 0xc3, 0xcd, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x34, 0xd6, 0x88, 0x19,
+ 0x17, 0x00, 0x00,
}
func init() {
@@ -2434,6 +2437,8 @@
{Name: "oneof_field"},
{Name: "oneof_two"},
},
+ ReservedNames: []protoreflect.Name{"TEN_THOUSAND", "TEN_THOUSAND_AND_ONE"},
+ ReservedRanges: [][2]protoreflect.FieldNumber{{10000, 10001}, {10001, 10002}},
},
{
Name: "OptionalGroup",
diff --git a/cmd/protoc-gen-go/testdata/proto2/fields.proto b/cmd/protoc-gen-go/testdata/proto2/fields.proto
index 45bd989..35cfbd2 100644
--- a/cmd/protoc-gen-go/testdata/proto2/fields.proto
+++ b/cmd/protoc-gen-go/testdata/proto2/fields.proto
@@ -137,4 +137,7 @@
ONE = 1;
}
message Message {}
+
+ reserved 10000, 10001;
+ reserved "TEN_THOUSAND", "TEN_THOUSAND_AND_ONE";
}
diff --git a/internal/legacy/file_test.go b/internal/legacy/file_test.go
index 7f3b79a..8ac6d9f 100644
--- a/internal/legacy/file_test.go
+++ b/internal/legacy/file_test.go
@@ -409,6 +409,9 @@
case "Enums", "Messages", "Extensions":
// Ignore nested message and enum declarations since
// legacy descriptors are all created standalone.
+ case "HasJSONName":
+ // Ignore this since the semantics of the field has
+ // changed across protoc and protoc-gen-go releases.
case "OneofType", "ExtendedType", "EnumType", "MessageType":
// Avoid descending into a dependency to avoid a cycle.
// Just record the full name if available.
diff --git a/internal/typefmt/stringer.go b/internal/typefmt/stringer.go
index 21f1072..feb28ef 100644
--- a/internal/typefmt/stringer.go
+++ b/internal/typefmt/stringer.go
@@ -30,10 +30,14 @@
if isRoot {
var name string
switch vs.(type) {
+ case pref.Names:
+ name = "Names"
case pref.FieldNumbers:
name = "FieldNumbers"
case pref.FieldRanges:
name = "FieldRanges"
+ case pref.EnumRanges:
+ name = "EnumRanges"
case pref.FileImports:
name = "FileImports"
case pref.Descriptor:
@@ -44,6 +48,11 @@
var ss []string
switch vs := vs.(type) {
+ case pref.Names:
+ for i := 0; i < vs.Len(); i++ {
+ ss = append(ss, fmt.Sprint(vs.Get(i)))
+ }
+ return start + joinStrings(ss, false) + end
case pref.FieldNumbers:
for i := 0; i < vs.Len(); i++ {
ss = append(ss, fmt.Sprint(vs.Get(i)))
@@ -55,7 +64,17 @@
if r[0]+1 == r[1] {
ss = append(ss, fmt.Sprintf("%d", r[0]))
} else {
- ss = append(ss, fmt.Sprintf("%d:%d", r[0], r[1]))
+ ss = append(ss, fmt.Sprintf("%d:%d", r[0], r[1])) // enum ranges are end exclusive
+ }
+ }
+ return start + joinStrings(ss, false) + end
+ case pref.EnumRanges:
+ for i := 0; i < vs.Len(); i++ {
+ r := vs.Get(i)
+ if r[0] == r[1] {
+ ss = append(ss, fmt.Sprintf("%d", r[0]))
+ } else {
+ ss = append(ss, fmt.Sprintf("%d:%d", r[0], int64(r[1])+1)) // enum ranges are end inclusive
}
}
return start + joinStrings(ss, false) + end
@@ -86,10 +105,10 @@
// Using a list allows us to print the accessors in a sensible order.
var descriptorAccessors = map[reflect.Type][]string{
reflect.TypeOf((*pref.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
- reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
- reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "JSONName", "IsPacked", "IsMap", "IsWeak", "HasDefault", "Default", "OneofType", "ExtendedType", "MessageType", "EnumType"},
+ reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
+ reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "IsPacked", "IsMap", "IsWeak", "HasDefault", "Default", "OneofType", "ExtendedType", "MessageType", "EnumType"},
reflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
- reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values"},
+ reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
reflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {"Number"},
reflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem(): {"Methods"},
reflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem(): {"InputType", "OutputType", "IsStreamingClient", "IsStreamingServer"},
diff --git a/reflect/protodesc/protodesc.go b/reflect/protodesc/protodesc.go
index 65cbf87..2467a92 100644
--- a/reflect/protodesc/protodesc.go
+++ b/reflect/protodesc/protodesc.go
@@ -58,7 +58,7 @@
func NewFile(fd *descriptorpb.FileDescriptorProto, r *protoregistry.Files) (protoreflect.FileDescriptor, error) {
var f prototype.File
switch fd.GetSyntax() {
- case "", "proto2":
+ case "proto2", "":
f.Syntax = protoreflect.Proto2
case "proto3":
f.Syntax = protoreflect.Proto3
@@ -172,6 +172,15 @@
Options: od.Options,
})
}
+ for _, s := range md.GetReservedName() {
+ m.ReservedNames = append(m.ReservedNames, protoreflect.Name(s))
+ }
+ for _, rr := range md.GetReservedRange() {
+ m.ReservedRanges = append(m.ReservedRanges, [2]protoreflect.FieldNumber{
+ protoreflect.FieldNumber(rr.GetStart()),
+ protoreflect.FieldNumber(rr.GetEnd()),
+ })
+ }
for _, xr := range md.GetExtensionRange() {
m.ExtensionRanges = append(m.ExtensionRanges, [2]protoreflect.FieldNumber{
protoreflect.FieldNumber(xr.GetStart()),
@@ -210,6 +219,15 @@
Options: vd.Options,
})
}
+ for _, s := range ed.GetReservedName() {
+ e.ReservedNames = append(e.ReservedNames, protoreflect.Name(s))
+ }
+ for _, rr := range ed.GetReservedRange() {
+ e.ReservedRanges = append(e.ReservedRanges, [2]protoreflect.EnumNumber{
+ protoreflect.EnumNumber(rr.GetStart()),
+ protoreflect.EnumNumber(rr.GetEnd()),
+ })
+ }
es = append(es, e)
}
return es, nil
diff --git a/reflect/protoreflect/proto.go b/reflect/protoreflect/proto.go
index 6ef9e89..0746c11 100644
--- a/reflect/protoreflect/proto.go
+++ b/reflect/protoreflect/proto.go
@@ -300,6 +300,18 @@
// EnumNumber is the numeric value for an enum.
type EnumNumber int32
+// EnumRanges represent a list of enum number ranges.
+type EnumRanges interface {
+ // Len reports the number of ranges in the list.
+ Len() int
+ // Get returns the ith range. It panics if out of bounds.
+ Get(i int) [2]EnumNumber // start inclusive; end inclusive
+ // Has reports whether n is within any of the ranges.
+ Has(n EnumNumber) bool
+
+ doNotImplement
+}
+
var (
regexName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*$`)
regexFullName = regexp.MustCompile(`^[_a-zA-Z][_a-zA-Z0-9]*(\.[_a-zA-Z][_a-zA-Z0-9]*)*$`)
@@ -315,6 +327,18 @@
return regexName.MatchString(string(n))
}
+// Names represent a list of names.
+type Names interface {
+ // Len reports the number of names in the list.
+ Len() int
+ // Get returns the ith name. It panics if out of bounds.
+ Get(i int) Name
+ // Has reports whether s matches any names in the list.
+ Has(s Name) bool
+
+ doNotImplement
+}
+
// FullName is a qualified name that uniquely identifies a proto declaration.
// A qualified name is the concatenation of the proto package along with the
// fully-declared name (i.e., name of parent preceding the name of the child),
diff --git a/reflect/protoreflect/type.go b/reflect/protoreflect/type.go
index ba65813..d58232c 100644
--- a/reflect/protoreflect/type.go
+++ b/reflect/protoreflect/type.go
@@ -229,6 +229,10 @@
// Oneofs is a list of nested oneof declarations.
Oneofs() OneofDescriptors
+ // ReservedNames is a list of reserved field names.
+ ReservedNames() Names
+ // ReservedRanges is a list of reserved ranges of field numbers.
+ ReservedRanges() FieldRanges
// RequiredNumbers is a list of required field numbers.
// In Proto3, it is always an empty list.
RequiredNumbers() FieldNumbers
@@ -295,6 +299,9 @@
// Kind reports the basic kind for this field.
Kind() Kind
+ // HasJSONName reports whether this field has an explicitly set JSON name.
+ HasJSONName() bool
+
// JSONName reports the name used for JSON serialization.
// It is usually the camel-cased form of the field name.
JSONName() string
@@ -316,6 +323,9 @@
// and MessageDescriptor.IsMapEntry is true.
IsMap() bool
+ // HasDefault reports whether this field has a default value.
+ HasDefault() bool
+
// Default returns the default value for scalar fields.
// For proto2, it is the default value as specified in the proto file,
// or the zero value if unspecified.
@@ -327,9 +337,6 @@
// of an enum field, and is nil for any other kind of field.
DefaultEnumValue() EnumValueDescriptor
- // HasDefault reports whether this field has a default value.
- HasDefault() bool
-
// OneofType is the containing oneof that this field belongs to,
// and is nil if this field is not part of a oneof.
OneofType() OneofDescriptor
@@ -478,6 +485,11 @@
// Values is a list of nested enum value declarations.
Values() EnumValueDescriptors
+ // ReservedNames is a list of reserved enum names.
+ ReservedNames() Names
+ // ReservedRanges is a list of reserved ranges of enum numbers.
+ ReservedRanges() EnumRanges
+
isEnumDescriptor
}
type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
diff --git a/reflect/prototype/desc_test.go b/reflect/prototype/desc_test.go
index a8f956e..a071a10 100644
--- a/reflect/prototype/desc_test.go
+++ b/reflect/prototype/desc_test.go
@@ -26,11 +26,13 @@
[]pref.FileImports{(*fileImports)(nil)},
[]pref.MessageDescriptors{(*messages)(nil)},
+ []pref.Names{(*names)(nil)},
[]pref.FieldNumbers{(*numbers)(nil)},
- []pref.FieldRanges{(*ranges)(nil)},
+ []pref.FieldRanges{(*fieldRanges)(nil)},
[]pref.FieldDescriptors{(*fields)(nil), (*oneofFields)(nil)},
[]pref.OneofDescriptors{(*oneofs)(nil)},
[]pref.ExtensionDescriptors{(*extensions)(nil)},
+ []pref.EnumRanges{(*enumRanges)(nil)},
[]pref.EnumDescriptors{(*enums)(nil)},
[]pref.EnumValueDescriptors{(*enumValues)(nil)},
[]pref.ServiceDescriptors{(*services)(nil)},
diff --git a/reflect/prototype/placeholder_type.go b/reflect/prototype/placeholder_type.go
index 761c600..57fc620 100644
--- a/reflect/prototype/placeholder_type.go
+++ b/reflect/prototype/placeholder_type.go
@@ -13,16 +13,18 @@
)
var (
- emptyFiles fileImports
- emptyMessages messages
- emptyFields fields
- emptyOneofs oneofs
- emptyNumbers numbers
- emptyRanges ranges
- emptyEnums enums
- emptyEnumValues enumValues
- emptyExtensions extensions
- emptyServices services
+ emptyFiles fileImports
+ emptyMessages messages
+ emptyFields fields
+ emptyOneofs oneofs
+ emptyNames names
+ emptyNumbers numbers
+ emptyFieldRanges fieldRanges
+ emptyEnums enums
+ emptyEnumValues enumValues
+ emptyEnumRanges enumRanges
+ emptyExtensions extensions
+ emptyServices services
)
type placeholderName pref.FullName
@@ -61,8 +63,10 @@
func (t placeholderMessage) IsMapEntry() bool { return false }
func (t placeholderMessage) Fields() pref.FieldDescriptors { return &emptyFields }
func (t placeholderMessage) Oneofs() pref.OneofDescriptors { return &emptyOneofs }
+func (t placeholderMessage) ReservedNames() pref.Names { return &emptyNames }
+func (t placeholderMessage) ReservedRanges() pref.FieldRanges { return &emptyFieldRanges }
func (t placeholderMessage) RequiredNumbers() pref.FieldNumbers { return &emptyNumbers }
-func (t placeholderMessage) ExtensionRanges() pref.FieldRanges { return &emptyRanges }
+func (t placeholderMessage) ExtensionRanges() pref.FieldRanges { return &emptyFieldRanges }
func (t placeholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("out of bounds") }
func (t placeholderMessage) Enums() pref.EnumDescriptors { return &emptyEnums }
func (t placeholderMessage) Messages() pref.MessageDescriptors { return &emptyMessages }
@@ -76,5 +80,7 @@
func (t placeholderEnum) Options() pref.ProtoMessage { return optionTypes.Enum }
func (t placeholderEnum) Values() pref.EnumValueDescriptors { return &emptyEnumValues }
+func (t placeholderEnum) ReservedNames() pref.Names { return &emptyNames }
+func (t placeholderEnum) ReservedRanges() pref.EnumRanges { return &emptyEnumRanges }
func (t placeholderEnum) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t placeholderEnum) ProtoType(pref.EnumDescriptor) {}
diff --git a/reflect/prototype/protofile.go b/reflect/prototype/protofile.go
index d2f68c0..d7dca23 100644
--- a/reflect/prototype/protofile.go
+++ b/reflect/prototype/protofile.go
@@ -98,6 +98,8 @@
Name protoreflect.Name
Fields []Field
Oneofs []Oneof
+ ReservedNames []protoreflect.Name
+ ReservedRanges [][2]protoreflect.FieldNumber
ExtensionRanges [][2]protoreflect.FieldNumber
ExtensionRangeOptions []protoreflect.ProtoMessage
Options protoreflect.ProtoMessage
@@ -158,9 +160,11 @@
// Enum is a constructor for protoreflect.EnumDescriptor.
type Enum struct {
- Name protoreflect.Name
- Values []EnumValue
- Options protoreflect.ProtoMessage
+ Name protoreflect.Name
+ Values []EnumValue
+ ReservedNames []protoreflect.Name
+ ReservedRanges [][2]protoreflect.EnumNumber
+ Options protoreflect.ProtoMessage
*enumMeta
}
diff --git a/reflect/prototype/protofile_list.go b/reflect/prototype/protofile_list.go
index 0b3b5ba..188be49 100644
--- a/reflect/prototype/protofile_list.go
+++ b/reflect/prototype/protofile_list.go
@@ -14,6 +14,21 @@
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
+type names []pref.Name
+
+func (p *names) Len() int { return len(*p) }
+func (p *names) Get(i int) pref.Name { return (*p)[i] }
+func (p *names) Has(s pref.Name) bool {
+ for _, n := range *p {
+ if s == n {
+ return true
+ }
+ }
+ return false
+}
+func (p *names) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
+func (p *names) ProtoInternal(pragma.DoNotImplement) {}
+
type numbersMeta struct {
once sync.Once
ns []pref.FieldNumber
@@ -38,11 +53,11 @@
func (p *numbers) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *numbers) ProtoInternal(pragma.DoNotImplement) {}
-type ranges [][2]pref.FieldNumber
+type fieldRanges [][2]pref.FieldNumber
-func (p *ranges) Len() int { return len(*p) }
-func (p *ranges) Get(i int) [2]pref.FieldNumber { return (*p)[i] }
-func (p *ranges) Has(n pref.FieldNumber) bool {
+func (p *fieldRanges) Len() int { return len(*p) }
+func (p *fieldRanges) Get(i int) [2]pref.FieldNumber { return (*p)[i] }
+func (p *fieldRanges) Has(n pref.FieldNumber) bool {
for _, r := range *p {
if r[0] <= n && n < r[1] {
return true
@@ -50,8 +65,23 @@
}
return false
}
-func (p *ranges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
-func (p *ranges) ProtoInternal(pragma.DoNotImplement) {}
+func (p *fieldRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
+func (p *fieldRanges) ProtoInternal(pragma.DoNotImplement) {}
+
+type enumRanges [][2]pref.EnumNumber
+
+func (p *enumRanges) Len() int { return len(*p) }
+func (p *enumRanges) Get(i int) [2]pref.EnumNumber { return (*p)[i] }
+func (p *enumRanges) Has(n pref.EnumNumber) bool {
+ for _, r := range *p {
+ if r[0] <= n && n <= r[1] {
+ return true
+ }
+ }
+ return false
+}
+func (p *enumRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
+func (p *enumRanges) ProtoInternal(pragma.DoNotImplement) {}
type fileImports []pref.FileImport
diff --git a/reflect/prototype/protofile_type.go b/reflect/prototype/protofile_type.go
index 83b676e..c3ac34c 100644
--- a/reflect/prototype/protofile_type.go
+++ b/reflect/prototype/protofile_type.go
@@ -181,8 +181,10 @@
func (t messageDesc) IsMapEntry() bool { return t.m.mo.lazyInit(t).isMapEntry }
func (t messageDesc) Fields() pref.FieldDescriptors { return t.m.fs.lazyInit(t, t.m.Fields) }
func (t messageDesc) Oneofs() pref.OneofDescriptors { return t.m.os.lazyInit(t, t.m.Oneofs) }
+func (t messageDesc) ReservedNames() pref.Names { return (*names)(&t.m.ReservedNames) }
+func (t messageDesc) ReservedRanges() pref.FieldRanges { return (*fieldRanges)(&t.m.ReservedRanges) }
func (t messageDesc) RequiredNumbers() pref.FieldNumbers { return t.m.ns.lazyInit(t.m.Fields) }
-func (t messageDesc) ExtensionRanges() pref.FieldRanges { return (*ranges)(&t.m.ExtensionRanges) }
+func (t messageDesc) ExtensionRanges() pref.FieldRanges { return (*fieldRanges)(&t.m.ExtensionRanges) }
func (t messageDesc) ExtensionRangeOptions(i int) pref.ProtoMessage {
return extensionRangeOptions(i, len(t.m.ExtensionRanges), t.m.ExtensionRangeOptions)
}
@@ -246,13 +248,14 @@
func (t fieldDesc) Number() pref.FieldNumber { return t.f.Number }
func (t fieldDesc) Cardinality() pref.Cardinality { return t.f.Cardinality }
func (t fieldDesc) Kind() pref.Kind { return t.f.Kind }
+func (t fieldDesc) HasJSONName() bool { return t.f.JSONName != "" }
func (t fieldDesc) JSONName() string { return t.f.js.lazyInit(t.f) }
func (t fieldDesc) IsPacked() bool { return t.f.fo.lazyInit(t).isPacked }
func (t fieldDesc) IsWeak() bool { return t.f.fo.lazyInit(t).isWeak }
func (t fieldDesc) IsMap() bool { return t.f.fo.lazyInit(t).isMap }
+func (t fieldDesc) HasDefault() bool { return t.f.Default.IsValid() }
func (t fieldDesc) Default() pref.Value { return t.f.dv.value(t, t.f.Default) }
func (t fieldDesc) DefaultEnumValue() pref.EnumValueDescriptor { return t.f.dv.enum(t, t.f.Default) }
-func (t fieldDesc) HasDefault() bool { return t.f.Default.IsValid() }
func (t fieldDesc) OneofType() pref.OneofDescriptor { return t.f.ot.lazyInit(t, t.f.OneofName) }
func (t fieldDesc) ExtendedType() pref.MessageDescriptor { return nil }
func (t fieldDesc) MessageType() pref.MessageDescriptor { return t.f.mt.lazyInit(t, &t.f.MessageType) }
@@ -261,13 +264,17 @@
func (t fieldDesc) ProtoType(pref.FieldDescriptor) {}
func (t fieldDesc) ProtoInternal(pragma.DoNotImplement) {}
-type jsonName struct{ once sync.Once }
+type jsonName struct {
+ once sync.Once
+ name string
+}
func (p *jsonName) lazyInit(f *Field) string {
p.once.Do(func() {
// TODO: We may need to share this logic with jsonpb for implementation
// of the FieldMask well-known type.
if f.JSONName != "" {
+ p.name = f.JSONName
return
}
var b []byte
@@ -283,9 +290,9 @@
}
wasUnderscore = c == '_'
}
- f.JSONName = string(b)
+ p.name = string(b)
})
- return f.JSONName
+ return p.name
}
// oneofReference resolves the name of a oneof by searching the parent
@@ -418,13 +425,14 @@
func (t extensionDesc) Number() pref.FieldNumber { return t.x.Number }
func (t extensionDesc) Cardinality() pref.Cardinality { return t.x.Cardinality }
func (t extensionDesc) Kind() pref.Kind { return t.x.Kind }
+func (t extensionDesc) HasJSONName() bool { return false }
func (t extensionDesc) JSONName() string { return "" }
func (t extensionDesc) IsPacked() bool { return isPacked(t.Options()) }
func (t extensionDesc) IsWeak() bool { return false }
func (t extensionDesc) IsMap() bool { return false }
+func (t extensionDesc) HasDefault() bool { return t.x.Default.IsValid() }
func (t extensionDesc) Default() pref.Value { return t.x.dv.value(t, t.x.Default) }
func (t extensionDesc) DefaultEnumValue() pref.EnumValueDescriptor { return t.x.dv.enum(t, t.x.Default) }
-func (t extensionDesc) HasDefault() bool { return t.x.Default.IsValid() }
func (t extensionDesc) OneofType() pref.OneofDescriptor { return nil }
func (t extensionDesc) ExtendedType() pref.MessageDescriptor {
return t.x.xt.lazyInit(t, &t.x.ExtendedType)
@@ -453,6 +461,8 @@
func (t enumDesc) DescriptorProto() (pref.Message, bool) { return nil, false }
func (t enumDesc) Options() pref.ProtoMessage { return altOptions(t.e.Options, optionTypes.Enum) }
func (t enumDesc) Values() pref.EnumValueDescriptors { return t.e.vs.lazyInit(t, t.e.Values) }
+func (t enumDesc) ReservedNames() pref.Names { return (*names)(&t.e.ReservedNames) }
+func (t enumDesc) ReservedRanges() pref.EnumRanges { return (*enumRanges)(&t.e.ReservedRanges) }
func (t enumDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t enumDesc) ProtoType(pref.EnumDescriptor) {}
func (t enumDesc) ProtoInternal(pragma.DoNotImplement) {}
diff --git a/reflect/prototype/standalone.go b/reflect/prototype/standalone.go
index b9f6b5e..c934c5c 100644
--- a/reflect/prototype/standalone.go
+++ b/reflect/prototype/standalone.go
@@ -19,6 +19,8 @@
FullName protoreflect.FullName
Fields []Field
Oneofs []Oneof
+ ReservedNames []protoreflect.Name
+ ReservedRanges [][2]protoreflect.FieldNumber
ExtensionRanges [][2]protoreflect.FieldNumber
ExtensionRangeOptions []protoreflect.ProtoMessage
Options protoreflect.ProtoMessage
@@ -83,10 +85,12 @@
// StandaloneEnum is a constructor for a protoreflect.EnumDescriptor
// that does not have a parent.
type StandaloneEnum struct {
- Syntax protoreflect.Syntax
- FullName protoreflect.FullName
- Values []EnumValue
- Options protoreflect.ProtoMessage
+ Syntax protoreflect.Syntax
+ FullName protoreflect.FullName
+ Values []EnumValue
+ ReservedNames []protoreflect.Name
+ ReservedRanges [][2]protoreflect.EnumNumber
+ Options protoreflect.ProtoMessage
vals enumValuesMeta
}
diff --git a/reflect/prototype/standalone_type.go b/reflect/prototype/standalone_type.go
index 041cc1a..e1fea48 100644
--- a/reflect/prototype/standalone_type.go
+++ b/reflect/prototype/standalone_type.go
@@ -24,11 +24,17 @@
func (t standaloneMessage) Options() pref.ProtoMessage {
return altOptions(t.m.Options, optionTypes.Message)
}
-func (t standaloneMessage) IsMapEntry() bool { return t.m.options.lazyInit(t).isMapEntry }
-func (t standaloneMessage) Fields() pref.FieldDescriptors { return t.m.fields.lazyInit(t, t.m.Fields) }
-func (t standaloneMessage) Oneofs() pref.OneofDescriptors { return t.m.oneofs.lazyInit(t, t.m.Oneofs) }
+func (t standaloneMessage) IsMapEntry() bool { return t.m.options.lazyInit(t).isMapEntry }
+func (t standaloneMessage) Fields() pref.FieldDescriptors { return t.m.fields.lazyInit(t, t.m.Fields) }
+func (t standaloneMessage) Oneofs() pref.OneofDescriptors { return t.m.oneofs.lazyInit(t, t.m.Oneofs) }
+func (t standaloneMessage) ReservedNames() pref.Names { return (*names)(&t.m.ReservedNames) }
+func (t standaloneMessage) ReservedRanges() pref.FieldRanges {
+ return (*fieldRanges)(&t.m.ReservedRanges)
+}
func (t standaloneMessage) RequiredNumbers() pref.FieldNumbers { return t.m.nums.lazyInit(t.m.Fields) }
-func (t standaloneMessage) ExtensionRanges() pref.FieldRanges { return (*ranges)(&t.m.ExtensionRanges) }
+func (t standaloneMessage) ExtensionRanges() pref.FieldRanges {
+ return (*fieldRanges)(&t.m.ExtensionRanges)
+}
func (t standaloneMessage) ExtensionRangeOptions(i int) pref.ProtoMessage {
return extensionRangeOptions(i, len(t.m.ExtensionRanges), t.m.ExtensionRangeOptions)
}
@@ -50,6 +56,8 @@
func (t standaloneEnum) DescriptorProto() (pref.Message, bool) { return nil, false }
func (t standaloneEnum) Options() pref.ProtoMessage { return altOptions(t.e.Options, optionTypes.Enum) }
func (t standaloneEnum) Values() pref.EnumValueDescriptors { return t.e.vals.lazyInit(t, t.e.Values) }
+func (t standaloneEnum) ReservedNames() pref.Names { return (*names)(&t.e.ReservedNames) }
+func (t standaloneEnum) ReservedRanges() pref.EnumRanges { return (*enumRanges)(&t.e.ReservedRanges) }
func (t standaloneEnum) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t standaloneEnum) ProtoType(pref.EnumDescriptor) {}
func (t standaloneEnum) ProtoInternal(pragma.DoNotImplement) {}
@@ -69,15 +77,16 @@
func (t standaloneExtension) Number() pref.FieldNumber { return t.x.Number }
func (t standaloneExtension) Cardinality() pref.Cardinality { return t.x.Cardinality }
func (t standaloneExtension) Kind() pref.Kind { return t.x.Kind }
+func (t standaloneExtension) HasJSONName() bool { return false }
func (t standaloneExtension) JSONName() string { return "" }
func (t standaloneExtension) IsPacked() bool { return isPacked(t.Options()) }
func (t standaloneExtension) IsWeak() bool { return false }
func (t standaloneExtension) IsMap() bool { return false }
+func (t standaloneExtension) HasDefault() bool { return t.x.Default.IsValid() }
func (t standaloneExtension) Default() pref.Value { return t.x.dv.value(t, t.x.Default) }
func (t standaloneExtension) DefaultEnumValue() pref.EnumValueDescriptor {
return t.x.dv.enum(t, t.x.Default)
}
-func (t standaloneExtension) HasDefault() bool { return t.x.Default.IsValid() }
func (t standaloneExtension) OneofType() pref.OneofDescriptor { return nil }
func (t standaloneExtension) MessageType() pref.MessageDescriptor { return t.x.MessageType }
func (t standaloneExtension) EnumType() pref.EnumDescriptor { return t.x.EnumType }
diff --git a/reflect/prototype/type_test.go b/reflect/prototype/type_test.go
index e82fae7..4bac6c6 100644
--- a/reflect/prototype/type_test.go
+++ b/reflect/prototype/type_test.go
@@ -109,6 +109,8 @@
},
{Name: "O2"}, // "test.B.O2"
},
+ ReservedNames: []pref.Name{"fizz", "buzz"},
+ ReservedRanges: [][2]pref.FieldNumber{{100, 200}, {300, 301}},
ExtensionRanges: [][2]pref.FieldNumber{{1000, 2000}, {3000, 3001}},
ExtensionRangeOptions: []pref.ProtoMessage{
0: (*descriptorpb.ExtensionRangeOptions)(nil),
@@ -145,6 +147,8 @@
},
{Name: "BAR", Number: 1},
},
+ ReservedNames: []pref.Name{"FIZZ", "BUZZ"},
+ ReservedRanges: [][2]pref.EnumNumber{{10, 19}, {30, 30}},
}},
Extensions: []ptype.Extension{{
Name: "X", // "test.X"
@@ -252,6 +256,11 @@
},
{Name: scalar.String("O2")},
},
+ ReservedName: []string{"fizz", "buzz"},
+ ReservedRange: []*descriptorpb.DescriptorProto_ReservedRange{
+ {Start: scalar.Int32(100), End: scalar.Int32(200)},
+ {Start: scalar.Int32(300), End: scalar.Int32(301)},
+ },
ExtensionRange: []*descriptorpb.DescriptorProto_ExtensionRange{
{Start: scalar.Int32(1000), End: scalar.Int32(2000)},
{Start: scalar.Int32(3000), End: scalar.Int32(3001), Options: new(descriptorpb.ExtensionRangeOptions)},
@@ -295,6 +304,11 @@
},
{Name: scalar.String("BAR"), Number: scalar.Int32(1)},
},
+ ReservedName: []string{"FIZZ", "BUZZ"},
+ ReservedRange: []*descriptorpb.EnumDescriptorProto_EnumReservedRange{
+ {Start: scalar.Int32(10), End: scalar.Int32(19)},
+ {Start: scalar.Int32(30), End: scalar.Int32(30)},
+ },
}},
Extension: []*descriptorpb.FieldDescriptorProto{{
Name: scalar.String("X"),
@@ -381,6 +395,7 @@
"Cardinality": pref.Optional,
"Kind": pref.StringKind,
"Options": &descriptorpb.FieldOptions{Deprecated: scalar.Bool(true)},
+ "HasJSONName": false,
"JSONName": "key",
"IsPacked": false,
"IsMap": false,
@@ -433,11 +448,12 @@
},
"ByJSONName:fieldTwo": nil,
"ByJSONName:Field2": M{
- "Name": pref.Name("field_two"),
- "Index": 1,
- "JSONName": "Field2",
- "Default": pref.EnumNumber(1),
- "OneofType": M{"Name": pref.Name("O2"), "IsPlaceholder": false},
+ "Name": pref.Name("field_two"),
+ "Index": 1,
+ "HasJSONName": true,
+ "JSONName": "Field2",
+ "Default": pref.EnumNumber(1),
+ "OneofType": M{"Name": pref.Name("O2"), "IsPlaceholder": false},
},
"ByName:fieldThree": nil,
"ByName:field_three": M{
@@ -490,6 +506,23 @@
},
},
},
+ "ReservedNames": M{
+ "Len": 2,
+ "Get:0": pref.Name("fizz"),
+ "Has:buzz": true,
+ "Has:noexist": false,
+ },
+ "ReservedRanges": M{
+ "Len": 2,
+ "Get:0": [2]pref.FieldNumber{100, 200},
+ "Has:99": false,
+ "Has:100": true,
+ "Has:150": true,
+ "Has:199": true,
+ "Has:200": false,
+ "Has:300": true,
+ "Has:301": false,
+ },
"RequiredNumbers": M{
"Len": 1,
"Get:0": pref.FieldNumber(6),
@@ -505,6 +538,7 @@
"Has:1999": true,
"Has:2000": false,
"Has:3000": true,
+ "Has:3001": false,
},
"ExtensionRangeOptions:0": (*descriptorpb.ExtensionRangeOptions)(nil),
"ExtensionRangeOptions:1": new(descriptorpb.ExtensionRangeOptions),
@@ -541,6 +575,23 @@
"ByNumber:2": nil,
"ByNumber:1": M{"FullName": pref.FullName("test.BAR")},
},
+ "ReservedNames": M{
+ "Len": 2,
+ "Get:0": pref.Name("FIZZ"),
+ "Has:BUZZ": true,
+ "Has:NOEXIST": false,
+ },
+ "ReservedRanges": M{
+ "Len": 2,
+ "Get:0": [2]pref.EnumNumber{10, 19},
+ "Has:9": false,
+ "Has:10": true,
+ "Has:15": true,
+ "Has:19": true,
+ "Has:20": false,
+ "Has:30": true,
+ "Has:31": false,
+ },
},
},
"Extensions": M{
@@ -718,6 +769,7 @@
Number: 2
Cardinality: optional
Kind: enum
+ HasJSONName: true
JSONName: "Field2"
HasDefault: true
Default: 1
@@ -736,6 +788,7 @@
Number: 4
Cardinality: repeated
Kind: message
+ HasJSONName: true
JSONName: "Field4"
IsMap: true
MessageType: test.A
@@ -760,6 +813,8 @@
Name: O2
Fields: [field_two, field_three]
}]
+ ReservedNames: [fizz, buzz]
+ ReservedRanges: [100:200, 300]
RequiredNumbers: [6]
ExtensionRanges: [1000:2000, 3000]
}, {
@@ -799,6 +854,8 @@
{Name: FOO}
{Name: BAR, Number: 1}
]
+ ReservedNames: [FIZZ, BUZZ]
+ ReservedRanges: [10:20, 30]
}]
Extensions: [{
Name: X
diff --git a/types/descriptor/descriptor.pb.go b/types/descriptor/descriptor.pb.go
index e91475d..08611a4 100644
--- a/types/descriptor/descriptor.pb.go
+++ b/types/descriptor/descriptor.pb.go
@@ -3911,6 +3911,7 @@
JSONName: "uninterpretedOption",
},
},
+ ReservedRanges: [][2]protoreflect.FieldNumber{{38, 39}},
ExtensionRanges: [][2]protoreflect.FieldNumber{{1000, 536870912}},
},
{
@@ -3955,6 +3956,7 @@
JSONName: "uninterpretedOption",
},
},
+ ReservedRanges: [][2]protoreflect.FieldNumber{{8, 9}, {9, 10}},
ExtensionRanges: [][2]protoreflect.FieldNumber{{1000, 536870912}},
},
{
@@ -4015,6 +4017,7 @@
JSONName: "uninterpretedOption",
},
},
+ ReservedRanges: [][2]protoreflect.FieldNumber{{4, 5}},
ExtensionRanges: [][2]protoreflect.FieldNumber{{1000, 536870912}},
},
{
@@ -4056,6 +4059,7 @@
JSONName: "uninterpretedOption",
},
},
+ ReservedRanges: [][2]protoreflect.FieldNumber{{5, 6}},
ExtensionRanges: [][2]protoreflect.FieldNumber{{1000, 536870912}},
},
{