Using multipart forms with REST Client Reactive

261 views
Skip to first unread message

Sebastian Beigel

unread,
Sep 2, 2021, 12:24:00 PM9/2/21
to Quarkus Development mailing list
Hi,

I’m testing the REST client reactive using multipart forms but unfortunately it seems to be quite limited as I get the following error using a more advanced data model:

org.jboss.resteasy.reactive.client.api.InvalidRestClientDefinitionException: Failed to generate client for class interface ...: Unsupported multipart form field on: …Data . Supported types are: java.lang.String, java.io.File, java.nio.Path and io.vertx.core.Buffer

I try to use the following endpoint

@Path("/test")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@POST
Response test(@MultipartForm MyForm form);

..with the following “form“:

class MyForm {
@FormParam("data")
@PartType(MediaType.APPLICATION_JSON)
public Data data;
@FormParam("document")
@PartType("application/pdf")
public File document;
}

…while "Data“ is a POJO that should be serialized as JSON:

class Data {
public String foo;
public LocalDate bar;
}

Is it possible to serialize parts with other types than binaries and strings? AFAIR you could use my example perfectly fine in a quarkus REST endpoint (not a REST client) and the multiple parts are deserialized according to their type (and media type).

Thanks,

Sebastian

Georgios Andrianakis

unread,
Sep 2, 2021, 12:36:28 PM9/2/21
to seba...@beigel.de, Michal Szynkiewicz, Quarkus Development mailing list
If this is the case, we should definitely fix it.
There is no reason I can think of for this to work on the server side and not the client side.
@Michal Szynkiewicz would know more however

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/92A98CEB-23DC-437B-BFD4-B6B22C3A82DB%40beigel.de.

Michał Szynkiewicz

unread,
Sep 2, 2021, 3:06:40 PM9/2/21
to Georgios Andrianakis, seba...@beigel.de, Michal Szynkiewicz, Quarkus Development mailing list
I agree it's worth adding support for serializing POJOs to multipart form fields. 

Sebastian, could you create an issue for this?

Sebastian Beigel

unread,
Sep 3, 2021, 1:46:08 AM9/3/21
to Michał Szynkiewicz, Georgios Andrianakis, Michal Szynkiewicz, Quarkus Development mailing list
Ah, REST client (non-reactive) works as well, so only the (new) reactive REST client is affected.

I’ve created an issue:

https://github.com/quarkusio/quarkus/issues/19892

Thanks,
Sebastian
Reply all
Reply to author
Forward
0 new messages