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

feat: Support UUID filtering in PropertyStringFilter #3363

Merged
merged 5 commits into from
Mar 21, 2025

Conversation

rhys-lastmyle
Copy link
Contributor

@rhys-lastmyle rhys-lastmyle commented Mar 19, 2025

Description

Allow users to pass a PropertyStringFilter for a UUID field.

Fixes #3362

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@CLAassistant
Copy link

CLAassistant commented Mar 19, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@cromoteca cromoteca left a comment

Choose a reason for hiding this comment

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

Hi, thank you for contributing to Hilla!

I did a quick code check and requested some changes, let me know what you think.

Comment on lines 49 to 57
} else if (javaType == UUID.class) {
switch (this.filter.getMatcher()) {
case EQUALS -> {
return criteriaBuilder.equal(propertyPath, UUID.fromString(value));
}
case CONTAINS -> throw new IllegalArgumentException("A UUID cannot be filtered using contains");
case GREATER_THAN ->
throw new IllegalArgumentException("A UUID cannot be filtered using greater than");
case LESS_THAN -> throw new IllegalArgumentException("A UUID cannot be filtered using less than");
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure your code is compliant with Java 17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cromoteca Thank you for reviewing my PR.

I've set my .java-version to 17 and run jenv local to confirm I'm on 17.
When I run ./mvnw clean package it runs without any errors.

What additional checks can I make?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's weird because in Java 17 enhanced switches must explicitly cover all possible cases and null is not covered here. But of course the compiler knows more than me and if it's happy I'm happy too.

Copy link
Contributor

@platosha platosha left a comment

Choose a reason for hiding this comment

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

Hi, thanks for the PR. While we're reviewing it, could you, please, sign the CLA? We require it from all contributors. Here is the link again (same as in the comment): https://cla-assistant.io/vaadin/hilla?pullRequest=3363

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.89%. Comparing base (799fd0a) to head (3c86945).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3363   +/-   ##
=======================================
  Coverage   86.89%   86.89%           
=======================================
  Files         115      115           
  Lines        8289     8289           
  Branches     1271     1271           
=======================================
  Hits         7203     7203           
  Misses       1072     1072           
  Partials       14       14           
Flag Coverage Δ
unittests 86.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@platosha platosha merged commit 447ac68 into vaadin:main Mar 21, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support UUID filtering using Hilla PropertyStringFilter
4 participants