build(deps): bump google.golang.org/protobuf from 1.31.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0. --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
d9815da9cb
commit
cb2b51cac9
59 changed files with 3773 additions and 1103 deletions
38
vendor/google.golang.org/protobuf/encoding/protojson/decode.go
generated
vendored
38
vendor/google.golang.org/protobuf/encoding/protojson/decode.go
generated
vendored
|
@ -11,6 +11,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/encoding/json"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
|
@ -23,7 +24,7 @@ import (
|
|||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
// Unmarshal reads the given []byte into the given proto.Message.
|
||||
// Unmarshal reads the given []byte into the given [proto.Message].
|
||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||
func Unmarshal(b []byte, m proto.Message) error {
|
||||
return UnmarshalOptions{}.Unmarshal(b, m)
|
||||
|
@ -37,7 +38,7 @@ type UnmarshalOptions struct {
|
|||
// required fields will not return an error.
|
||||
AllowPartial bool
|
||||
|
||||
// If DiscardUnknown is set, unknown fields are ignored.
|
||||
// If DiscardUnknown is set, unknown fields and enum name values are ignored.
|
||||
DiscardUnknown bool
|
||||
|
||||
// Resolver is used for looking up types when unmarshaling
|
||||
|
@ -47,9 +48,13 @@ type UnmarshalOptions struct {
|
|||
protoregistry.MessageTypeResolver
|
||||
protoregistry.ExtensionTypeResolver
|
||||
}
|
||||
|
||||
// RecursionLimit limits how deeply messages may be nested.
|
||||
// If zero, a default limit is applied.
|
||||
RecursionLimit int
|
||||
}
|
||||
|
||||
// Unmarshal reads the given []byte and populates the given proto.Message
|
||||
// Unmarshal reads the given []byte and populates the given [proto.Message]
|
||||
// using options in the UnmarshalOptions object.
|
||||
// It will clear the message first before setting the fields.
|
||||
// If it returns an error, the given message may be partially set.
|
||||
|
@ -67,6 +72,9 @@ func (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {
|
|||
if o.Resolver == nil {
|
||||
o.Resolver = protoregistry.GlobalTypes
|
||||
}
|
||||
if o.RecursionLimit == 0 {
|
||||
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||
}
|
||||
|
||||
dec := decoder{json.NewDecoder(b), o}
|
||||
if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {
|
||||
|
@ -114,6 +122,10 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
|
|||
|
||||
// unmarshalMessage unmarshals a message into the given protoreflect.Message.
|
||||
func (d decoder) unmarshalMessage(m protoreflect.Message, skipTypeURL bool) error {
|
||||
d.opts.RecursionLimit--
|
||||
if d.opts.RecursionLimit < 0 {
|
||||
return errors.New("exceeded max recursion depth")
|
||||
}
|
||||
if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {
|
||||
return unmarshal(d, m)
|
||||
}
|
||||
|
@ -266,7 +278,9 @@ func (d decoder) unmarshalSingular(m protoreflect.Message, fd protoreflect.Field
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.Set(fd, val)
|
||||
if val.IsValid() {
|
||||
m.Set(fd, val)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -329,7 +343,7 @@ func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.
|
|||
}
|
||||
|
||||
case protoreflect.EnumKind:
|
||||
if v, ok := unmarshalEnum(tok, fd); ok {
|
||||
if v, ok := unmarshalEnum(tok, fd, d.opts.DiscardUnknown); ok {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
|
@ -474,7 +488,7 @@ func unmarshalBytes(tok json.Token) (protoreflect.Value, bool) {
|
|||
return protoreflect.ValueOfBytes(b), true
|
||||
}
|
||||
|
||||
func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflect.Value, bool) {
|
||||
func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor, discardUnknown bool) (protoreflect.Value, bool) {
|
||||
switch tok.Kind() {
|
||||
case json.String:
|
||||
// Lookup EnumNumber based on name.
|
||||
|
@ -482,6 +496,9 @@ func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflec
|
|||
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(s)); enumVal != nil {
|
||||
return protoreflect.ValueOfEnum(enumVal.Number()), true
|
||||
}
|
||||
if discardUnknown {
|
||||
return protoreflect.Value{}, true
|
||||
}
|
||||
|
||||
case json.Number:
|
||||
if n, ok := tok.Int(32); ok {
|
||||
|
@ -542,7 +559,9 @@ func (d decoder) unmarshalList(list protoreflect.List, fd protoreflect.FieldDesc
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
list.Append(val)
|
||||
if val.IsValid() {
|
||||
list.Append(val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,8 +628,9 @@ Loop:
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mmap.Set(pkey, pval)
|
||||
if pval.IsValid() {
|
||||
mmap.Set(pkey, pval)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue