Sorry, didn't find better place to ask so is anyon...
# announcements
j
Sorry, didn't find better place to ask so is anyone familiar with hibernate-validator causing problem javax.validation.ConstraintDeclarationException: 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 when Kotlin delegate interface is used? I tried to look decompiled source but I'm still not sure what is causing this
Copy code
class TypeToValidate(
    val foo: String,
    val interfaceWithValidations: ValidationInterface
) : ValidationInterface by interfaceWithValidations

class Bar(@NotBlank val barName: String)

interface ValidationInterface {

    @get:Valid
    val bar: Bar

    @AssertTrue
    fun someValidationFunction(): Boolean {
        return true
    }
}

class ValidationDelegate(override val bar: Bar) : ValidationInterface
Copy code
validator.validate(
            TypeToValidate("foo", ValidationDelegate(Bar(" ")))
        )
javax.validation.ConstraintDeclarationException: 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: TypeToValidate#getBar(), ValidationInterface#getBar().
Managed to work-around using
Copy code
HibernateValidatorConfiguration configuration = Validation.byProvider( HibernateValidator.class ).configure();

configuration.allowMultipleCascadedValidationOnReturnValues( true )
guess there is no other solution