panache-data-rest and beanValidation with @AssertTrue and Boolean types #48055
Answered
by
marko-bekhta
akil-rails
asked this question in
Q&A
-
Is it expected that Boolean return types with @AssertTrue dont result in validation errors ? The below does not raise a validation error
but the below does raise a validation error (only change is boolean instead of Boolean)
The javadoc says that @AssertTrue works for both Boolean and boolean
|
Beta Was this translation helpful? Give feedback.
Answered by
marko-bekhta
May 26, 2025
Replies: 1 comment 3 replies
-
/cc @FroMage (panache), @loicmathieu (panache) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes ... the big boolean is considered an object and hence it is expected that a
getXXX
is used for its getter, andisXXX
is only applicable if the return type is a primitiveboolean
:https://github.com/hibernate/hibernate-validator/blob/4b8969ca22bc6df00173994168a31f57c88249b8/engine/src/main/java/org/hibernate/validator/internal/properties/DefaultGetterPropertySelectionStrategy.java#L81-L102 ( see also the javadoc above this method)
so in other words, Hibernate Validator does not consider
Boolean isValid()
to be a getter method and ignores it when it comes to validating bean properties.