cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove/hide body parameter from Swagger UI in file upload API

SOLVED
Highlighted
New Contributor

How to remove/hide body parameter from Swagger UI in file upload API

Hello, I'm newbie to swagger UI development using jersey framework. I'm looking out for the resolution for below mentioned issue.

Issue: Unable to remove/hide body parameter from Swagger UI

Ramu_1-1598019974367.png

Please find my Java source code:

@POST
@Path("/createSchedule")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_JSON })
@ApiOperation(httpMethod = HttpMethod.POST, value = "Create a new export schedule(s)")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "Upload the template (.xlsx) to create schedule(s).", required = true, dataType = "file", paramType = "formData") })
public Response createSchedule(@FormDataParam(value="file") InputStream inputStream,
@FormDataParam(value="file") FormDataContentDisposition fileMetaData) throws ScheduleException {
}

I have used Jersey 2.29.1(jersey-container-servlet) & Swagger 1.5.0 (swagger-jaxrs) API's. Also do let me know how to allow only specific file extensions (like .xlsx) to upload from swagger ui.

 

Thanks in advance! Cheers!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Moderator

You're using a very (very) old version of swagger-core. Please make sure to update to the latest, and follow the documentation to learn how to hide parameters.


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

Highlighted
New Contributor

@RonRatovsky - Thank you for your response. I have fixed the issue by doing below changes:

1) Have changed the swagger maven dependency from "swagger-jaxrs" to "swagger-jersey2-jaxrs"

2) Include "@ApiParam" swagger annotation with resource method parameter as "@ApiParam(hidden = true) @FormDataParam(value = "file") FormDataContentDisposition fileMetaData".

 
 

Thanks, 🙂

 

View solution in original post

2 REPLIES 2
Highlighted
Moderator

You're using a very (very) old version of swagger-core. Please make sure to update to the latest, and follow the documentation to learn how to hide parameters.


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

Highlighted
New Contributor

@RonRatovsky - Thank you for your response. I have fixed the issue by doing below changes:

1) Have changed the swagger maven dependency from "swagger-jaxrs" to "swagger-jersey2-jaxrs"

2) Include "@ApiParam" swagger annotation with resource method parameter as "@ApiParam(hidden = true) @FormDataParam(value = "file") FormDataContentDisposition fileMetaData".

 
 

Thanks, 🙂

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements