Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protovalidate-go to work with 0.6.1 protos #101

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
checkpoint
  • Loading branch information
rodaine committed Feb 26, 2024
commit 3970376648b7d6b57f8a9d723b672b26bf973520
10 changes: 5 additions & 5 deletions internal/evaluator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ func (bldr *Builder) processIgnoreEmpty(
val.IgnoreEmpty = forItems && (constraints.GetIgnoreEmpty() ||
constraints.GetIgnore() == validate.Ignore_IGNORE_IF_UNPOPULATED ||
constraints.GetIgnore() == validate.Ignore_IGNORE_IF_DEFAULT_VALUE)
if !val.IgnoreEmpty {
switch {
case !val.IgnoreEmpty:
// only need the zero value for checking ignore_empty constraint
return nil
}
if fdesc.IsList() {
case fdesc.IsList():
msg := dynamicpb.NewMessage(fdesc.ContainingMessage())
val.Zero = msg.Get(fdesc).List().NewElement()
} else if fdesc.Kind() == protoreflect.MessageKind {
case fdesc.Kind() == protoreflect.MessageKind:
msg := dynamicpb.NewMessage(fdesc.Message())
val.Zero = protoreflect.ValueOfMessage(msg)
} else {
default:
val.Zero = fdesc.Default()
}
return nil
Expand Down
Loading