Skip to content

Releases: bufbuild/protovalidate-java

v1.0.0-rc.2

11 Jun 20:34
636af52

Choose a tag to compare

What's Changed

Full Changelog: v1.0.0-rc.1...v1.0.0-rc.2

v1.0.0-rc.1

09 Jun 18:13
11f1232

Choose a tag to compare

This is the first release candidate for protovalidate-java.

Full Changelog: v0.10.0...v1.0.0-rc.1

v0.10.0

09 Jun 16:18
f17fd65

Choose a tag to compare

What's Changed

The underlying CEL implementation used by protovalidate-java has been changed to Google's cel-java. There are no breaking changes as a result and all modifications should be internal to this library.

Full Changelog: v0.9.1...v0.10.0

v0.9.1

04 Jun 16:36
ed6392d

Choose a tag to compare

What's Changed

This is a maintenance update that includes an important bug fix: in some situations, the CEL environment does not correctly get populated with its dependencies; specifically, when an expression refers to a submessage whose dependency is in a non-public import, it will not be added to the CEL environment.

  • Update to protovalidate 0.12.0 by @smaye81 in #301
  • Implement workaround for cel-java import issue by @jchadwick-buf in #302

Full Changelog: 0.9.0...v0.9.1

v0.9.0

02 Jun 20:48
8342d2c

Choose a tag to compare

Breaking Changes

String formatting is now conformant with the CEL spec.

As a result, some formatting output may differ from previous versions. See #293, #294, and #295 for details on formatting changes.

What's Changed

  • Fix overload declaration for format by @smaye81 in #295
  • Add supplemental format conformance tests by @smaye81 in #294
  • Add conformance testing to string.format implementation by @smaye81 in #293

Full Changelog: v0.8.0...v0.9.0

v0.8.0

14 May 17:51
94f2c28

Choose a tag to compare

Breaking Changes

New API for creating a validator.

Validators are now created via ValidatorFactory using a builder pattern. To migrate, users should make the following changes:

With no config

import build.buf.protovalidate.Validator;
+ import build.buf.protovalidate.ValidatorFactory;

- Validator validator = new Validator();
+ Validator validator = ValidatorFactory.newBuilder().build();

With config

import build.buf.protovalidate.Validator;
+ import build.buf.protovalidate.ValidatorFactory;

Config cfg = Config.newBuilder().setFailFast(true).build();
- Validator validator = new Validator(cfg);
+ Validator validator = ValidatorFactory.newBuilder().withConfig(cfg).build();

Also note that the returned type is an interface (still named Validator) and no longer a concrete class.

In addition to the above change, users can now seed the validator with descriptors for warming up the cache. To do so, use the buildWithDescriptors method on the builder. The signature is:

buildWithDescriptors(List<Descriptor>, boolean disableLazy) throws CompilationException, InvalidStateException;

An example creating a validator with seed descriptors:

MyMessage msg = MyMessage.newBuilder().build();
List<Descriptor> seedDescriptors = new ArrayList<Descriptor>();
seedDescriptors.add(msg.getDescriptorForType());

try {
    Validator validator = ValidatorFactory.newBuilder().buildWithDescriptors(seedDescriptors, false);

    // Note you can also create a validator with a config
    // Validator validator = ValidatorFactory.newBuilder().withConfig(cfg).buildWithDescriptors(seedDescriptors, false);

    // Also note that the buildWithDescriptors function is what throws the exception so the validator 
    // builder can be created ahead of time with no need for catching an exception.
} catch (CompilationException ce) {
    // Exception pre-warming the cache with the seed descriptors
} catch (IllegalStateException ise) {
    // This is thrown if seedDescriptors is empty and disableLazy is true
}

For more context on the changes, see PR #283.

ValidationResult.toString output changed

The toString method of ValidationResult will now print Validation OK if there are no violations. Previously, this text was always Validation error: regardless of whether there were any actual violations.

Protovalidate Compatibility

This release is compatible with Protovalidate v0.11.1.

What's Changed

  • Refactor validator creation to support various configurations by @smaye81 in #283
  • Fix operator in ValidationResult toString by @smaye81 in #286
  • Upgrade to Protovalidate 0.11.1 by @smaye81 in #287

Full Changelog: v0.7.2...v0.8.0

v0.7.2

09 May 16:26
d71d6bc

Choose a tag to compare

What's Changed

Full Changelog: v0.7.1...v0.7.2

v0.7.1

09 May 16:04
bf50d4b

Choose a tag to compare

What's Changed

Full Changelog: v0.7.0...v0.7.1

v0.7.0

01 May 19:05
ffe0dd3

Choose a tag to compare

Breaking Changes

  • The most notable change is that the validation for IP addresses and prefixes (both v4 and v6), email addresses, and URIs has been significantly enhanced to adhere to the relevant RFCs for each. Note that these tighter validations result in breaking changes as some previously-passing values may now be failures. Additionally, with regards to string.email/isEmail validation, we no longer follow RFC 5322 and instead use the HTML standard's definition for valid email addresses.

    • For more context on the validation changes and conformance tests added, see the corresponding PR in Protovalidate: bufbuild/protovalidate#320.

    • For full details of the validation changes as they apply to protovalidate-java, see #258.

  • In addition, all references to the usage of constraint have been changed to rule. Previously, these were used interchangeably which led to some confusion. The v0.11.0 release of Protovalidate contains this full rename, which necessitated the change in protovalidate-java and was implemented in #273. As a result, any reference to constraint in code will need to be changed to rule.

What's Changed

This release is compatible with Protovalidate v0.11.0.

Full Changelog: v0.6.0...v0.7.0

v0.6.0

21 Mar 16:15
5f31126

Choose a tag to compare

Breaking Changes

The internal package has been removed. The APIs exposed in internal were never considered to be public, but were nonetheless possible for external packages to import. This is no longer possible. If you were relying on an API that was exposed via internal, please file an issue.

What's Changed

New Contributors

Full Changelog: v0.5.0...v0.6.0