Forum Discussion

josh14's avatar
josh14
Occasional Contributor
2 years ago

Java annotations for multipart form data that previously worked with Swagger 2.0 for Open Api 3.0

Trying to figure out what annotations I need to get a multipart form data to work with java using jersey multipart as well as open api spec 3.0.  For gradle, I'm using:

implementation group: 'org.webjars', name: 'swagger-ui', version: '4.18.1'

I am using jersey and the io.swagger.core.v3.oas.annotations, application works fine, I am able to pull up the swagger UI and see all my endpoints.  However, for some of the endpoints where I previously had multi part forms, the form doesn't let me input anything and no longer shows the fields (I've attached pictures for comparison).  I am assuming my annotations are no longer valid.  I took some simplified code for an example of what I'm trying to do.

 

Previously, the @Parameter was @ApiModel which I understand is to be swapped, based on all the forums I've read for how to map from 2.0 to 3.0.  Here is what I currently have.  Like I said, the page comes up, I can see it on the page, but I can't input anything into any fields like I used to be able to when I was using 2.0. Any help is appreciated.

 

@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response UploadBlob(
@Parameter(description = "Object Id associated with the Blob.", schema = @Schema(format = "uuid", defaultValue = "object-id"), required = true)
@FormDataParam("objectId") String objectId,
) throws Exception {
//create a request object
request.setObjectId(objectId);

return ...;

1 Reply

  • josh14's avatar
    josh14
    Occasional Contributor

    Additionally, some of my @FormDataParam also contain input streams, so if there is something I need to do differently there as well, I'd appreciate any help.