Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1225

REST Client Reactive - missing support for POJO JSON serialization in multipart forms

XMLWordPrintable

    • False
    • False
    • +
    • Hide

      Reproducer attached.

      unzip rest-client-reactive-multipart-reproducer.zip
      cd rest-client-reactive-multipart-reproducer
      ./mvnw clean verify
      

      OR

      Covered in QuarkusQETestSuite (test of this issue is disabled, enable upon resolution):

      git clone git@github.com:quarkus-qe/quarkus-test-suite.git
      cd ./quarkus-test-suite
      mvn clean verify -pl http/jaxrs-reactive
      
      Show
      Reproducer attached. unzip rest -client-reactive-multipart-reproducer.zip cd rest -client-reactive-multipart-reproducer ./mvnw clean verify OR Covered in QuarkusQETestSuite (test of this issue is disabled, enable upon resolution): git clone git@github.com:quarkus-qe/quarkus-test-suite.git cd ./quarkus-test-suite mvn clean verify -pl http/jaxrs-reactive

      With non-reactive REST Client (quarkus-rest-client), it is possible to do this:

      public class Data {
          public String foo;
          public Integer bar;
      }
      
      public class MultipartBody {
          @FormParam("data")
          @PartType(MediaType.APPLICATION_JSON)
          public Data data;
      }
      
      @Path("/echo")
      @RegisterRestClient
      public interface MultipartService {
          @POST
          @Consumes(MediaType.MULTIPART_FORM_DATA)
          @Produces(MediaType.TEXT_PLAIN)
          String sendMultipartData(@MultipartForm MultipartBody data);
      
      }
      

      However, the same does not work with REST Clent Reactive (quarkus-rest-client-reactive).
      Invoking the client will result in an error:

      ...
      Caused by: org.jboss.resteasy.reactive.client.api.InvalidRestClientDefinitionException: Failed to generate client for class interface org.acme.rest.client.multipart.MultipartService : Unsupported multipart form field on: org.acme.rest.client.multipart.MultipartBody.org.acme.rest.client.multipart.Data. Supported types are: java.lang.String, java.io.File, java.nio.Path and io.vertx.core.Buffer
      	at org.jboss.resteasy.reactive.client.impl.ClientProxies.get(ClientProxies.java:23)
      	at org.jboss.resteasy.reactive.client.impl.WebTargetImpl.proxy(WebTargetImpl.java:382)
      	at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:273)
      	... 34 more
      

      Related GitHub issue: https://github.com/quarkusio/quarkus/issues/19892

              mszynkie@redhat.com Michal Szynkiewicz (Inactive)
              rhn-support-jsmrcka Josef Smrcka (Inactive)
              Josef Smrcka Josef Smrcka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: