Skip to content

v0.12.0

Latest
Compare
Choose a tag to compare
@smaye81 smaye81 released this 18 Jun 19:27
· 2 commits to main since this release
3cfbfb3

Breaking Changes

New API for creating a validator and running validation.

Users can now specify a Config object when explicitly creating a validator, allowing for configuring validation logic. Currently, the two available options are:

fail_fast (bool): If True, validation stops after the first failure.
regex_matches_func (Callable[[str, str], bool): An optional function for overriding this library's matches logic for regular expressions.

Example:

from protovalidate import Config, Validator

cfg = Config(fail_fast=True)
validator = protovalidate.Validator(config=cfg)

validator.validate(msg)

As a result of the above, we have removed the fail_fast parameter from the validate and collect_violations methods on a validator. Users should instead use the above config approach.

Flagging invalid re2 syntax

Usage of invalid re2 syntax will now throw an evaluation error. While the CEL spec specifies that regular expressions should follow the re2 syntax, the underlying regex engine in protovalidate-python is still Python's re package. This is because there is currently no pre-built binary that supports Python 3.13 (issue).

So, to get as close as possible until then, we are flagging invalid re2 syntax used in regular expressions. Users can also choose to override this and bring their own re2 engine by using the config approach above.

What's Changed

  • Add ability to specify custom regex matcher by @smaye81 in #325
  • Add the ability to specify a config to validators by @smaye81 in #323
  • Implement matches override by @smaye81 in #319

This release is compatible with protovalidate v0.13.3.

Full Changelog: v0.11.0...v0.12.0