Hello everyone.
First, our experience moving over to Quarkus has been absolutely spectacular! Everything, including the docs, have been amazing and my only regret is not making the jump earlier.
I have run into an issue with the REST client, RESTEasy, and multipart payloads.
If I invoke the resource directly, through a test case or even curl, it seems to work fine. Invoking any "client" methods
The issues I am having are:
- If I move the multipart payload to a different module (jar) I get this error in the resource "ClassNotFoundException: io.platform.api.publish.FilePackage_generated_populator"
- The RESTClient will not generate the multipart signature/payload when the multipart signature is present. Other methods/payloads work fine. Here I get "
Failed to generate client for class interface io.platform.api.publish.PublishClient : Unsupported multipart form field type: java.util.List<java.io.File> in field" yet I use the exact same class, with the resource, and it seems to work directly.
- I am confused about the dependencies, we have standardized on a reactive approach and not sure what the interaction is between resteasy vs. mutiny vs. the Quarkus rest client, etc. For a while I had issues with conflicting reactive vs. non-reactive when building.
The relevant code is:
Client Definition:
@POST
@Path("/{client}/package")
@Consumes(MULTIPART_FORM_DATA)
@Produces(APPLICATION_JSON)
@Operation(hidden = true)
Uni<Version> publish(@PathParam("client") final String client, @MultipartForm FilePackage request);
Client MultiPart Payload:
public class FilePackage {
@FormParam("project")
public String project;
@FormParam("artifact")
public String artifact;
@FormParam("folder")
public String folder;
@FormParam("index")
@PartType(APPLICATION_JSON)
public Map<String, Integer> index;
@FormParam("file")
@PartType(APPLICATION_OCTET_STREAM)
public List<File> files;
public List<FileObject> getPackageFiles() { ... }
}
Resource Method (note PackageUpload is exactly the same as the FilePackage above - if i only use the simple parameters it marshals from the client to this resource fine - when I uncomment the files or index it fails - the reason I have two payloads, the same, is because of issue #1 above):
@POST
@Path("/{client}/package")
@Consumes(MULTIPART_FORM_DATA)
@Produces(APPLICATION_JSON)
public Uni<Version> publishPackage(@MultipartForm final PackageUpload upload, @BeanParam final ClientRequest request) throws Exception { ... }
Client Test Cases:
@Inject
@RestClient
PublishClient publishClient;
This works using the client...
final JsonPackage pkg = testSupport.readJson(JsonPackage.class);
Version actual = publishClient.publish("my-client", pkg).await().indefinitely();
assertNotNull(actual);
I dont even get here with the client...
final FilePackage pkg = new FilePackage();
pkg.project = "my-project";
pkg.artifact = "my-artifact";
pkg.folder = "my-folder";
pkg.index = new HashMap<>();
pkg.files = new ArrayList<File>();
Version actual = publishClient.publish("my-client", pkg).await().indefinitely();
assertNotNull(actual);
This "resource" test looks to work (direct / no client)...
given().pathParam("client", "my-client")
// Folder
.formParam("project", "my-project")
.formParam("artifact", "my-artifact")
.formParam("folder", "my-folder")
// Index
.multiPart("index", index, APPLICATION_JSON)
// Files
.multiPart("file", file)
.multiPart("file", file)
.multiPart("file", file)
.when()
.post("/s3/publish/{client}/package")
.then()
.log().everything(true)
.statusCode(OK.getStatusCode());
Maven Dependencies:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
Any help or suggestions would be appreciated...