Skip to content

Releases: bufbuild/protovalidate-go

v0.8.2

30 Dec 13:48
9744b53
Compare
Choose a tag to compare

What's Changed

  • Update public proto dep to 1.36.1 by @Alfus in #171

Full Changelog: v0.8.1...v0.8.2

v0.8.1

30 Dec 13:27
5ca2de4
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.8.0...v0.8.1

v0.8.0

12 Dec 16:35
a2088eb
Compare
Choose a tag to compare

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

  • Implement structured field and rule paths, add field and rule values to ValidationErrors by @jchadwick-buf in #154
  • Bump the go group with 2 updates by @dependabot in #161

Full Changelog: v0.7.3...v0.8.0

v0.7.3

18 Nov 17:48
f978a3e
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.7.2...v0.7.3

v0.7.2

02 Oct 19:24
1ca4047
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.7.1...v0.7.2

v0.7.1

30 Sep 23:56
b477f4c
Compare
Choose a tag to compare

What's Changed

  • Fix panic when using a repeated field as a predefined rule by @rodaine in #149

Full Changelog: v0.7.0...v0.7.1

v0.7.0

23 Sep 17:33
ca39053
Compare
Choose a tag to compare

What's Changed

  • Implement predefined field constraints by @jchadwick-buf in #144

    NOTE: This is a breaking change. You will need to update code using the validate.Violation structure, as the fields now use explicit field presence.

Full Changelog: v0.6.5...v0.7.0

v0.6.5

29 Aug 16:52
fc11a84
Compare
Choose a tag to compare

What's Changed

  • Add buf.gen.yaml v2 schema example by @milas in #138
  • Upgrade to support Go 1.23 by @rodaine in #139
  • Remove Go 1.20 support by @rodaine in #140
  • Bugfix: avoid spurious tautology pruning when dealing with certain recursive messages by @rodaine in #142

New Contributors

Full Changelog: v0.6.4...v0.6.5

v0.6.4

15 Aug 16:19
0381aae
Compare
Choose a tag to compare

This release adds support for Protobuf Editions features.

What's Changed

Full Changelog: v0.6.3...v0.6.4

v0.6.3

05 Jul 23:33
f204e44
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.6.2...v0.6.3