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

RestClient Reactive: Support inheritance of sub resources #22417

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

Sgitario
Copy link
Contributor

Allow to use sub resources in client resources:

Usage for first level:

@Path("/path")
@RegisterRestClient(baseUri = "http://localhost:8081")
@Consumes("text/plain")
@Produces("text/plain")
public interface RootResource {

    @Path("/sub")
    SubClient sub();
}

Second level:

@Consumes("text/plain")
@Produces("text/plain")
interface SubClient {
    @Path("/sub")
    SubSubClient sub();
}

Third and N levels (this was unsupported and now it's supported):

@Consumes("text/plain")
@Produces("text/plain")
interface SubSubClient {
    @GET
    @Path("/simple")
    String simpleGet();
}

Fix #22055

@Sgitario
Copy link
Contributor Author

cc @michalszynkiewicz

@Sgitario Sgitario force-pushed the sb_unabletoparsemethod_2 branch 2 times, most recently from 62706f7 to 2693dc8 Compare December 21, 2021 06:00
}

if (subMethod.getHttpMethod() == null) {
// finding corresponding jandex method, used by enricher (MicroProfile enricher stores it in a field
Copy link
Contributor Author

@Sgitario Sgitario Dec 21, 2021

Choose a reason for hiding this comment

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

This is the only change that was entered in this PR. The rest is a copy of what we had but in the new method handleSubResourceMethod.
cc @michalszynkiewicz

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 21, 2021

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

Failing Jobs - Building 2693dc8

Status Name Step Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
JVM Tests - JDK 11 Windows Build Failures Logs Raw logs
JVM Tests - JDK 17 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 11 #

- Failing: extensions/resteasy-reactive/rest-client-reactive/deployment 
! Skipped: extensions/oidc-client-reactive-filter/deployment extensions/resteasy-reactive/rest-client-reactive-jackson/deployment extensions/resteasy-reactive/rest-client-reactive-kotlin-serialization/deployment and 8 more

📦 extensions/resteasy-reactive/rest-client-reactive/deployment

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource line 59 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @1573c519; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @3bd59894)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource(SubResourceTest.java:59)

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource line 84 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @1573c519; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @3bd59894)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource(SubResourceTest.java:84)

⚙️ JVM Tests - JDK 11 Windows #

- Failing: extensions/resteasy-reactive/rest-client-reactive/deployment 
! Skipped: extensions/oidc-client-reactive-filter/deployment extensions/resteasy-reactive/rest-client-reactive-jackson/deployment extensions/resteasy-reactive/rest-client-reactive-kotlin-serialization/deployment and 8 more

📦 extensions/resteasy-reactive/rest-client-reactive/deployment

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource line 59 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @3d192c2; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2443ebeb)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource(SubResourceTest.java:59)

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource line 84 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @3d192c2; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2443ebeb)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource(SubResourceTest.java:84)

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/resteasy-reactive/rest-client-reactive/deployment 
! Skipped: extensions/oidc-client-reactive-filter/deployment extensions/resteasy-reactive/rest-client-reactive-jackson/deployment extensions/resteasy-reactive/rest-client-reactive-kotlin-serialization/deployment and 8 more

📦 extensions/resteasy-reactive/rest-client-reactive/deployment

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource line 59 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @69acd2d1; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @e8e4c33)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldPassParamsToSubSubResource(SubResourceTest.java:59)

io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource line 84 - More details - Source on GitHub

java.lang.ClassCastException: class io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 cannot be cast to class io.quarkus.jaxrs.client.reactive.runtime.RestClientBase (io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @69acd2d1; io.quarkus.jaxrs.client.reactive.runtime.RestClientBase is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @e8e4c33)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest$SubCliented77e297b94a7e0aa21c1f7f1d8ba4fbe72d61861.sub(Unknown Source)
	at io.quarkus.rest.client.reactive.subresource.SubResourceTest.shouldDoMultiplePostsInSubSubResource(SubResourceTest.java:84)

Allow to use sub resources in client resources:

Usage for first level:
```java
@path("/path")
@RegisterRestClient(baseUri = "http://localhost:8081")
@consumes("text/plain")
@produces("text/plain")
public interface RootResource {

    @path("/sub")
    SubClient sub();
}
```

Second level:
```
@consumes("text/plain")
@produces("text/plain")
interface SubClient {
    @path("/sub")
    SubSubClient sub();
}
```

Third and N levels (this was unsupported and now it's supported):
```
@consumes("text/plain")
@produces("text/plain")
interface SubSubClient {
    @get
    @path("/simple")
    String simpleGet();
}
```

Fix quarkusio#22055
@michalszynkiewicz michalszynkiewicz merged commit c62c13d into quarkusio:main Dec 21, 2021
@quarkus-bot quarkus-bot bot added this to the 2.7 - main milestone Dec 21, 2021
@michalszynkiewicz
Copy link
Member

thanks a lot @Sgitario !

@Sgitario Sgitario deleted the sb_unabletoparsemethod_2 branch December 21, 2021 14:34
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.

Sub-Sub resources not supported in reactive rest client
2 participants