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(core): add partial fix to micronaut hibernate validator and Valu… #6407

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

nkwiatkowski
Copy link
Contributor

…eExtractor

What changes are being made and why?

A custom validator factory provider has been added to resolve a conflict between micronaut validator and micronaut hibernate validator. Now it is possible to use value extractors with hibernate validator


How the changes have been QAed?


Setup Instructions


@Override
public void extractValues(Property<?> originalValue, ValueReceiver receiver) {
receiver.value( null, originalValue.getValue());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
receiver.value( null, originalValue.getValue());
receiver.value( null, originalValue.getExpression());

The value is computed late at rendering time

Copy link
Member

Choose a reason for hiding this comment

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

The implementation is of course naive, I'll handle a better imp later

Comment on lines +47 to +51
//TODO: Temporary to make the ValueExtractor work, but it's not supposed to say here
public T getValue(){
return this.value;
}

Copy link
Member

Choose a reason for hiding this comment

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

Please remove it, see the next comment for why

@loicmathieu
Copy link
Member

The real implementation of the value extractor would be way more complex.
If it is a templated expression => backoff from validation (return null instead of the template?)
Otherwise, check the target type and convert the expression to the target type.

Then, at some point, we would also need to re-validate a property after rendering it ...

So for you test to work, use an annotation in a String not an int, so the target type is the same.
Then, I'll handle from there I think as I know what to do next ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To review
Development

Successfully merging this pull request may close these issues.

2 participants