Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate Validator - Allow customization of the ValidatorFactory #26658

Merged
merged 1 commit into from Jul 12, 2022

Conversation

tmihalac
Copy link
Contributor

Fixes #23600

Added ability to add constraint definitions programmatically

Signed-off-by: Theodor Mihalache tmihalac@redhat.com

@quarkus-bot quarkus-bot bot added the area/hibernate-validator Hibernate Validator label Jul 11, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 11, 2022

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

@tmihalac tmihalac changed the title hibernate-validator Allow specifying alternative constraint validator Hibernate-validator Allow specifying alternative constraint validator Jul 11, 2022
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting!

I think we could even make the mechanism more general given you can do whatever you want with the configuration and we could follow the pattern used for ObjectMapperCustomizer.

In this pattern, we only consider the ObjectMapperCustomizer that have been made CDI beans by the user so we should probably do the very same here (see comment inline about AdditionalBeanBuildItem).

How we handle the priority is an open subject, maybe don't focus on that for now but you can adjust the rest IMO.

@quarkus-bot

This comment has been minimized.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is mostly good now. I added a few suggestions for the Javadoc and the interface needs to be in the API package.

Once this is done, it's good to go!

@gsmet gsmet changed the title Hibernate-validator Allow specifying alternative constraint validator Hibernate Validator - Allow specifying alternative constraint validator Jul 11, 2022
@gsmet gsmet changed the title Hibernate Validator - Allow specifying alternative constraint validator Hibernate Validator - Allow customization of the ValidatorFactory Jul 11, 2022
@tmihalac tmihalac marked this pull request as ready for review July 12, 2022 07:50
@quarkus-bot

This comment has been minimized.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, very nice to have this in.

Signed-off-by: Theodor Mihalache <tmihalac@redhat.com>
@gsmet
Copy link
Member

gsmet commented Jul 12, 2022

I rebased and squashed the commits. I will merge as soon as CI is green.

@gsmet gsmet merged commit 2b81b23 into quarkusio:main Jul 12, 2022
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Jul 12, 2022
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jul 12, 2022
*/
public interface HibernateValidatorFactoryCustomizer {

<T extends BaseHibernateValidatorConfiguration<T>> void customize(T configuration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit late to the party, but... These generics are not useful at all, as far as I can see you could just do this.

@gsmet Should I send a PR?

Suggested change
<T extends BaseHibernateValidatorConfiguration<T>> void customize(T configuration);
void customize(BaseHibernateValidatorConfiguration<?> configuration);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure.

@yrodiere
Copy link
Member

Also, maybe we should add some documentation for this feature? Or is the javadoc considered enough?

gsmet pushed a commit to gsmet/quarkus that referenced this pull request Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hibernate-validator Allow specifying alternative constraint validator
3 participants