Releases: bufbuild/protovalidate-go
v0.9.2
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.
- Validate URI query string encoding by @smaye81 in #183
- Bump github.com/google/cel-go from 0.23.0 to 0.23.2 in the go group by @dependabot in #184
- Bump the go group with 2 updates by @dependabot in #186
- Fix predefined rule value caching behavior by @jchadwick-buf in #188
New Contributors
Full Changelog: v0.9.1...v0.9.2
v0.9.1
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
- Fix FieldPathString parameter type by @jchadwick-buf in #182
Full Changelog: v0.9.0...v0.9.1
v0.9.0
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
- Refactor the API for v1 by @jchadwick-buf in #173
- Bump the go group with 2 updates by @dependabot in #175
- Bump the go group with 2 updates by @dependabot in #176
- Bump the go group with 4 updates by @dependabot in #177
- Remove support for deprecated options by @jchadwick-buf in #178
- Re-export FieldPathString by @jchadwick-buf in #181
Full Changelog: v0.8.2...v0.9.0
v0.8.2
v0.8.1
What's Changed
- Update Buf logo in README by @smallsamantha in #166
- Update to the proto go hybrid API by @Alfus in #168
New Contributors
- @smallsamantha made their first contribution in #166
Full Changelog: v0.8.0...v0.8.1
v0.8.0
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
: Aprotoreflect.Value
containing the value of the field failing validation, if there is a field corresponding to the violation.FieldDescriptor
: Aprotoreflect.FieldDescriptor
corresponding to the field failing validation.RuleValue
: Aprotoreflect.Value
containing the value of the rule failing validation, if there is a rule corresponding to the violation.RuleDescriptor
: Aprotoreflect.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
What's Changed
- Add ResolvePredefinedConstraints method to DefaultResolver by @jchadwick-buf in #151
- Fix repeated predefined rule on repeated field by @jchadwick-buf in #150
Full Changelog: v0.7.2...v0.7.3
v0.7.2
v0.7.1
v0.7.0
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