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

Add RestResponse<T> type to RESTEasy Reactive #18269

Merged
merged 5 commits into from
Jul 7, 2021
Merged

Conversation

FroMage
Copy link
Member

@FroMage FroMage commented Jun 30, 2021

Fixes #16718.

  • Adds the RestResponse type, which is generic with the entity type
  • It's a copy of the JAX-RS Response type with generics added and a few modifications
  • All static methods on RestResponse return a fully-built RestResponse instead of a ResponseBuilder (shortcuts)
  • All previous static methods which returned a builder were moved to RestResponse.ResponseBuilder allowing more complex use-cases
  • Added updated RestResponse.Status and RestResponse.StatusCode to list new HTTP statuses and have them as int variants (yay).
  • Added Response RestResponse.toResponse() to convert to a JAX-RS Response
  • Supported in endpoint return types, as well as exception mappers and request filters (everywhere Response was supported)

Questions/remaining:

  • ATM it's implemented by being a copy of the Response and impls, but perhaps it could just wrap one instead?
  • The existing plumbing still relies on Response, not sure if we should turn it around or not. Not sure it's worth it.
  • The existing JAX-RS Request (for preconditions) returns Response types, so I haven't updated the docs example to use RestResponse. We could extend it to offer variants that deal with RestResponse but given that the return type would likely be RestResponse<Void> since those status codes don't have any entity, it would likely be awkward and the endpoints using them would have to return RestResponse<?> in order to allow both variants…
  • I didn't look at the client support, I'm still wondering if it's worth it. I guess.
  • Missing support from smallrye-openapi.

@quarkus-bot
Copy link

quarkus-bot bot commented Jun 30, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 8da4bc1

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Build ⚠️ Check → Logs Raw logs

@geoand
Copy link
Contributor

geoand commented Jun 30, 2021

Nice! I'll take a look tomorrow!

@michalszynkiewicz
Copy link
Member

I like it. I think it's worth having it for the client side too.

@geoand geoand changed the title Added RestResponse<T> Add RestResponse<T> type to RESTEasy Reactive Jul 1, 2021
@geoand geoand changed the title Add RestResponse<T> type to RESTEasy Reactive Add RestResponse<T> type to RESTEasy Reactive Jul 1, 2021
@geoand
Copy link
Contributor

geoand commented Jul 1, 2021

It seems like the PR needs a formatting update

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

I think this is great! I added some small comments

@@ -94,6 +94,11 @@
<artifactId>quarkus-jaxrs-client-reactive-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this works properly? Just want to make sure it doesn't create any cyclic dependencies or anything

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it's a test dep, and it seems to build… 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

OK :)

@geoand
Copy link
Contributor

geoand commented Jul 1, 2021

Questions/remaining:

  • ATM it's implemented by being a copy of the Response and impls, but perhaps it could just wrap one instead?

I think it's best as is

  • The existing plumbing still relies on Response, not sure if we should turn it around or not. Not sure it's worth it.

I don't think it's worth it.

  • The existing JAX-RS Request (for preconditions) returns Response types, so I haven't updated the docs example to use RestResponse. We could extend it to offer variants that deal with RestResponse but given that the return type would likely be RestResponse<Void> since those status codes don't have any entity, it would likely be awkward and the endpoints using them would have to return RestResponse<?> in order to allow both variants…
  • I didn't look at the client support, I'm still wondering if it's worth it. I guess.

Yeah, it does sound useful but can definitely done in a follow-up

  • Missing support from smallrye-openapi.

@phillip-kruger ^

@phillip-kruger
Copy link
Member

phillip-kruger commented Jul 1, 2021

