Skip to content

Releases: bufbuild/protovalidate-go

v0.9.2

12 Feb 17:05
1f18b86
Compare
Choose a tag to compare

What's Changed

This release fixes a bug where predefined rules may have their rule values cached inappropriately across invocations. Also, URI validation was fixed to ensure the query string does not contain invalid characters.

New Contributors

Full Changelog: v0.9.1...v0.9.2

v0.9.1

31 Jan 18:09
107b51b
Compare
Choose a tag to compare

This is a quick follow-on to v0.9.0. A mistake was made and the parameter type for FieldPathString changed unintentionally. It has been fixed.

Breaking Changes

v0.9.x removes support for the long-deprecated ignore_empty and skipped fields on FieldConstraints; protovalidate-go will no longer respect these options if they are set, and they are removed from the latest version of the protovalidate definitions.

Legacy resolution of protoc-gen-validate rules is removed. The resolver package is moved to resolve and now contains free functions instead of an interface. The celext package was moved to cel; it exports the same functionality, but has been refactored, with some method names changing, and the celext.DefaultEnv function has been replaced with cel.NewLibrary.

protovalidate.Validator is now an interface and not a struct. Pointers of type *protovalidate.Validator should be changed to protovalidate.Validator values instead.

What's Changed

Full Changelog: v0.9.0...v0.9.1

v0.9.0

31 Jan 17:53
4459217
Compare
Choose a tag to compare

Breaking Changes

This release removes support for the long-deprecated ignore_empty and skipped fields on FieldConstraints; protovalidate-go will no longer respect these options if they are set, and they are removed from the latest version of the protovalidate definitions.

Legacy resolution of protoc-gen-validate rules is removed. The resolver package is moved to resolve and now contains free functions instead of an interface. The celext package was moved to cel; it exports the same functionality, but has been refactored, with some method names changing, and the celext.DefaultEnv function has been replaced with cel.NewLibrary.

protovalidate.Validator is now an interface and not a struct. Pointers of type *protovalidate.Validator should be changed to protovalidate.Validator values instead.

What's Changed

Full Changelog: v0.8.2...v0.9.0

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 Changes

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