-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rule and field value to violations (#224)
Adds the ability to access the captured rule and field value from a `Violation`. **This is a breaking change.** The API changes in the following ways: - `ValidationError` has changed: - Old accesses to `ValidationError.violations` should call `ValidationError.to_proto()` instead, to get a `buf.validate.Violations` message. - `ValidationError.errors` was removed. Switch to using `ValidationError.violations` instead. - `ValidationError.violations` provides a list of the new `Violation` wrapper type instead of a list of `buf.validate.Violation`. - The new `Violation` wrapper type contains the `buf.validate.Violation` message under the `proto` field, as well as `field_value` and `rule_value` properties that capture the field and rule values, respectively. - `Validator.collect_violations` now operates on and returns `list[Violation]` instead of the protobuf `buf.validate.Violations` message. This API mirrors the changes being made in protovalidate-go in bufbuild/protovalidate-go#154.
- Loading branch information
1 parent
41a4661
commit 5e6ac7b
Showing
4 changed files
with
135 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.