Hi,

The code below works wonderful in a Karaf Container using CXF (explicit via 
JAXRSServerFactoryBean and also implicitly via Jax-RS whiteboard).

Actually, it is the only way I got Multipart to work and at the same time 
generate sensible Swagger/OpenAPI 2.0 Api description. 

Now I’m stuck replicating this same behaviour for OpenAPI 3.0 - the Annotations 
and their semantics have changed, and I can’t get swagger-core to generate the 
right schema. 

Has someone on this mailing list encountered the same challenge? Or, if not, 
can point me to a forum where people have?

Best regards,

Oliver

----------------

import javax.ws.rs.*;
import javax.ws.rs.core.*;

import org.apache.cxf.jaxrs.ext.multipart.Multipart;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


@Path("/upload")
@POST
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "file upload", response = Result.class)
@ApiImplicitParams({@ApiImplicitParam(name = "mode", value =
        "mode", required = true, dataType = "string", paramType = "form"),
                    @ApiImplicitParam(name = "file", value = "file",
                                      required = true, dataType = 
"java.io.File", paramType = "form"),
                   })
@Consumes(MediaType.MULTIPART_FORM_DATA)

public Response uploadFile( 
    @ApiParam(hidden = true)
    @Multipart(value = "mode",
               required = true)
    String mode, 
    @ApiParam(hidden = true)
    @Multipart(value = "file",
               required = true)
    InputStream file) {
        Result result = doStuff(mode,file);
    return Response.ok(serialize(result)).build();
}

Reply via email to