Ok great ! We can add support for it a.s.a.p. I'll open a ticket in SmallRye.
(see smallrye/smallrye-open-api#844)

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 6, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building 679b427

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Build ⚠️ Check → Logs Raw logs

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 6, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building 5deff40

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Reclaim Disk Space ⚠️ Check → Logs Raw logs
CI Sanity Check Build ⚠️ Check → Logs Raw logs

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 6, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 31ab415

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Build ⚠️ Check → Logs Raw logs

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

💯

@FroMage
Copy link
Member Author

FroMage commented Jul 6, 2021

Huh…

2021-07-06T09:54:43.0283096Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-runtime-deps) on project quarkus-resteasy-reactive-deployment: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
2021-07-06T09:54:43.0287744Z org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-runtime-deps) on project quarkus-resteasy-reactive-deployment: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
2021-07-06T09:54:43.0291388Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
2021-07-06T09:54:43.0294430Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2021-07-06T09:54:43.0304957Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2021-07-06T09:54:43.0308505Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2021-07-06T09:54:43.0324225Z     at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
2021-07-06T09:54:43.0333044Z     at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
2021-07-06T09:54:43.0339067Z     at java.util.concurrent.FutureTask.run (FutureTask.java:264)
2021-07-06T09:54:43.0341416Z     at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
2021-07-06T09:54:43.0343081Z     at java.util.concurrent.FutureTask.run (FutureTask.java:264)
2021-07-06T09:54:43.0345281Z     at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
2021-07-06T09:54:43.0348088Z     at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
2021-07-06T09:54:43.0349433Z     at java.lang.Thread.run (Thread.java:829)
2021-07-06T09:54:43.0351420Z Caused by: org.apache.maven.plugin.MojoExecutionException: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
2021-07-06T09:54:43.0353904Z     at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:260)
2021-07-06T09:54:43.0356620Z     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2021-07-06T09:54:43.0359254Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
2021-07-06T09:54:43.0361672Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2021-07-06T09:54:43.0364091Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2021-07-06T09:54:43.0367624Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2021-07-06T09:54:43.0372072Z     at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
2021-07-06T09:54:43.0376464Z     at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
2021-07-06T09:54:43.0379091Z     at java.util.concurrent.FutureTask.run (FutureTask.java:264)
2021-07-06T09:54:43.0380805Z     at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
2021-07-06T09:54:43.0382703Z     at java.util.concurrent.FutureTask.run (FutureTask.java:264)
2021-07-06T09:54:43.0384610Z     at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
2021-07-06T09:54:43.0392353Z     at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
2021-07-06T09:54:43.0393668Z     at java.lang.Thread.run (Thread.java:829)

@geoand
Copy link
Contributor

geoand commented Jul 6, 2021

Likely:

2021-07-06T09:50:33.7513396Z [INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-runtime-deps) @ quarkus-resteasy-reactive-deployment ---
2021-07-06T09:50:33.7631768Z [WARNING] Rule 0: io.quarkus.enforcer.BansRuntimeDependency failed with message:
2021-07-06T09:50:33.7633503Z 1 illegal runtime dependencies found that have to be replaced with their -deployment counterparts:
2021-07-06T09:50:33.7634648Z 	quarkus-resteasy-reactive-jackson

which is what I thought would happen because of the jackson dependency you added

@FroMage
Copy link
Member Author

FroMage commented Jul 6, 2021

Huh, I wonder how I didn't notice this before. Fixed now, let's see.

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 6, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building e469be4

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Build ⚠️ Check → Logs Raw logs

@FroMage
Copy link
Member Author

FroMage commented Jul 6, 2021

Oh FFS. Well this is even worse now.

@FroMage
Copy link
Member Author

FroMage commented Jul 6, 2021

OK, moved them to the jackson module. Same player shoots again.

@geoand
Copy link
Contributor

geoand commented Jul 6, 2021

OK, moved them to the jackson module. Same player shoots again.

Nothing but net :)

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 6, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building f5eb90d

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build Build ⚠️ Check → Logs Raw logs

@FroMage
Copy link
Member Author

FroMage commented Jul 6, 2021

Now, that was a majorly screwed up rebase. Took me forever to untangle it. WOW.

@FroMage FroMage merged commit e004372 into quarkusio:main Jul 7, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jul 7, 2021
@FroMage FroMage deleted the 16718 branch July 7, 2021 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RESTEasy Reactive: introduce GenericResponse type
4 participants