-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add field and rule value to violations (#64)
Adds the ability to access the captured rule and field value from a Violation. C++ protobuf doesn't really have a native "value" representation unlike other languages, so I've created a sort-of stand-in. The `ProtoField` class acts as a reference to a field on a message, and provides an interface to get a singular value as a `variant`. This should be good enough for most users, but users can also grab the information needed and use protobuf reflection directly instead if they have more complicated needs. **This is a breaking change.** The API changes in the following ways: - `Validator::Validate()` now returns the wrapper type `ValidationResult` instead of `Violations`. This can be converted into the protobuf `Violations` form using the `proto()` method. - `ValidationResult.violations()` returns a `ConstraintViolation`. The underlying `Violation` can be accessed using the `proto()` method.
- Loading branch information
1 parent
261b5b1
commit 15d5717
Showing
11 changed files
with
476 additions
and
153 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
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.