-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bean Validation support in reactive routes #11864
Bean Validation support in reactive routes #11864
Conversation
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work this afternoon on publishing the list of detected constraints.
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/HandlerDescriptor.java
Outdated
Show resolved
Hide resolved
...sions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/JsonMultiRouteTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR contains a lot of unncessary formatting changes which makes it harder to review :-(
But overall it looks good and is definitely a useful addition!
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/HandlerDescriptor.java
Outdated
Show resolved
Hide resolved
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
Outdated
Show resolved
Hide resolved
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
Outdated
Show resolved
Hide resolved
extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/ValidationSupport.java
Outdated
Show resolved
Hide resolved
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
Outdated
Show resolved
Hide resolved
extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java
Outdated
Show resolved
Hide resolved
...s/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/validation/SyncValidationTest.java
Outdated
Show resolved
Hide resolved
2d8d028
to
a3841d4
Compare
...s/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/validation/SyncValidationTest.java
Outdated
Show resolved
Hide resolved
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/HandlerDescriptor.java
Outdated
Show resolved
Hide resolved
if (desc.isProducedResponseValidated()) { | ||
// If the produced item needs to be validated, we inject the Validator | ||
validatorField = invokerCreator.getFieldCreator("validator", Methods.VALIDATION_VALIDATOR) | ||
.setModifiers(ACC_PUBLIC | ACC_FINAL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field is accessed from another class (a callback). Made it public final after discussion with @mkouba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but we should probably wait for the new build item from @gsmet and then merge ;-).
@cescoffier I merged the BuildItem. Can you rebase and make use of it? |
…d have been configured in the context. When the application uses routingContext.fail(xxx, exception) the xxx (status) was ignored. This commits uses that status if configured.
a3841d4
to
84af783
Compare
@gsmet done. |
@gsmet Is there a reason why not to use |
Anything else required on this? |
@mkouba it's mostly to be consistent with other build items. AFAIK most of our build items are using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier just 2 minor comments: the one from Martin for the typo in the doc and mine for an incorrect comment.
Apart from that, it looks good to go and a very nice addition for 1.9!
...ns/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/HandlerDescriptor.java
Outdated
Show resolved
Hide resolved
@gsmet I don't think it's very practical, esp. in this case where you first convert dot names to strings and then the consumer converts dot name to string again. But it's a very minor "snag" ;-).
Those I've created usually don't ;-). |
Add support for bean validation to reactive routes Use the newly provided Build Item to retrieve the set of supported constraints.
84af783
to
e330f52
Compare
CI issue not related to this PR (MongodbPanacheMockingTest). |
Merged, thanks! |
Implement the support of bean validation with reactive routes:
Uni<X>
are validated - only@Valid
is supported in this caseMultis are not supported, as the use case is not clear.
Ths PR also fixes the Quarkus Error Handler. It was not enforcing the status code that could have been configured in the context.