EDIT: Problem was quarkus-rest-client-reactive
, see my answer.
From my understanding of the MicroProfile REST Client available in Quarkus, I should be able to define sub-resources in my REST client interface that will allow me to nest resources under each other like so.
package org.acme.example
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@RegisterRestClient
@Path("/api/foo")
public interface FoosService {
@GET
@Produces(MediaType.APPLICATION_JSON)
Uni<List<Foo>> getAll();
@Path("/{id}")
FooService foo(@PathParam("id") String id);
}
public interface FooService {
@GET
@Produces(MediaType.APPLICATION_JSON)
Uni<Foo> toRepresentation();
}
However, when I inject and call the client interface in my code, it throws a AbstractMethodError
on the client.foo("bar").toRepresentation()
call.
@Path("/bar")
public class BarResource {
@RestClient
FoosResource client;
@GET
@Produces(MediaType.APPLICATION_JSON)
public Foo getBar() {
return client.foo("bar").toRepresentation();
}
}
All my research into this seems to suggest that this is possible, but there are no specific examples for Quarkus that show client sub-resources.