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

fix(deps): update module github.com/bufbuild/protovalidate-go to v0.8.0 #490

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 16, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/bufbuild/protovalidate-go v0.7.3 -> v0.8.0 age adoption passing confidence

Release Notes

bufbuild/protovalidate-go (github.com/bufbuild/protovalidate-go)

v0.8.0

Compare Source

Breaking Change: The protovalidate.ValidationError type is no longer a protobuf buf.validate.Violations message alias, but a struct containing a slice of protovalidate.Violation instances. In most cases, accessing the Proto member of the violation is all that needs to be done:

     for _, violation := range err.Violations {
-        fmt.Println(violation.GetMessage())
+        fmt.Println(violation.Proto.GetMessage())
     }

protovalidate.ValidationError still has a ToProto() method that returns the protobuf buf.validate.Violations message equivalent.


The new protovalidate.Violation structure contains additional in-memory information about the violation which cannot be serialized to the wire:

  • FieldValue: A protoreflect.Value containing the value of the field failing validation, if there is a field corresponding to the violation.
  • FieldDescriptor: A protoreflect.FieldDescriptor corresponding to the field failing validation.
  • RuleValue: A protoreflect.Value containing the value of the rule failing validation, if there is a rule corresponding to the violation.
  • RuleDescriptor: A protoreflect.FieldDescriptor corresponding to the rule failing validation.

Take, for example, the following protobuf message schema:

message User {
    string email = 1 [(buf.validate.field).string.email = true];
}

If you try to validate the struct pb.User{Email: "invalid"}, the FieldValue will be "invalid" and the RuleValue will be true.

Some violations do not correspond directly to a field, such as a message constraint failure; in these cases, the FieldValue will be an invalid value and the FieldDescriptor will be nil.

What's Changed

Full Changelog: bufbuild/protovalidate-go@v0.7.3...v0.8.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Dec 16, 2024
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. go Pull requests that update Go code labels Dec 16, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.50%. Comparing base (24b77a6) to head (2f0f5f0).
Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@           Coverage Diff           @@
##              2.x     #490   +/-   ##
=======================================
  Coverage   74.50%   74.50%           
=======================================
  Files         111      111           
  Lines        4323     4323           
=======================================
  Hits         3221     3221           
  Misses       1032     1032           
  Partials       70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flc1125 flc1125 merged commit 6f9fb6b into 2.x Dec 17, 2024
9 checks passed
@renovate renovate bot deleted the renovate/github.com-bufbuild-protovalidate-go-0.x branch December 17, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file go Pull requests that update Go code size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant