Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
751 stars 53 forks source link

Withers ConstraintDeclarationException #97

Closed nikolavojicic closed 2 years ago

nikolavojicic commented 2 years ago

When I want to validate a record as a field of another record which implements With interface, the javax.validation.ConstraintDeclarationException is thrown.

Repro:

@RecordBuilder
public record Request(

  @NotNull
  @Valid
  Part part)

  implements RequestBuilder.With {

  public record Part(@NotBlank String name) {}

}

Error message:

HV000131: A method return value must not be marked for cascaded validation more than once in a class hierarchy, but the following two methods are marked as such: Request#part(), With#part().

It works without With.